From 13d0dc4ba4e0cdb5bcded2b09c490e5295cc21fc Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Wed, 28 Jun 2017 14:30:29 +0200 Subject: [PATCH] Fixed ChangeThreadTitle and ThreadColor.MESSENGER_BLUE --- fbchat/__init__.py | 2 +- fbchat/client.py | 3 +++ fbchat/graphql.py | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/fbchat/__init__.py b/fbchat/__init__.py index 50983fb..d312ec0 100644 --- a/fbchat/__init__.py +++ b/fbchat/__init__.py @@ -17,7 +17,7 @@ from .client import * __copyright__ = 'Copyright 2015 - {} by Taehoon Kim'.format(datetime.now().year) -__version__ = '1.0.6' +__version__ = '1.0.7' __license__ = 'BSD' __author__ = 'Taehoon Kim; Moreels Pieter-Jan; Mads Marquart' __email__ = 'carpedm20@gmail.com' diff --git a/fbchat/client.py b/fbchat/client.py index c17e6f8..f443740 100644 --- a/fbchat/client.py +++ b/fbchat/client.py @@ -1012,6 +1012,7 @@ class Client(object): :type thread_type: models.ThreadType :raises: Exception if request failed """ + thread_id, thread_type = self._getThread(thread_id, thread_type) if thread_type == ThreadType.USER: @@ -1024,6 +1025,8 @@ class Client(object): data['log_message_data[name]'] = title data['log_message_type'] = 'log:thread-name' + return self._doSendRequest(data) + def changeNickname(self, nickname, user_id, thread_id=None, thread_type=ThreadType.USER): """ Changes the nickname of a user in a thread diff --git a/fbchat/graphql.py b/fbchat/graphql.py index 61b3e17..e561170 100644 --- a/fbchat/graphql.py +++ b/fbchat/graphql.py @@ -26,9 +26,11 @@ class ConcatJSONDecoder(json.JSONDecoder): def graphql_color_to_enum(color): if color is None: return None + if len(color) == 0: + return ThreadColor.MESSENGER_BLUE try: return ThreadColor('#{}'.format(color[2:].lower())) - except KeyError: + except KeyError, ValueError: raise Exception('Could not get ThreadColor from color: {}'.format(color)) def get_customization_info(thread):