Пример #1
0
 def _handler(self, chat_filters: list, handler_function, bot: Bot,
              update: Update):
     if update.effective_user and update.effective_user.is_bot:
         return
     if not ChatType.is_valid(chat_filters, update):
         return
     with Context(update, bot) as context:
         if handler_function:
             handler_function(context)
Пример #2
0
    def _handler(self, handler_function, input_filters: list, update: Update,
                 callback_context: CallbackContext):
        if not Filter.apply(input_filters, update):
            return

        try:
            with Context(update, callback_context, self.db,
                         self.translations) as context:
                handler_function(context)
        except Exception as exc:
            ReportsSender.report_exception(self.db)
            raise exc
Пример #3
0
    def _handler(self, handler_function, input_filters: list, bot: Bot, update: Update):
        if not self._is_update_valid(input_filters, update):
            return

        try:
            with Context(update, bot, self.db, self.translations) as context:
                if context.group:
                    routing.update_group_memberships(context)
                handler_function(context)
        except Exception as exc:
            ReportsSender.report_exception(self.db)
            raise exc