Merge pull request #111 from zeroone2numeral2/develop
Allow to set audio thumbnail when using send_audio
This commit is contained in:
commit
b49190256d
@ -35,6 +35,7 @@ class SendAudio(BaseClient):
|
||||
duration: int = 0,
|
||||
performer: str = None,
|
||||
title: str = None,
|
||||
thumb: str = None,
|
||||
disable_notification: bool = None,
|
||||
reply_to_message_id: int = None,
|
||||
reply_markup=None,
|
||||
@ -74,6 +75,12 @@ class SendAudio(BaseClient):
|
||||
title (``str``, *optional*):
|
||||
Track name.
|
||||
|
||||
thumb (``str``, *optional*):
|
||||
Thumbnail of the music file album cover.
|
||||
The thumbnail should be in JPEG format and less than 200 KB in size.
|
||||
A thumbnail's width and height should not exceed 90 pixels.
|
||||
Thumbnails can't be reused and can be only uploaded as a new file.
|
||||
|
||||
disable_notification (``bool``, *optional*):
|
||||
Sends the message silently.
|
||||
Users will receive a notification with no sound.
|
||||
@ -118,10 +125,12 @@ class SendAudio(BaseClient):
|
||||
style = self.html if parse_mode.lower() == "html" else self.markdown
|
||||
|
||||
if os.path.exists(audio):
|
||||
thumb = None if thumb is None else self.save_file(thumb)
|
||||
file = self.save_file(audio, progress=progress, progress_args=progress_args)
|
||||
media = types.InputMediaUploadedDocument(
|
||||
mime_type=mimetypes.types_map.get("." + audio.split(".")[-1], "audio/mpeg"),
|
||||
file=file,
|
||||
thumb=thumb,
|
||||
attributes=[
|
||||
types.DocumentAttributeAudio(
|
||||
duration=duration,
|
||||
|
Loading…
Reference in New Issue
Block a user