Skip to content

Commit 597fd55

Browse files
committed
Avoid the error if the developer replaces a native update processor
Custom update processor for updates like callback_query and inline_query were popular before botogram added support for them natively. This commit avoids crashing those bots after an upgrade, showing a warning instead of an exception.
1 parent a5b48f5 commit 597fd55

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

botogram/bot.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,10 @@ def run(self, workers=2):
252252
def register_update_processor(self, kind, processor):
253253
"""Register a new update processor"""
254254
if kind in self._update_processors:
255-
raise NameError("An update processor for \"%s\" updates is "
256-
"already registered" % kind)
255+
self.logger.warn("Your code replaced the default update processor "
256+
"for '%s'!" % kind)
257+
self.logger.warn("If you want botogram to handle those updates "
258+
"natively remove your processor.")
257259

258260
self._update_processors[kind] = processor
259261

0 commit comments

Comments
 (0)