예제 #1
0
def set_warn_limit(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    msg = update.effective_message  # type: Optional[Message]

    if args:
        if args[0].isdigit():
            if int(args[0]) < 3:
                msg.reply_text("Minimum limit 3!")
            else:
                sql.set_warn_limit(chat.id, int(args[0]))
                msg.reply_text("Uyarı limiti şu şekilde güncellendi {}".format(
                    args[0]))
                return "<b>{}:</b>" \
                       "\n#UYARI_LIMITI" \
                       "\n<b>Admin:</b> {}" \
                       "\nUyarı limiti: <code>{}</code>".format(html.escape(chat.title),
                                                                        mention_html(user.id, user.first_name), args[0])
        else:
            msg.reply_text("Bana bir sayı veya argüman ver!")
    else:
        limit, soft_warn = sql.get_warn_setting(chat.id)

        msg.reply_text("Mevcut uyarı limiti {}".format(limit))
    return ""
예제 #2
0
def set_warn_limit(update: Update, context: CallbackContext) -> str:
    args = context.args
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    msg = update.effective_message  # type: Optional[Message]

    if args:
        if args[0].isdigit():
            if int(args[0]) < 3:
                msg.reply_text("최소 경고 한도는 3 이에요!")
            else:
                sql.set_warn_limit(chat.id, int(args[0]))
                msg.reply_text("Updated the warn limit to {}".format(args[0]))
                return "<b>{}:</b>" \
                       "\n#경고_한계_설정" \
                       "\n<b>관리자:</b> {}" \
                       "\n경고 한계가 다음과 같이 설정되었습니다 : <code>{}</code>".format(html.escape(chat.title),
                                                                        mention_html(user.id, user.first_name), args[0])
        else:
            msg.reply_text("경고 한계 숫자를 입력해 주세요!")
    else:
        limit, soft_warn = sql.get_warn_setting(chat.id)

        msg.reply_text("현재 경고 한계는 {}회 입니다.".format(limit))
    return ""
예제 #3
0
def set_warn_limit(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    msg = update.effective_message  # type: Optional[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("Uyarı sınırı {} olarak güncellendi".format(
                    args[0]))
                return "<b>{}:</b>" \
                       "\n#SET_WARN_LIMIT" \
                       "\n<b>Admin:</b> {}" \
                       "\nSet the warn limit to <code>{}</code>".format(html.escape(chat.title),
                                                                        mention_html(user.id, user.first_name), args[0])
        else:
            msg.reply_text(" bana bir numara ver!")
    else:
        limit, soft_warn = sql.get_warn_setting(chat.id)

        msg.reply_text("Geçerli uyarı sınırı {}".format(limit))
    return ""
예제 #4
0
def set_warn_limit(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    msg = update.effective_message  # type: Optional[Message]

    if args:
        if args[0].isdigit():
            if int(args[0]) < 3:
                msg.reply_text("کەمترین سنوور بریتییە لە 3!")
            else:
                sql.set_warn_limit(chat.id, int(args[0]))
                msg.reply_text("سنووری ئاگادارکردنەوە کرا بە {}".format(
                    args[0]))
                return "<b>{}:</b>" \
                       "\n#SET_WARN_LIMIT" \
                       "\n<b>Admin:</b> {}" \
                       "\nSet the warn limit to <code>{}</code>".format(html.escape(chat.title),
                                                                        mention_html(user.id, user.first_name), args[0])
        else:
            msg.reply_text("ژمارەیەکم پێ بدە وەک پێدراو!")
    else:
        limit, soft_warn = sql.get_warn_setting(chat.id)

        msg.reply_text(
            "سنووری ئاگادارکردنەوەی ئێستا بریتییە لە {}".format(limit))
    return ""
예제 #5
0
파일: warns.py 프로젝트: zjunior06/modules
def set_warn_limit(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    msg = update.effective_message  # type: Optional[Message]

    if args:
        if args[0].isdigit():
            if int(args[0]) < 3:
                msg.reply_text("O limite mínimo de warns é 3!")
            else:
                sql.set_warn_limit(chat.id, int(args[0]))
                msg.reply_text("Atualizei o limite de warns para {}".format(
                    args[0]))
                return "<b>{}:</b>" \
                       "\n#SET_WARN_LIMIT" \
                       "\n<b>Admin:</b> {}" \
                       "\nDefiniu o limite de warn para <code>{}</code>".format(html.escape(chat.title),
                                                                        mention_html(user.id, user.first_name), args[0])
        else:
            msg.reply_text("Me dê um número como argumento!")
    else:
        limit, soft_warn = sql.get_warn_setting(chat.id)

        msg.reply_text("O limite atual de warns é {}".format(limit))
    return ""
예제 #6
0
def set_warn_limit(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    msg = update.effective_message  # type: Optional[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 "{}:" \
                       "\n#SET_WARN\_LIMIT" \
                       "\n*Admin:* [{}](tg://user?id={})" \
                       "\nSet the warn limit to `{}`".format(escape_markdown(chat.title),
                                                             escape_markdown(user.first_name),
                                                             user.id, args[0])
        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 ""
예제 #7
0
def set_warn_limit(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    msg = update.effective_message  # type: Optional[Message]

    if args:
        if args[0].isdigit():
            if int(args[0]) < 3:
                msg.reply_text(" کمترین مقدار برای اخطار قبل از اخراج 3!")
            else:
                sql.set_warn_limit(chat.id, int(args[0]))
                msg.reply_text("تعداد اخطار ها به {} تنظیم شد!".format(
                    args[0]))
                return "<b>{}:</b>" \
                       "\n#تنظیم_حداخطار" \
                       "\n<b>توسط:</b> {}" \
                       "\nبه تعداد <code>{}</code> اخطار تغییر کرد".format(html.escape(chat.title),
                                                                        mention_html(user.id, user.first_name), args[0])
        else:
            msg.reply_text("یه عدد انگلیسی بهم بده !")
    else:
        limit, soft_warn = sql.get_warn_setting(chat.id)

        msg.reply_text("درحال حاظر حداخطار {} هست".format(limit))
    return ""
예제 #8
0
def set_warn_limit(update: Update, context: CallbackContext) -> str:
    args = context.args
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    msg = update.effective_message  # type: Optional[Message]

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

        msg.reply_text("The current warn limit is {}".format(
            limit))  # MSG_CURRENT_SETTINGS
    return ""
예제 #9
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 ""
예제 #10
0
def set_warn_limit(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    msg = update.effective_message  # type: Optional[Message]

    if args:
        if args[0].isdigit():
            if int(args[0]) < 3:
                msg.reply_text("අවම අනතුරු ඇඟවීමේ සීමාව 3 යි!")
            else:
                sql.set_warn_limit(chat.id, int(args[0]))
                msg.reply_text(
                    "අනතුරු ඇඟවීමේ සීමාව යාවත්කාලීන කරන ලදි {}".format(
                        args[0]))
                return "<b>{}:</b>" \
                       "\n#SET_WARN_LIMIT" \
                       "\n<b>Admin:</b> {}" \
                       "\nඅනතුරු ඇඟවීමේ සීමාව සකසන්න <code>{}</code>".format(html.escape(chat.title),
                                                                        mention_html(user.id, user.first_name), args[0])
        else:
            msg.reply_text("මට අංකයක් අංකයක් දෙන්න!")
    else:
        limit, soft_warn = sql.get_warn_setting(chat.id)

        msg.reply_text("The current warn limit is {}".format(limit))
    return ""
예제 #11
0
파일: warns.py 프로젝트: v15hv4/kaizoe_bot
def set_warn_limit(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    msg = update.effective_message  # type: Optional[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 ("<b>{}:</b>"
                        "\n#SET_WARN_LIMIT"
                        "\n<b>Admin:</b> {}"
                        "\nSet the warn limit to <code>{}</code>".format(
                            html.escape(chat.title),
                            mention_html(user.id, user.first_name), args[0]))
        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 ""
예제 #12
0
def set_warn_limit(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    msg = update.effective_message  # type: Optional[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 təyin olundu. Yeni limit --> {}".
                    format(args[0]))
                return "<b>{}:</b>" \
                       "\n#SET_WARN_LIMIT" \
                       "\n<b>Admin:</b> {}" \
                       "\nSet the warn limit to <code>{}</code>".format(html.escape(chat.title),
                                                                        mention_html(user.id, user.first_name), args[0])
        else:
            msg.reply_text("Mənə bir rəqəm verməlisən!")
    else:
        limit, soft_warn = sql.get_warn_setting(chat.id)

        msg.reply_text("Hazırki xəbərdarlıq limiti --> {}".format(limit))
    return ""
예제 #13
0
def set_warn_limit(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    msg = update.effective_message  # type: Optional[Message]

    if args:
        if args[0].isdigit():
            if int(args[0]) < 3:
                msg.reply_text("Il limite di ammonimenti minimo è 3!")
            else:
                sql.set_warn_limit(chat.id, int(args[0]))
                msg.reply_text(
                    "Aggiornato il limite di ammonimenti a {}".format(args[0])
                )
                return (
                    "<b>{}:</b>"
                    "\n#SET_WARN_LIMIT"
                    "\n<b>Admin:</b> {}"
                    "\nImpostato il limite di ammonimenti a <code>{}</code>".format(
                        html.escape(chat.title),
                        mention_html(user.id, user.first_name),
                        args[0],
                    )
                )
        else:
            msg.reply_text("Dammi un numero come argomento!")
    else:
        limit, soft_warn = sql.get_warn_setting(chat.id)

        msg.reply_text("Il limite di ammonimenti attuale è {}".format(limit))
    return ""
예제 #14
0
def set_warn_limit(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    message = update.effective_message  # type: Optional[Message]

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

        message.reply_text(f"The current warn limit is {limit}")
    return ""
예제 #15
0
def set_warn_limit(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    msg = update.effective_message  # type: Optional[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("Limit SP diubah ke {}".format(args[0]))
                return "\n#SET_SP_LIMIT" \
                       "\n<b>• Admin:</b> {} [<code>{}</code>]" \
                       "\n<b>• Grup:</b> {} [<code>{}</code>]" \
                       "\n<b>• Limit SP diubah ke:</b> <code>{}</code>".format(mention_html(user.id, user.first_name), user.id, 
                                                                               chat.title, chat.id, args[0])
        else:
            msg.reply_text("Give me a number as an arg!")
    else:
        limit, soft_warn = sql.get_warn_setting(chat.id)

        msg.reply_text("Limit SP = {}".format(limit))
    return ""
예제 #16
0
def set_warn_limit(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    msg = update.effective_message  # type: Optional[Message]

    if args:
        if args[0].isdigit():
            if int(args[0]) < 3:
                msg.reply_text("Minimalny limit otrzeżeń wynosi 3!")
            else:
                sql.set_warn_limit(chat.id, int(args[0]))
                msg.reply_text("Ustawiono limit otrzeżeń do {}".format(args[0]))
                return "<b>{}:</b>" \
                       "\n#USTAWIONO_LIMIT_OTRZEŻEŃ" \
                       "\n<b>Administrator:</b> {}" \
                       "\nUstawiono limit ostrzeżeń do <code>{}</code>".format(html.escape(chat.title),
                                                                        mention_html(user.id, user.first_name), args[0])
        else:
            msg.reply_text("Daj mi numer jako argument!")
    else:
        limit, soft_warn = sql.get_warn_setting(chat.id)

        msg.reply_text("Obecny limit ostrzeżeń wynosi {}".format(limit))
    return ""
예제 #17
0
def set_warn_limit(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    msg = update.effective_message  # type: Optional[Message]

    if args:
        if args[0].isdigit():
            if int(args[0]) < 3:
                msg.reply_text("الحد الأدنى لارن الحد هو 3!")
            else:
                sql.set_warn_limit(chat.id, int(args[0]))
                msg.reply_text("تحديث حد التحذير ل {}".format(args[0]))
                return "<b>{}:</b>" \
                       "\n#SET_WARN_LIMIT" \
                       "\n<b>Admin:</b> {}" \
                       "\nSet the warn limit to <code>{}</code>".format(html.escape(chat.title),
                                                                        mention_html(user.id, user.first_name), args[0])
        else:
            msg.reply_text("أعطني عددا كما arg!")
    else:
        limit, soft_warn = sql.get_warn_setting(chat.id)

        msg.reply_text("حد التحذير الحالي هو {}".format(limit))
    return ""
예제 #18
0
def set_warn_limit(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    msg = update.effective_message  # type: Optional[Message]

    if args:
        if args[0].isdigit():
            if int(args[0]) < 3:
                msg.reply_text("Minimim xəbərdarlıq limiti 3!")
            else:
                sql.set_warn_limit(chat.id, int(args[0]))
                msg.reply_text("Xəbərdarlıq limiti yeniləndi. Xəbərdarlıq limiti: {}".format(args[0]))
                return "<b>{}:</b>" \
                       "\n#SET_WARN_LIMIT" \
                       "\n<b>Admin:</b> {}" \
                       "\nSet the warn limit to <code>{}</code>".format(html.escape(chat.title),
                                                                        mention_html(user.id, user.first_name), args[0])
        else:
            msg.reply_text("Rəqəm qeyd et!")
    else:
        limit, soft_warn = sql.get_warn_setting(chat.id)

        msg.reply_text("Cari xəbərdarlıq limiti: {}".format(limit))
    return ""
예제 #19
0
def set_warn_limit(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat
    user = update.effective_user
    msg = update.effective_message

    if args:
        if args[0].isdigit():
            if int(args[0]) < 1:
                msg.reply_text(tld(chat.id, 'warns_warnlimit_min_1'))
            else:
                sql.set_warn_limit(chat.id, int(args[0]))
                msg.reply_text(
                    tld(chat.id,
                        'warns_warnlimit_updated_success').format(args[0]))
                return tld(chat.id, 'warns_set_warn_limit_log_channel').format(
                    html.escape(chat.title),
                    mention_html(user.id, user.first_name), args[0])
        else:
            msg.reply_text(tld(chat.id, 'warns_warnlimit_invalid_arg'))
    else:
        limit, soft_warn = sql.get_warn_setting(chat.id)

        msg.reply_text(tld(chat.id, 'warns_warnlimit_current').format(limit))
    return ""
예제 #20
0
def set_warn_limit(bot: Bot, update: Update, args: List[str]) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    msg = update.effective_message  # type: Optional[Message]

    if args:
        if args[0].isdigit():
            if int(args[0]) < 3:
                msg.reply_text("ഏറ്റവും കുറഞ്ഞ താക്കീതിന്റെ സംഖ്യ 3 ആണ് !")
            else:
                sql.set_warn_limit(chat.id, int(args[0]))
                msg.reply_text("താക്കീതുകളുടെ പരമാവധി  {} ആക്കിയിരിക്കുന്നു ".format(args[0]))
                return "<b>{}:</b>" \
                       "\n#SET_WARN_LIMIT" \
                       "\n<b>Admin:</b> {}" \
                       "\nSet the warn limit to <code>{}</code>".format(html.escape(chat.title),
                                                                        mention_html(user.id, user.first_name), args[0])
        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 ""
예제 #21
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("Batas peringatan minimum adalah 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"Setel batas peringatan ke <code>{args[0]}</code>")
        else:
            msg.reply_text("Beri saya nomor sebagai argumen!")
    else:
        limit, soft_warn = sql.get_warn_setting(chat.id)

        msg.reply_text("Batas peringatan saat ini adalah {}".format(limit))
    return ""