Queer European MD passionate about IT
Просмотр исходного кода

When answering inline queries, prevent invalid InlineQueryResultsButton instantiation

Davte 1 год назад
Родитель
Сommit
eab81b065d
2 измененных файлов с 3 добавлено и 3 удалено
  1. 1 1
      davtelepot/__init__.py
  2. 2 2
      davtelepot/api.py

+ 1 - 1
davtelepot/__init__.py

@@ -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"
 

+ 2 - 2
davtelepot/api.py

@@ -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',