Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
fb1ad5800c | ||
|
4dd15b05ef | ||
|
d7cdb644c4 | ||
|
bfcf4950b3 | ||
|
6612c97f05 | ||
|
b92cf62726 | ||
|
a53ba33a81 | ||
|
c04d38cf63 | ||
|
a051adcbc0 |
@@ -17,7 +17,7 @@ from .client import *
|
|||||||
|
|
||||||
|
|
||||||
__copyright__ = 'Copyright 2015 - {} by Taehoon Kim'.format(datetime.now().year)
|
__copyright__ = 'Copyright 2015 - {} by Taehoon Kim'.format(datetime.now().year)
|
||||||
__version__ = '1.3.2'
|
__version__ = '1.3.4'
|
||||||
__license__ = 'BSD'
|
__license__ = 'BSD'
|
||||||
__author__ = 'Taehoon Kim; Moreels Pieter-Jan; Mads Marquart'
|
__author__ = 'Taehoon Kim; Moreels Pieter-Jan; Mads Marquart'
|
||||||
__email__ = 'carpedm20@gmail.com'
|
__email__ = 'carpedm20@gmail.com'
|
||||||
|
@@ -754,7 +754,7 @@ class Client(object):
|
|||||||
|
|
||||||
return list(reversed([graphql_to_message(message) for message in j['message_thread']['messages']['nodes']]))
|
return list(reversed([graphql_to_message(message) for message in j['message_thread']['messages']['nodes']]))
|
||||||
|
|
||||||
def fetchThreadList(self, offset=0, limit=20, thread_location=ThreadLocation.INBOX, before=None):
|
def fetchThreadList(self, offset=None, limit=20, thread_location=ThreadLocation.INBOX, before=None):
|
||||||
"""Get thread list of your facebook account
|
"""Get thread list of your facebook account
|
||||||
|
|
||||||
:param offset: Deprecated. Do not use!
|
:param offset: Deprecated. Do not use!
|
||||||
|
@@ -181,6 +181,9 @@ def graphql_to_thread(thread):
|
|||||||
c_info = get_customization_info(thread)
|
c_info = get_customization_info(thread)
|
||||||
participants = [node['messaging_actor'] for node in thread['all_participants']['nodes']]
|
participants = [node['messaging_actor'] for node in thread['all_participants']['nodes']]
|
||||||
user = next(p for p in participants if p['id'] == thread['thread_key']['other_user_id'])
|
user = next(p for p in participants if p['id'] == thread['thread_key']['other_user_id'])
|
||||||
|
last_message_timestamp = None
|
||||||
|
if 'last_message' in thread:
|
||||||
|
last_message_timestamp = thread['last_message']['nodes'][0]['timestamp_precise']
|
||||||
|
|
||||||
return User(
|
return User(
|
||||||
user['id'],
|
user['id'],
|
||||||
@@ -196,7 +199,8 @@ def graphql_to_thread(thread):
|
|||||||
emoji=c_info.get('emoji'),
|
emoji=c_info.get('emoji'),
|
||||||
own_nickname=c_info.get('own_nickname'),
|
own_nickname=c_info.get('own_nickname'),
|
||||||
photo=user['big_image_src'].get('uri'),
|
photo=user['big_image_src'].get('uri'),
|
||||||
message_count=thread.get('messages_count')
|
message_count=thread.get('messages_count'),
|
||||||
|
last_message_timestamp=last_message_timestamp
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
raise FBchatException('Unknown thread type: {}, with data: {}'.format(thread.get('thread_type'), thread))
|
raise FBchatException('Unknown thread type: {}, with data: {}'.format(thread.get('thread_type'), thread))
|
||||||
@@ -205,6 +209,9 @@ def graphql_to_group(group):
|
|||||||
if group.get('image') is None:
|
if group.get('image') is None:
|
||||||
group['image'] = {}
|
group['image'] = {}
|
||||||
c_info = get_customization_info(group)
|
c_info = get_customization_info(group)
|
||||||
|
last_message_timestamp = None
|
||||||
|
if 'last_message' in group:
|
||||||
|
last_message_timestamp = group['last_message']['nodes'][0]['timestamp_precise']
|
||||||
return Group(
|
return Group(
|
||||||
group['thread_key']['thread_fbid'],
|
group['thread_key']['thread_fbid'],
|
||||||
participants=set([node['messaging_actor']['id'] for node in group['all_participants']['nodes']]),
|
participants=set([node['messaging_actor']['id'] for node in group['all_participants']['nodes']]),
|
||||||
@@ -213,7 +220,8 @@ def graphql_to_group(group):
|
|||||||
emoji=c_info.get('emoji'),
|
emoji=c_info.get('emoji'),
|
||||||
photo=group['image'].get('uri'),
|
photo=group['image'].get('uri'),
|
||||||
name=group.get('name'),
|
name=group.get('name'),
|
||||||
message_count=group.get('messages_count')
|
message_count=group.get('messages_count'),
|
||||||
|
last_message_timestamp=last_message_timestamp
|
||||||
)
|
)
|
||||||
|
|
||||||
def graphql_to_room(room):
|
def graphql_to_room(room):
|
||||||
|
@@ -451,10 +451,10 @@ class ThreadType(Enum):
|
|||||||
|
|
||||||
class ThreadLocation(Enum):
|
class ThreadLocation(Enum):
|
||||||
"""Used to specify where a thread is located (inbox, pending, archived, other)."""
|
"""Used to specify where a thread is located (inbox, pending, archived, other)."""
|
||||||
INBOX = 'inbox'
|
INBOX = 'INBOX'
|
||||||
PENDING = 'pending'
|
PENDING = 'PENDING'
|
||||||
ARCHIVED = 'action:archived'
|
ARCHIVED = 'ARCHIVED'
|
||||||
OTHER = 'other'
|
OTHER = 'OTHER'
|
||||||
|
|
||||||
class TypingStatus(Enum):
|
class TypingStatus(Enum):
|
||||||
"""Used to specify whether the user is typing or has stopped typing"""
|
"""Used to specify whether the user is typing or has stopped typing"""
|
||||||
|
2
setup.py
2
setup.py
@@ -54,10 +54,8 @@ setup(
|
|||||||
classifiers=[
|
classifiers=[
|
||||||
'Development Status :: 2 - Pre-Alpha',
|
'Development Status :: 2 - Pre-Alpha',
|
||||||
'Intended Audience :: Developers',
|
'Intended Audience :: Developers',
|
||||||
'Intended Audience :: Developers',
|
|
||||||
'Intended Audience :: Information Technology',
|
'Intended Audience :: Information Technology',
|
||||||
'License :: OSI Approved :: BSD License',
|
'License :: OSI Approved :: BSD License',
|
||||||
'License :: OSI Approved :: BSD License',
|
|
||||||
'Operating System :: OS Independent',
|
'Operating System :: OS Independent',
|
||||||
'Programming Language :: Python :: 2.6',
|
'Programming Language :: Python :: 2.6',
|
||||||
'Programming Language :: Python :: 2.7',
|
'Programming Language :: Python :: 2.7',
|
||||||
|
Reference in New Issue
Block a user