Facebook-chat-api: getThreadHistory assumes all returned objects are messages

Created on 31 Mar 2017  路  4Comments  路  Source: Schmavery/facebook-chat-api

If there are log entries (such as changing nickname or emoji or color) in the history they are nonetheless treated as messages at https://github.com/Schmavery/facebook-chat-api/blob/9b85a79c3dafca33d6f4d36f6c00fc373903698a/src/getThreadHistory.js#L56, which strips out all of the useful log data.

bug

Most helpful comment

This seems related to #313
I'd love if someone was able to clean up the logic in getThreadHistory, it's pretty old now. There's been some error handling logic added recently, but it could still use some work.

All 4 comments

This seems related to #313
I'd love if someone was able to clean up the logic in getThreadHistory, it's pretty old now. There's been some error handling logic added recently, but it could still use some work.

How about for every message from getThreadHistory, instead of calling utils.formatMessage, another helper method is called that reads the action_type property of the message object and returns the formatted message from the correct formatter? It shouldn't be too difficult or complex; I'll put together a PR shortly. (Thanks for working on this library by the way; it's really really helpful)

Sounds about right, hopefully that will work! Let me know if you run into any problems.

Thanks again @GEOFBOT

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DanH42 picture DanH42  路  3Comments

MikeShi42 picture MikeShi42  路  9Comments

rivc picture rivc  路  4Comments

tarungog picture tarungog  路  3Comments

Dinamots picture Dinamots  路  8Comments