Expose more raw API params in friendly methods (#3104)

This commit is contained in:
Devesh Pal
2021-08-05 10:54:07 +02:00
committed by GitHub
parent ad55b945c1
commit e5599c178b
4 changed files with 53 additions and 12 deletions
+11 -5
View File
@@ -112,6 +112,7 @@ class UploadMethods:
video_note: bool = False,
buttons: 'hints.MarkupLike' = None,
silent: bool = None,
background: bool = None,
supports_streaming: bool = False,
schedule: 'hints.DateLike' = None,
comment_to: 'typing.Union[int, types.Message]' = None,
@@ -249,6 +250,9 @@ class UploadMethods:
the person has the chat muted). Set it to `True` to alter
this behaviour.
background (`bool`, optional):
Whether the message should be send in background.
supports_streaming (`bool`, optional):
Whether the sent video supports streaming or not. Note that
Telegram only recognizes as streamable some formats like MP4,
@@ -347,7 +351,7 @@ class UploadMethods:
progress_callback=progress_callback, reply_to=reply_to,
parse_mode=parse_mode, silent=silent, schedule=schedule,
supports_streaming=supports_streaming, clear_draft=clear_draft,
force_document=force_document
force_document=force_document, background=background,
)
file = file[10:]
captions = captions[10:]
@@ -360,7 +364,7 @@ class UploadMethods:
attributes=attributes, thumb=thumb, voice_note=voice_note,
video_note=video_note, buttons=buttons, silent=silent,
supports_streaming=supports_streaming, schedule=schedule,
clear_draft=clear_draft,
clear_draft=clear_draft, background=background,
**kwargs
))
@@ -389,7 +393,8 @@ class UploadMethods:
request = functions.messages.SendMediaRequest(
entity, media, reply_to_msg_id=reply_to, message=caption,
entities=msg_entities, reply_markup=markup, silent=silent,
schedule_date=schedule, clear_draft=clear_draft
schedule_date=schedule, clear_draft=clear_draft,
background=background
)
return self._get_response_message(request, await self(request), entity)
@@ -397,7 +402,7 @@ class UploadMethods:
progress_callback=None, reply_to=None,
parse_mode=(), silent=None, schedule=None,
supports_streaming=None, clear_draft=None,
force_document=False):
force_document=False, background=None):
"""Specialized version of .send_file for albums"""
# We don't care if the user wants to avoid cache, we will use it
# anyway. Why? The cached version will be exactly the same thing
@@ -456,7 +461,8 @@ class UploadMethods:
# Now we can construct the multi-media request
request = functions.messages.SendMultiMediaRequest(
entity, reply_to_msg_id=reply_to, multi_media=media,
silent=silent, schedule_date=schedule, clear_draft=clear_draft
silent=silent, schedule_date=schedule, clear_draft=clear_draft,
background=background
)
result = await self(request)