Esempio n. 1
0
def rest_handler(bot: Bot, update: Update):
    msg = update.effective_message
    chat = update.effective_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":
                    LOGGER.exception("ERROR in restrictions")
            break
Esempio n. 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))