Queer European MD passionate about IT
Explorar o código

When answering inline queries, prevent invalid InlineQueryResultsButton instantiation

Davte hai 1 ano
pai
achega
eab81b065d
Modificáronse 2 ficheiros con 3 adicións e 3 borrados
  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',