Пример #1
0
def rest_handler(bot: Bot, update: Update):
    msg = update.effective_message  # type: Optional[Message]
    chat = update.effective_chat  # type: Optional[Chat]
    for restriction, filter in RESTRICTION_TYPES.items():
        if filter(msg) and sql.is_restr_locked(chat.id, restriction) and can_delete(chat, bot.id):
            try:
                msg.delete()
            except BadRequest as excp:
                if excp.message == "Message to delete not found":
                    pass
                else:
                    LOGGER.exception("ERROR in restrictions")
            break
Пример #2
0
 def check_update(self, update):
     return super().check_update(update) and not (
         sql.is_restr_locked(update.effective_chat.id, 'messages') and
         not is_user_admin(update.effective_chat, update.effective_user.id))