mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-12-23 06:50:29 +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
|
||||
InlineQueryResultAudio"""
|
||||
|
||||
from telegram import InlineQueryResult
|
||||
from telegram import InlineQueryResult, InlineKeyboardMarkup, \
|
||||
InputMessageContent
|
||||
|
||||
|
||||
class InlineQueryResultAudio(InlineQueryResult):
|
||||
|
@ -38,10 +39,24 @@ class InlineQueryResultAudio(InlineQueryResult):
|
|||
self.audio_url = audio_url
|
||||
self.title = title
|
||||
|
||||
# Optional
|
||||
self.performer = performer
|
||||
self.audio_duration = audio_duration
|
||||
if reply_markup is not None:
|
||||
self.reply_markup = 'ReplyMarkup' # TODO
|
||||
if input_message_content is not None:
|
||||
self.input_message_content = 'InputMessageContent'
|
||||
# Optionals
|
||||
if performer:
|
||||
self.performer = performer
|
||||
if audio_duration:
|
||||
self.audio_duration = audio_duration
|
||||
if reply_markup:
|
||||
self.reply_markup = reply_markup
|
||||
if input_message_content:
|
||||
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