makara-filip / ts-messenger-api

The unofficial API for FB Messenger communication
MIT License
50 stars 13 forks source link

getThreadInfo() throws error when provided valid userID #17

Closed adamhl8 closed 2 years ago

adamhl8 commented 3 years ago

Describe the bug getThreadInfo() throws an error when provided a valid userID (one-to-one chat). Looking at the type definition for ThreadInfo, it seems like getThreadInfo() should still return a ThreadInfo object but with some values as null.

To Reproduce

// login stuff

await api.getThreadInfo(validUserID) // throws error
TypeError: Cannot read property 'emoji' of null
    at Object.formatThreadInfo (/home/adam/dev/auto-messenger/node_modules/ts-messenger-api/dist/lib/formatters.js:393:53)
    at /home/adam/dev/auto-messenger/node_modules/ts-messenger-api/dist/lib/api.js:977:51
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Environment (please complete the following information):