Merge branch 'master' into master
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
Facebook Chat (Messenger) for Python
|
||||
|
||||
:copyright: (c) 2015 - 2018 by Taehoon Kim
|
||||
:license: BSD, see LICENSE for more details.
|
||||
:license: BSD 3-Clause, see LICENSE for more details.
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals
|
||||
@@ -19,7 +19,7 @@ __version__ = '1.3.9'
|
||||
__description__ = 'Facebook Chat (Messenger) for Python'
|
||||
|
||||
__copyright__ = 'Copyright 2015 - 2018 by Taehoon Kim'
|
||||
__license__ = 'BSD'
|
||||
__license__ = 'BSD 3-Clause'
|
||||
|
||||
__author__ = 'Taehoon Kim; Moreels Pieter-Jan; Mads Marquart'
|
||||
__email__ = 'carpedm20@gmail.com'
|
||||
|
@@ -265,8 +265,7 @@ class Client(object):
|
||||
|
||||
# Usually, 'Checkpoint' will refer to 2FA
|
||||
if ('checkpoint' in r.url
|
||||
and ('enter security code to continue' in r.text.lower()
|
||||
or 'enter login code to continue' in r.text.lower())):
|
||||
and ('id="approvals_code"' in r.text.lower())):
|
||||
r = self._2FA(r)
|
||||
|
||||
# Sometimes Facebook tries to show the user a "Save Device" dialog
|
||||
@@ -1033,7 +1032,25 @@ class Client(object):
|
||||
is_gif = (mimetype == 'image/gif')
|
||||
image_id = self._uploadImage(image_path, open(image_path, 'rb'), mimetype)
|
||||
return self.sendImage(image_id=image_id, message=message, thread_id=thread_id, thread_type=thread_type, is_gif=is_gif)
|
||||
|
||||
|
||||
def createGroup(self, message, person_ids=None):
|
||||
"""Creates a group with the given ids
|
||||
:param person_ids: A list of people to create the group with.
|
||||
:return: Returns error if couldn't create group, returns True when the group created.
|
||||
"""
|
||||
payload = {
|
||||
"send" : "send",
|
||||
"body": message,
|
||||
"ids" : person_ids
|
||||
}
|
||||
r = self._post(self.req_url.CREATE_GROUP, payload)
|
||||
if "send_success" in r.url:
|
||||
log.debug("The group was created successfully!")
|
||||
return True
|
||||
else:
|
||||
log.warning("Error while creating group")
|
||||
return False
|
||||
|
||||
def addUsersToGroup(self, user_ids, thread_id=None):
|
||||
"""
|
||||
Adds users to a group.
|
||||
|
@@ -132,7 +132,8 @@ class ReqUrl(object):
|
||||
UNBLOCK_USER = "https://www.facebook.com/messaging/unblock_messages/?dpr=1"
|
||||
SAVE_ADMINS = "https://www.facebook.com/messaging/save_admins/?dpr=1"
|
||||
APPROVAL_MODE = "https://www.facebook.com/messaging/set_approval_mode/?dpr=1"
|
||||
|
||||
CREATE_GROUP = "https://m.facebook.com/messages/send/?icm=1"
|
||||
|
||||
pull_channel = 0
|
||||
|
||||
def change_pull_channel(self, channel=None):
|
||||
|
Reference in New Issue
Block a user