Queer European MD passionate about IT
Browse Source

Prevent `AttributeError: 'NoneType' object has no attribute 'format'`

Davte 4 years ago
parent
commit
f8ec144719
2 changed files with 4 additions and 2 deletions
  1. 1 1
      davtelepot/__init__.py
  2. 3 1
      davtelepot/bot.py

+ 1 - 1
davtelepot/__init__.py

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

+ 3 - 1
davtelepot/bot.py

@@ -369,7 +369,9 @@ class Bot(TelegramBot, ObjectWithDatabase):
             message = self._unknown_command_message
         else:
             message = self.__class__._unknown_command_message
-        return message.format(bot=self)
+        if message is not None:
+            message = message.format(bot=self)
+        return message
 
     @property
     def callback_data_separator(self):