Exemple #1
0
def flood(update, context):
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    msg = update.effective_message

    conn = connected(context.bot, update, chat, user.id, need_admin=False)
    if conn:
        chat_id = conn
        chat_name = dispatcher.bot.getChat(conn).title
    else:
        if update.effective_message.chat.type == "private":
            send_message(update.effective_message,
                         "Əmri qrupda istifadə edin")
            return
        chat_id = update.effective_chat.id
        chat_name = update.effective_message.chat.title

    limit = sql.get_flood_limit(chat_id)
    if limit == 0:
        if conn:
            text = msg.reply_text(
                "{} qrupunda flood-a nəzarət etmirəm!".format(chat_name))
        else:
            text = msg.reply_text("Burada flood-a nəzarət etmirəm!")
    else:
        if conn:
            text = msg.reply_text(
                "{} qrupunda tez-tez {} mesaj yazanlara qarşı tədbir görürəm."
                .format(chat_name, limit))
        else:
            text = msg.reply_text(
                "Tez-tez {} mesaj yazanlara qarşı tədbir görürəm."
                .format(limit))
Exemple #2
0
def flood(update, context):
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    msg = update.effective_message

    conn = connected(context.bot, update, chat, user.id, need_admin=False)
    if conn:
        chat_id = conn
        chat_name = dispatcher.bot.getChat(conn).title
    else:
        if update.effective_message.chat.type == "private":
            send_message(update.effective_message,
                         "This command is meant to use in group not in PM")
            return
        chat_id = update.effective_chat.id
        chat_name = update.effective_message.chat.title

    limit = sql.get_flood_limit(chat_id)
    if limit == 0:
        if conn:
            text = msg.reply_text(
                "I'm not enforcing any flood control in {}!".format(chat_name))
        else:
            text = msg.reply_text("I'm not enforcing any flood control here!")
    else:
        if conn:
            text = msg.reply_text(
                "I'm currently restricting members after {} consecutive messages in {}."
                .format(limit, chat_name))
        else:
            text = msg.reply_text(
                "I'm currently restricting members after {} consecutive messages."
                .format(limit))
Exemple #3
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 muting users if they send "
            f"more than {limit} consecutive messages{chat_name}.",
            parse_mode=ParseMode.HTML)
Exemple #4
0
def flood(update, context):
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    msg = update.effective_message

    conn = connected(context.bot, update, chat, user.id, need_admin=False)
    if conn:
        chat_id = conn
        chat_name = dispatcher.bot.getChat(conn).title
    else:
        if update.effective_message.chat.type == "private":
            send_message(
                update.effective_message,
                "Lệnh này được sử dụng trong nhóm không dùng trong PM",
            )
            return
        chat_id = update.effective_chat.id
        chat_name = update.effective_message.chat.title

    limit = sql.get_flood_limit(chat_id)
    if limit == 0:
        if conn:
            text = msg.reply_text(
                "Mình không thực thi bất kỳ biện pháp antiflood nào ở {}!".
                format(chat_name), )
        else:
            text = msg.reply_text(
                "Tôi không thực thi bất kỳ antiflood nào ở đây!")
    else:
        if conn:
            text = msg.reply_text(
                "Mình hiện đang giới hạn thành viên sau {} tin nhắn liên tiếp trong {}."
                .format(
                    limit,
                    chat_name,
                ), )
        else:
            text = msg.reply_text(
                "Mình hiện đang giới hạn thành viên sau {} tin nhắn liên tiếp."
                .format(limit, ), )
Exemple #5
0
def __chat_settings__(chat_id, user_id):
    limit = sql.get_flood_limit(chat_id)
    if limit == 0:
        return "Not enforcing to flood control."
    return "Antiflood has been set to`{}`.".format(limit)
Exemple #6
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)
Exemple #7
0
def __chat_settings__(chat_id, user_id):
    limit = sql.get_flood_limit(chat_id)
    if limit == 0:
        return "Không thực thi để kiểm soát flood."
    else:
        return "Antiflood đã được đặt thành`{}`.".format(limit)
Exemple #8
0
def __chat_settings__(chat_id, user_id):
    limit = sql.get_flood_limit(chat_id)
    if limit == 0:
        return "Flood-a nəzarət etmirəm."
    else:
        return "Yeni antiflood limiti -->`{}`.".format(limit)