Exemplo n.º 1
0
def __chat_settings__(bot, update, chat, chatP, user):
    chat_id = chat.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)
Exemplo n.º 2
0
def flood(bot: Bot, update: Update):
    chat = update.effective_chat  # type: Optional[Chat]

    limit = sql.get_flood_limit(chat.id)
    if limit == 0:
        update.effective_message.reply_text(tld(chat.id, "I'm not currently enforcing flood control!"))
    else:
        update.effective_message.reply_text(tld(chat.id,
            "I'm currently muting users if they send more than {} consecutive messages.").format(limit))
Exemplo n.º 3
0
def flood(bot: Bot, update: Update):
    chat = update.effective_chat

    limit = sql.get_flood_limit(chat.id)
    if limit == 0:
        update.effective_message.reply_text(tld(chat.id, "flood_status_off"))
    else:
        update.effective_message.reply_text(
            tld(chat.id, "flood_status_on").format(limit))
Exemplo n.º 4
0
def flood(update, context):
    chat = update.effective_chat
    user = update.effective_user

    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,
                tl(update.effective_message,
                   "Anda bisa lakukan command ini pada grup, bukan pada 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 = tl(
                update.effective_message,
                "Saat ini saya tidak memberlakukan pengendalian pesan beruntun pada *{}*!"
            ).format(chat_name)
        else:
            text = tl(
                update.effective_message,
                "Saat ini saya tidak memberlakukan pengendalian pesan beruntun"
            )
        send_message(update.effective_message, text, parse_mode="markdown")
    else:
        if conn:
            text = tl(
                update.effective_message,
                "Saat ini saya melarang pengguna jika mereka mengirim lebih dari *{}* pesan berturut-turut pada *{}*."
            ).format(limit, chat_name)
        else:
            text = tl(
                update.effective_message,
                "Saat ini saya melarang pengguna jika mereka mengirim lebih dari *{}* pesan berturut-turut."
            ).format(limit)
        send_message(update.effective_message, text, parse_mode="markdown")
Exemplo n.º 5
0
def __chat_settings__(chat_id, user_id):
    limit = sql.get_flood_limit(chat_id)
    if limit == 0:
        return tl(user_id, "*Not* currently enforcing flood control.")
    else:
        return tl(user_id, "Antiflood is set to `{}` messages.").format(limit)