Esempio n. 1
0
def flood(_bot: Bot, update: Update):
    chat = update.effective_chat
    update_chat_title = chat.title
    message_chat_title = update.effective_message.chat.title

    if update_chat_title == message_chat_title:
        chat_name = ""
    else:
        chat_name = f" in <b>{update_chat_title}</b>"

    limit = sql.get_flood_limit(chat.id)

    if limit == 0:
        update.effective_message.reply_text(
            f"I'm not currently enforcing flood control{chat_name}!",
            parse_mode=ParseMode.HTML)
    else:
        update.effective_message.reply_text(
            f"I'm currently punching users if they send "
            f"more than {limit} consecutive messages{chat_name}.",
            parse_mode=ParseMode.HTML)
Esempio n. 2
0
def __chat_settings__(chat_id, _user_id):
    limit = sql.get_flood_limit(chat_id)
    if limit == 0:
        return "*Not* currently enforcing flood control."
    else:
        return "Antiflood is set to `{}` messages.".format(limit)