Exemplo n.º 1
0
def set_warn_limit(update: Update, context: CallbackContext) -> str:
    args = context.args
    chat: Optional[Chat] = update.effective_chat
    user: Optional[User] = update.effective_user
    msg: Optional[Message] = update.effective_message

    if args:
        if args[0].isdigit():
            if int(args[0]) < 3:
                msg.reply_text("The minimum warn limit is 3!")
            else:
                sql.set_warn_limit(chat.id, int(args[0]))
                msg.reply_text("Updated the warn limit to {}".format(args[0]))
                return (
                    f"<b>{html.escape(chat.title)}:</b>\n"
                    f"#SET_WARN_LIMIT\n"
                    f"<b>Admin:</b> {mention_html(user.id, user.first_name)}\n"
                    f"Set the warn limit to <code>{args[0]}</code>")
        else:
            msg.reply_text("Give me a number as an arg!")
    else:
        limit, soft_warn = sql.get_warn_setting(chat.id)

        msg.reply_text("The current warn limit is {}".format(limit))
    return ""
Exemplo n.º 2
0
def set_warn_limit(update: Update, context: CallbackContext) -> str:
    args = context.args
    chat: Optional[Chat] = update.effective_chat
    user: Optional[User] = update.effective_user
    msg: Optional[Message] = update.effective_message

    if args:
        if args[0].isdigit():
            if int(args[0]) < 3:
                msg.reply_text("Minimum xəbərdarlıq limiti 3-dür!")
            else:
                sql.set_warn_limit(chat.id, int(args[0]))
                msg.reply_text("Yeni xəbərdarlıq limiti: {}".format(args[0]))
                return (
                    f"<b>{html.escape(chat.title)}:</b>\n"
                    f"#SET_WARN_LIMIT\n"
                    f"<b>Admin:</b> {mention_html(user.id, user.first_name)}\n"
                    f"Set the warn limit to <code>{args[0]}</code>")
        else:
            msg.reply_text("Mənə bir rəqəm ver!")
    else:
        limit, soft_warn = sql.get_warn_setting(chat.id)

        msg.reply_text("Hazırki xəbərdarlıq limiti {}".format(limit))
    return ""
Exemplo n.º 3
0
def set_warn_limit(update: Update, context: CallbackContext) -> str:
    args = context.args
    chat: Optional[Chat] = update.effective_chat
    user: Optional[User] = update.effective_user
    msg: Optional[Message] = update.effective_message

    if args:
        if args[0].isdigit():
            if int(args[0]) < 3:
                msg.reply_text("¡El límite mínimo de advertencia es 3!")
            else:
                sql.set_warn_limit(chat.id, int(args[0]))
                msg.reply_text("Se actualizó el límite de advertencia a {}".format(args[0]))
                return (
                    f"<b>{html.escape(chat.title)}:</b>\n"
                    f"#SET_WARN_LIMIT\n"
                    f"<b>Admin:</b> {mention_html(user.id, user.first_name)}\n"
                    f"Estableció el límite de advertencia en <code>{args[0]}</code>")
        else:
            msg.reply_text("¡Dame un número como argumento!")
    else:
        limit, soft_warn = sql.get_warn_setting(chat.id)

        msg.reply_text("El límite de advertencia actual es {}".format(limit))
    return ""
Exemplo n.º 4
0
def set_warn_limit(bot: Bot, update: Update, args: List[str]) -> str:
    chat: Optional[Chat] = update.effective_chat
    user: Optional[User] = update.effective_user
    msg: Optional[Message] = update.effective_message

    if args:
        if args[0].isdigit():
            if int(args[0]) < 3:
                msg.reply_text("Minimum uyarı limiti:3!")
            else:
                sql.set_warn_limit(chat.id, int(args[0]))
                msg.reply_text("Updated the warn limit to {}".format(args[0]))
                return (
                    f"<b>{html.escape(chat.title)}:</b>\n"
                    f"#SET_WARN_LIMIT\n"
                    f"<b>Admin:</b> {mention_html(user.id, user.first_name)}\n"
                    f"Uyarı sınırını <code>{args[0]}</code>")
        else:
            msg.reply_text("Arg olarak bana bir numara ver!")
    else:
        limit, soft_warn = sql.get_warn_setting(chat.id)

        msg.reply_text("Geçerli uyarı limiti {}".format(limit))
    return ""