mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-03-16 12:25:45 +01:00
Adding InlineQueryResultCachedAudio #232
This commit is contained in:
parent
85f1b1af0c
commit
624160e1db
2 changed files with 29 additions and 13 deletions
|
@ -45,14 +45,4 @@ class InlineQueryResult(TelegramObject):
|
|||
|
||||
@staticmethod
|
||||
def de_json(data):
|
||||
"""
|
||||
Args:
|
||||
data (dict):
|
||||
|
||||
Returns:
|
||||
telegram.InlineQueryResult:
|
||||
"""
|
||||
if not data:
|
||||
return None
|
||||
|
||||
return InlineQueryResult(**data)
|
||||
return super(InlineQueryResult, InlineQueryResult).de_json(data)
|
||||
|
|
|
@ -20,8 +20,34 @@
|
|||
"""This module contains the classes that represent Telegram
|
||||
InlineQueryResultCachedAudio"""
|
||||
|
||||
from telegram import InlineQueryResult
|
||||
from telegram import InlineQueryResult, InlineKeyboardMarkup, \
|
||||
InputMessageContent
|
||||
|
||||
|
||||
class InlineQueryResultCachedAudio(InlineQueryResult):
|
||||
pass
|
||||
def __init__(self,
|
||||
id,
|
||||
audio_file_id,
|
||||
reply_markup=None,
|
||||
input_message_content=None):
|
||||
# Required
|
||||
super(InlineQueryResultCachedAudio, self).__init__('audio', id)
|
||||
self.audio_file_id = audio_file_id
|
||||
|
||||
# Optionals
|
||||
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(InlineQueryResultCachedAudio,
|
||||
InlineQueryResultCachedAudio).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…
Add table
Reference in a new issue