From ea0360e9cb4c5382f8d4a1d9f69848d6ab51711f Mon Sep 17 00:00:00 2001 From: David Hoppenbrouwers Date: Wed, 12 Dec 2018 13:18:43 +0100 Subject: [PATCH 1/2] Removed MessageReaction It doesn't serve any purpose anymore since any emoji can be used apparently. --- fbchat/client.py | 2 +- fbchat/graphql.py | 2 +- fbchat/models.py | 12 +----------- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/fbchat/client.py b/fbchat/client.py index de5ca090..2caa4dd4 100644 --- a/fbchat/client.py +++ b/fbchat/client.py @@ -1486,7 +1486,7 @@ def reactToMessage(self, message_id, reaction): :param message_id: :ref:`Message ID ` to react to :param reaction: Reaction emoji to use - :type reaction: models.MessageReaction + :type reaction: str :raises: FBchatException if request failed """ full_data = { diff --git a/fbchat/graphql.py b/fbchat/graphql.py index 510e93b9..4811d62d 100644 --- a/fbchat/graphql.py +++ b/fbchat/graphql.py @@ -209,7 +209,7 @@ 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 = {str(r['user']['id']): r['reaction'] for r in message.get('message_reactions')} 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..628b4ac4 100644 --- a/fbchat/models.py +++ b/fbchat/models.py @@ -182,7 +182,7 @@ class Message(object): is_read = None #: A list of pepole IDs who read the message, works only with :func:`fbchat.Client.fetchThreadMessages` read_by = None - #: A dict with user's IDs as keys, and their :class:`MessageReaction` as values + #: A dict with user's IDs as keys, and their :class:`str` as values reactions = None #: The actual message text = None @@ -571,13 +571,3 @@ class ThreadColor(Enum): CAMEO = '#d4a88c' BRILLIANT_ROSE = '#ff5ca1' BILOBA_FLOWER = '#a695c7' - -class MessageReaction(Enum): - """Used to specify a message reaction""" - LOVE = '😍' - SMILE = '😆' - WOW = '😮' - SAD = '😢' - ANGRY = '😠' - YES = '👍' - NO = '👎' From 14f391a2c362ec4c2d4a59ab4a38a96c7c258e3f Mon Sep 17 00:00:00 2001 From: David Hoppenbrouwers Date: Wed, 12 Dec 2018 14:24:26 +0100 Subject: [PATCH 2/2] Updated reactToMessage --- fbchat/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fbchat/client.py b/fbchat/client.py index 2caa4dd4..bc651419 100644 --- a/fbchat/client.py +++ b/fbchat/client.py @@ -1497,7 +1497,7 @@ def reactToMessage(self, message_id, reaction): "client_mutation_id": "1", "actor_id": self.uid, "message_id": str(message_id), - "reaction": reaction.value + "reaction": reaction } }) }