Skip to content

Instantly share code, notes, and snippets.

@eternnoir
Last active February 8, 2022 00:11
Show Gist options
  • Save eternnoir/c147e5bb1496f83ad59db7f10372b290 to your computer and use it in GitHub Desktop.
Save eternnoir/c147e5bb1496f83ad59db7f10372b290 to your computer and use it in GitHub Desktop.
def _notify_command_handlers(self, handlers, new_messages):
for message in new_messages:
# if message has next step handler, dont exec command handlers
if (isinstance(message, types.CallbackQuery)) or \
(isinstance(message, types.Message) and (message.chat.id not in self.message_subscribers_next_step)):
for message_handler in handlers:
if self._test_message_handler(message_handler, message):
self._exec_task(message_handler['function'], message)
break
def _notify_command_handlers(self, handlers, new_messages):
for message in new_messages:
# if message has next step handler, dont exec command handlers
if hasattr(message, chat) and message.chat and (message.chat.id not in self.message_subscribers_next_step):
for message_handler in handlers:
if self._test_message_handler(message_handler, message):
self._exec_task(message_handler['function'], message)
break
@eternnoir
Copy link
Author

    def _notify_command_handlers(self, handlers, new_messages):
        for message in new_messages:
            # if message has next step handler, dont exec command handlers
            if hasattr(message, 'chat') and message.chat and (message.chat.id in self.message_subscribers_next_step):
                continue
            for message_handler in handlers:
                if self._test_message_handler(message_handler, message):
                    self._exec_task(message_handler['function'], message)
                    break

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment