Allow force_document in edit_message (#1335)

This commit is contained in:
Mengyang Li 2019-11-23 02:00:51 -08:00 committed by Lonami
parent 3a56c8b0f4
commit 149b26fb51

View File

@ -914,6 +914,7 @@ class MessageMethods:
parse_mode: str = (), parse_mode: str = (),
link_preview: bool = True, link_preview: bool = True,
file: 'hints.FileLike' = None, file: 'hints.FileLike' = None,
force_document: bool = False,
buttons: 'hints.MarkupLike' = None, buttons: 'hints.MarkupLike' = None,
schedule: 'hints.DateLike' = None schedule: 'hints.DateLike' = None
) -> 'types.Message': ) -> 'types.Message':
@ -957,6 +958,9 @@ class MessageMethods:
The file object that should replace the existing media The file object that should replace the existing media
in the message. in the message.
force_document (`bool`, optional):
Whether to send the given file as a document or not.
buttons (`list`, `custom.Button <telethon.tl.custom.button.Button>`, :tl:`KeyboardButton`): buttons (`list`, `custom.Button <telethon.tl.custom.button.Button>`, :tl:`KeyboardButton`):
The matrix (list of lists), row list or button to be shown The matrix (list of lists), row list or button to be shown
after sending the message. This parameter will only work if after sending the message. This parameter will only work if
@ -1008,7 +1012,8 @@ class MessageMethods:
entity = entity.to_id entity = entity.to_id
text, msg_entities = await self._parse_message_text(text, parse_mode) text, msg_entities = await self._parse_message_text(text, parse_mode)
file_handle, media, image = await self._file_to_media(file) file_handle, media, image = await self._file_to_media(file,
force_document=force_document)
if isinstance(entity, types.InputBotInlineMessageID): if isinstance(entity, types.InputBotInlineMessageID):
return await self(functions.messages.EditInlineBotMessageRequest( return await self(functions.messages.EditInlineBotMessageRequest(