diff --git a/fbchat/graphql.py b/fbchat/graphql.py index 510e93b9..e290e531 100644 --- a/fbchat/graphql.py +++ b/fbchat/graphql.py @@ -209,7 +209,13 @@ def graphql_to_message(message): rtn.timestamp = message.get('timestamp_precise') if message.get('unread') is not None: rtn.is_read = not message['unread'] - rtn.reactions = {str(r['user']['id']):MessageReaction(r['reaction']) for r in message.get('message_reactions')} + rtn.reactions = {} + for r in message.get('message_reactions'): + try: + reaction = MessageReaction(r['reaction']) + except ValueError: + reaction = MessageReaction.UNDEFINED + rtn.reactions[str(r['user']['id'])] = reaction if message.get('blob_attachments') is not None: rtn.attachments = [graphql_to_attachment(attachment) for attachment in message['blob_attachments']] # TODO: This is still missing parsing: diff --git a/fbchat/models.py b/fbchat/models.py index 7cc9d65f..b9a13bcf 100644 --- a/fbchat/models.py +++ b/fbchat/models.py @@ -581,3 +581,4 @@ class MessageReaction(Enum): ANGRY = '😠' YES = '👍' NO = '👎' + UNDEFINED = ''