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

This commit is contained in:
Davte 2019-07-18 17:45:47 +02:00
parent 948ebcd015
commit f8ec144719
2 changed files with 4 additions and 2 deletions

View File

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

View File

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