Merge pull request #316 from ThatAlexanderA/patch-1
Added `createGroup`
This commit is contained in:
@@ -1033,7 +1033,25 @@ class Client(object):
|
|||||||
is_gif = (mimetype == 'image/gif')
|
is_gif = (mimetype == 'image/gif')
|
||||||
image_id = self._uploadImage(image_path, open(image_path, 'rb'), mimetype)
|
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)
|
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):
|
def addUsersToGroup(self, user_ids, thread_id=None):
|
||||||
"""
|
"""
|
||||||
Adds users to a group.
|
Adds users to a group.
|
||||||
|
@@ -125,6 +125,7 @@ class ReqUrl(object):
|
|||||||
EVENT_REMINDER = "https://www.facebook.com/ajax/eventreminder/create"
|
EVENT_REMINDER = "https://www.facebook.com/ajax/eventreminder/create"
|
||||||
MODERN_SETTINGS_MENU = "https://www.facebook.com/bluebar/modern_settings_menu/"
|
MODERN_SETTINGS_MENU = "https://www.facebook.com/bluebar/modern_settings_menu/"
|
||||||
REMOVE_FRIEND = "https://m.facebook.com/a/removefriend.php"
|
REMOVE_FRIEND = "https://m.facebook.com/a/removefriend.php"
|
||||||
|
CREATE_GROUP = "https://m.facebook.com/messages/send/?icm=1"
|
||||||
|
|
||||||
pull_channel = 0
|
pull_channel = 0
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user