예제 #1
0
def check_and_ban(update, user_id, should_message=True):
    chat = update.effective_chat
    message = update.effective_message
    try:
        if sw is not None:
            sw_ban = sw.get_ban(user_id)
            if sw_ban:
                spamwatch_reason = sw_ban.reason
                chat.kick_member(user_id)
                if should_message:
                    message.reply_text(tld(
                        chat.id,
                        "antispam_spamwatch_banned").format(spamwatch_reason),
                                       parse_mode=ParseMode.HTML)
                    return
                else:
                    return
    except Exception:
        pass

    if sql.is_user_gbanned(user_id):
        chat.kick_member(user_id)
        if should_message:
            userr = sql.get_gbanned_user(user_id)
            usrreason = userr.reason
            if not usrreason:
                usrreason = tld(chat.id, "antispam_no_reason")

            message.reply_text(tld(
                chat.id, "antispam_checkban_user_removed").format(usrreason),
                               parse_mode=ParseMode.MARKDOWN)
            return
예제 #2
0
def check_and_ban(update, user_id, should_message=True):
    if sql.is_user_gbanned(user_id):
        update.effective_chat.kick_member(user_id)
        if should_message:
            userr = sql.get_gbanned_user(user_id)
            usrreason = userr.reason
            if not usrreason:
                usrreason = "No reason given"

            update.effective_message.reply_text(
                f"*This user is gbanned and has been removed.*\nReason: `{usrreason}`",
                parse_mode=ParseMode.MARKDOWN)
예제 #3
0
def __user_info__(user_id, chat_id):
    is_gbanned = sql.is_user_gbanned(user_id)

    if not user_id in SUDO_USERS:

        text = tld(chat_id, "antispam_userinfo_gbanned")
        if is_gbanned:
            text = text.format(tld(chat_id, "common_yes"))
            text += tld(chat_id, "anitspam_appeal")
            user = sql.get_gbanned_user(user_id)
            if user.reason:
                text += tld(chat_id, "antispam_userinfo_gban_reason").format(
                    html.escape(user.reason))
        else:
            text = text.format(tld(chat_id, "common_no"))

        return text
    else:
        return ""
예제 #4
0
def __user_info__(user_id, chat_id):
    is_gbanned = sql.is_user_gbanned(user_id)
    is_gmuted = sql.is_user_gmuted(user_id)

    if not user_id in SUDO_USERS:

        text = tld(chat_id, "Globally banned: <b>{}</b>")
        if is_gbanned:
            text = text.format(tld(chat_id, "Yes"))
            user = sql.get_gbanned_user(user_id)
            if user.reason:
                text += tld(chat_id,
                            "\nReason: {}").format(html.escape(user.reason))
        else:
            text = text.format(tld(chat_id, "No"))

        return text
    else:
        return ""