Add forwarding attachments (#420)

- Add ability to forward attachments and `Message.forwarded` attribute
- Improve error handling for a lot of client methods, including, but not limited to:
    - `fetchAllUsers`
    - `searchForMessageIDs`
    - `search`
    - `fetchThreadInfo` and siblings
    - `fetchUnread`
    - `fetchUnseen`
    - `fetchPollOptions`
    - `fetchPlanInfo`
    - `send` and siblings
    - File uploads
This commit is contained in:
Kacper Ziubryniewicz
2019-04-25 22:03:03 +02:00
committed by Mads Marquart
parent 61502ed32a
commit 70faa86e34
3 changed files with 60 additions and 23 deletions

View File

@@ -1707,6 +1707,23 @@ class Client(object):
thread_type=thread_type,
)
def forwardAttachment(self, attachment_id, thread_id=None):
"""
Forwards an attachment
:param attachment_id: Attachment ID to forward
:param thread_id: User/Group ID to send to. See :ref:`intro_threads`
:raises: FBchatException if request failed
"""
thread_id, thread_type = self._getThread(thread_id, None)
data = {
"attachment_id": attachment_id,
"recipient_map[{}]".format(generateOfflineThreadingID()): thread_id,
}
j = self._post(
self.req_url.FORWARD_ATTACHMENT, data, fix_request=True, as_json=True
)
def createGroup(self, message, user_ids):
"""
Creates a group with the given ids