When answering inline queries, prevent invalid InlineQueryResultsButton instantiation

This commit is contained in:
Davte 2023-08-07 20:19:09 +02:00
parent 51a77c695b
commit eab81b065d
Signed by: Davte
GPG Key ID: 70336F92E6814706
2 changed files with 3 additions and 3 deletions

View File

@ -11,7 +11,7 @@ __author__ = "Davide Testa"
__email__ = "davide@davte.it"
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
__license__ = "GNU General Public License v3.0"
__version__ = "2.9.3"
__version__ = "2.9.4"
__maintainer__ = "Davide Testa"
__contact__ = "t.me/davte"

View File

@ -1768,9 +1768,9 @@ class TelegramBot:
No more than 50 results per query are allowed.
See https://core.telegram.org/bots/api#answerinlinequery for details.
"""
if 'switch_pm_text' in kwargs:
if 'switch_pm_text' in kwargs and kwargs['switch_pm_text']:
button = InlineQueryResultsButton(text=kwargs['switch_pm_text'])
if 'switch_pm_parameter' in kwargs:
if 'switch_pm_parameter' in kwargs and kwargs['switch_pm_parameter']:
button = InlineQueryResultsButton(start_parameter=kwargs['switch_pm_parameter'])
return await self.api_request(
'answerInlineQuery',