mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-01-10 20:12:52 +01:00
Refactoring InlineQueryResultAudio #232
This commit is contained in:
parent
1e0ee0694f
commit
c4074f740e
1 changed files with 23 additions and 8 deletions
|
@ -20,7 +20,8 @@
|
||||||
"""This module contains the classes that represent Telegram
|
"""This module contains the classes that represent Telegram
|
||||||
InlineQueryResultAudio"""
|
InlineQueryResultAudio"""
|
||||||
|
|
||||||
from telegram import InlineQueryResult
|
from telegram import InlineQueryResult, InlineKeyboardMarkup, \
|
||||||
|
InputMessageContent
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultAudio(InlineQueryResult):
|
class InlineQueryResultAudio(InlineQueryResult):
|
||||||
|
@ -38,10 +39,24 @@ class InlineQueryResultAudio(InlineQueryResult):
|
||||||
self.audio_url = audio_url
|
self.audio_url = audio_url
|
||||||
self.title = title
|
self.title = title
|
||||||
|
|
||||||
# Optional
|
# Optionals
|
||||||
|
if performer:
|
||||||
self.performer = performer
|
self.performer = performer
|
||||||
|
if audio_duration:
|
||||||
self.audio_duration = audio_duration
|
self.audio_duration = audio_duration
|
||||||
if reply_markup is not None:
|
if reply_markup:
|
||||||
self.reply_markup = 'ReplyMarkup' # TODO
|
self.reply_markup = reply_markup
|
||||||
if input_message_content is not None:
|
if input_message_content:
|
||||||
self.input_message_content = 'InputMessageContent'
|
self.input_message_content = input_message_content
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def de_json(data):
|
||||||
|
data = super(InlineQueryResultAudio,
|
||||||
|
InlineQueryResultAudio).de_json(data)
|
||||||
|
|
||||||
|
data['reply_markup'] = InlineKeyboardMarkup.de_json(
|
||||||
|
data.get('reply_markup'))
|
||||||
|
data['input_message_content'] = InputMessageContent.de_json(
|
||||||
|
data.get('input_message_content'))
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
Loading…
Reference in a new issue