Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Removed MessageReaction #369

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fbchat/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1486,7 +1486,7 @@ def reactToMessage(self, message_id, reaction):

:param message_id: :ref:`Message ID <intro_message_ids>` to react to
:param reaction: Reaction emoji to use
:type reaction: models.MessageReaction
:type reaction: str
:raises: FBchatException if request failed
"""
full_data = {
Expand All @@ -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
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion fbchat/graphql.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 1 addition & 11 deletions fbchat/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = '👎'