diff --git a/telegram/bot.py b/telegram/bot.py index 3125e1ccf..da164a091 100644 --- a/telegram/bot.py +++ b/telegram/bot.py @@ -323,7 +323,14 @@ class Bot(TelegramObject): @log @message - def sendAudio(self, chat_id, audio, duration=None, performer=None, title=None, **kwargs): + def sendAudio(self, + chat_id, + audio, + duration=None, + performer=None, + title=None, + caption=None, + **kwargs): """Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in an .mp3 format. On success, the sent Message is returned. Bots can currently send audio @@ -348,6 +355,8 @@ class Bot(TelegramObject): Performer of sent audio. [Optional] title: Title of sent audio. [Optional] + caption: + Audio caption [Optional] Keyword Args: disable_notification (Optional[bool]): Sends the message silently. @@ -381,6 +390,8 @@ class Bot(TelegramObject): data['performer'] = performer if title: data['title'] = title + if caption: + data['caption'] = caption return url, data @@ -531,7 +542,7 @@ class Bot(TelegramObject): @log @message - def sendVoice(self, chat_id, voice, duration=None, **kwargs): + def sendVoice(self, chat_id, voice, duration=None, caption=None, **kwargs): """Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be @@ -548,6 +559,8 @@ class Bot(TelegramObject): a new audio file using multipart/form-data. duration: Duration of sent audio in seconds. [Optional] + caption: + Voice caption [Optional] Keyword Args: disable_notification (Optional[bool]): Sends the message silently. @@ -577,6 +590,8 @@ class Bot(TelegramObject): if duration: data['duration'] = duration + if caption: + data['caption'] = caption return url, data @@ -1443,7 +1458,8 @@ class Bot(TelegramObject): return (self.__class__, (self.token, self.base_url.replace(self.token, ''), self.base_file_url.replace(self.token, ''))) - # snake_case (PEP8) aliases +# snake_case (PEP8) aliases + get_me = getMe send_message = sendMessage forward_message = forwardMessage diff --git a/telegram/chat.py b/telegram/chat.py index 94ade4994..695293a50 100644 --- a/telegram/chat.py +++ b/telegram/chat.py @@ -32,6 +32,7 @@ class Chat(TelegramObject): username (str): Username, for private chats and channels if available first_name (str): First name of the other party in a private chat last_name (str): Last name of the other party in a private chat + all_members_are_admins (bool): True if a group has ‘All Members Are Admins’ enabled. Args: id (int): @@ -57,6 +58,7 @@ class Chat(TelegramObject): self.username = kwargs.get('username', '') self.first_name = kwargs.get('first_name', '') self.last_name = kwargs.get('last_name', '') + self.all_members_are_admins = kwargs.get('all_members_are_admins', '') self.bot = bot diff --git a/telegram/inlinequeryresultaudio.py b/telegram/inlinequeryresultaudio.py index eabf551cb..706be8867 100644 --- a/telegram/inlinequeryresultaudio.py +++ b/telegram/inlinequeryresultaudio.py @@ -33,6 +33,7 @@ class InlineQueryResultAudio(InlineQueryResult): title (str): performer (Optional[str]): audio_duration (Optional[str]): + caption (Optional[str]): reply_markup (Optional[:class:`telegram.InlineKeyboardMarkup`]): input_message_content (Optional[ :class:`telegram.input_message_content`]): @@ -53,6 +54,7 @@ class InlineQueryResultAudio(InlineQueryResult): Keyword Args: performer (Optional[str]): audio_duration (Optional[str]): + caption (Optional[str]): reply_markup (Optional[:class:`telegram.InlineKeyboardMarkup`]): input_message_content (Optional[ :class:`telegram.input_message_content`]): @@ -64,6 +66,7 @@ class InlineQueryResultAudio(InlineQueryResult): title, performer=None, audio_duration=None, + caption=None, reply_markup=None, input_message_content=None, **kwargs): @@ -78,6 +81,8 @@ class InlineQueryResultAudio(InlineQueryResult): self.performer = performer if audio_duration: self.audio_duration = audio_duration + if caption: + self.caption = caption if reply_markup: self.reply_markup = reply_markup if input_message_content: diff --git a/telegram/inlinequeryresultcachedaudio.py b/telegram/inlinequeryresultcachedaudio.py index 44779ed71..a0951f9fb 100644 --- a/telegram/inlinequeryresultcachedaudio.py +++ b/telegram/inlinequeryresultcachedaudio.py @@ -31,6 +31,7 @@ class InlineQueryResultCachedAudio(InlineQueryResult): Attributes: id (str): audio_file_id (str): + caption (Optional[str]): reply_markup (Optional[:class:`telegram.InlineKeyboardMarkup`]): input_message_content (Optional[ :class:`telegram.input_message_content`]): @@ -48,17 +49,26 @@ class InlineQueryResultCachedAudio(InlineQueryResult): **kwargs: Arbitrary keyword arguments. Keyword Args: + caption (Optional[str]): reply_markup (Optional[:class:`telegram.InlineKeyboardMarkup`]): input_message_content (Optional[ :class:`telegram.input_message_content`]): """ - def __init__(self, id, audio_file_id, reply_markup=None, input_message_content=None, **kwargs): + def __init__(self, + id, + audio_file_id, + caption=None, + reply_markup=None, + input_message_content=None, + **kwargs): # Required super(InlineQueryResultCachedAudio, self).__init__('audio', id) self.audio_file_id = audio_file_id # Optionals + if caption: + self.caption = caption if reply_markup: self.reply_markup = reply_markup if input_message_content: diff --git a/telegram/inlinequeryresultcachedvoice.py b/telegram/inlinequeryresultcachedvoice.py index 927d51045..c6c10df93 100644 --- a/telegram/inlinequeryresultcachedvoice.py +++ b/telegram/inlinequeryresultcachedvoice.py @@ -28,7 +28,7 @@ class InlineQueryResultCachedVoice(InlineQueryResult): id, voice_file_id, title, - description=None, + caption=None, reply_markup=None, input_message_content=None, **kwargs): @@ -38,8 +38,8 @@ class InlineQueryResultCachedVoice(InlineQueryResult): self.title = title # Optionals - if description: - self.description = description + if caption: + self.caption = caption if reply_markup: self.reply_markup = reply_markup if input_message_content: diff --git a/telegram/inlinequeryresultvoice.py b/telegram/inlinequeryresultvoice.py index 04051ba98..a0973264b 100644 --- a/telegram/inlinequeryresultvoice.py +++ b/telegram/inlinequeryresultvoice.py @@ -29,6 +29,7 @@ class InlineQueryResultVoice(InlineQueryResult): voice_url, title, voice_duration=None, + caption=None, reply_markup=None, input_message_content=None, **kwargs): @@ -41,6 +42,8 @@ class InlineQueryResultVoice(InlineQueryResult): # Optional if voice_duration: self.voice_duration = voice_duration + if caption: + self.caption = caption if reply_markup: self.reply_markup = reply_markup if input_message_content: