From f8ec1447191cf2cf52d37b4acf9a29a34370d532 Mon Sep 17 00:00:00 2001 From: Davte Date: Thu, 18 Jul 2019 17:45:47 +0200 Subject: [PATCH] Prevent `AttributeError: 'NoneType' object has no attribute 'format'` --- davtelepot/__init__.py | 2 +- davtelepot/bot.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/davtelepot/__init__.py b/davtelepot/__init__.py index e10cf07..d6e8bc8 100644 --- a/davtelepot/__init__.py +++ b/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" diff --git a/davtelepot/bot.py b/davtelepot/bot.py index 7c35e07..173b07a 100644 --- a/davtelepot/bot.py +++ b/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):