mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Set default parse_mode in InlineQueryResults if this parameter is present
This commit is contained in:
parent
3213310197
commit
2206b0ab11
1 changed files with 11 additions and 0 deletions
|
|
@ -17,6 +17,17 @@ class InlineQueryResult(base.TelegramObject):
|
|||
id: base.String = fields.Field()
|
||||
reply_markup: InlineKeyboardMarkup = fields.Field(base=InlineKeyboardMarkup)
|
||||
|
||||
def safe_get_parse_mode(self):
|
||||
try:
|
||||
return self.bot.parse_mode
|
||||
except RuntimeError:
|
||||
pass
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
if 'parse_mode' in kwargs and kwargs['parse_mode'] is None:
|
||||
kwargs['parse_mode'] = self.safe_get_parse_mode()
|
||||
super(InlineQueryResult, self).__init__(**kwargs)
|
||||
|
||||
|
||||
class InlineQueryResultArticle(InlineQueryResult):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue