Exemplo n.º 1
0
    def __build_handler_dicts(self):
        defaults = {
            'commands': None,
            'regexp': None,
            'func': None,
            'content_types': ['text']
        }
        handlers_info_list = [{
            'handler': self._subscribe,
            'commands': ['subscribe']
        }, {
            'handler': self._unsubscribe,
            'commands': ['unsubscribe']
        }]
        handler_dicts = []

        for h_info in handlers_info_list:
            handler_dicts.append(
                TeleBot._build_handler_dict(
                    h_info['handler'], **{
                        **defaults, 'commands': h_info['commands']
                    }))
        return handler_dicts
Exemplo n.º 2
0
 def register(self):
     self.bot.bot.add_message_handler(TeleBot._build_handler_dict(self.process, commands=self.cmd))