예제 #1
0
def antispam(bot: Bot, update: Update, args: List[str]):
    chat = update.effective_chat  # type: Optional[Chat]
    if len(args) > 0:
        if args[0].lower() in ["on", "yes"]:
            sql.enable_antispam(chat.id)
            update.effective_message.reply_text(
                tld(
                    chat.id,
                    "I've enabled antispam security in this group. This will help protect you "
                    "from spammers, unsavoury characters, and the biggest trolls."
                ))
        elif args[0].lower() in ["off", "no"]:
            sql.disable_antispam(chat.id)
            update.effective_message.reply_text(
                tld(
                    chat.id,
                    "I've disabled antispam security in this group. GBans wont affect your users "
                    "anymore. You'll be less protected from any trolls and spammers "
                    "though!"))
    else:
        update.effective_message.reply_text(
            tld(
                chat.id,
                "Give me some arguments to choose a setting! on/off, yes/no!\n\n"
                "Your current setting is: {}\n"
                "When True, any gbans that happen will also happen in your group. "
                "When False, they won't, leaving you at the possible mercy of "
                "spammers.").format(sql.does_chat_gban(chat.id)))
예제 #2
0
def antispam(bot: Bot, update: Update, args: List[str]):
    chat = update.effective_chat  # type: Optional[Chat]
    if len(args) > 0:
        if args[0].lower() in ["on", "yes"]:
            sql.enable_antispam(chat.id)
            update.effective_message.reply_text(tld(chat.id, "antispam_enable"))
        elif args[0].lower() in ["off", "no"]:
            sql.disable_antispam(chat.id)
            update.effective_message.reply_text(tld(chat.id, "antispam_disable"))
    else:
        update.effective_message.reply_text(tld(chat.id, "antispam_info").format(sql.does_chat_gban(chat.id)))
예제 #3
0
def antispam(bot: Bot, update: Update, args: List[str]):
    chat = update.effective_chat
    if len(args) > 0:
        if args[0].lower() in ["on", "yes"]:
            sql.enable_antispam(chat.id)
            update.effective_message.reply_text(tld(chat.id, "antispam_on"))
        elif args[0].lower() in ["off", "no"]:
            sql.disable_antispam(chat.id)
            update.effective_message.reply_text(tld(chat.id, "antispam_off"))
    else:
        update.effective_message.reply_text(
            tld(chat.id,
                "antispam_err_wrong_arg").format(sql.does_chat_gban(chat.id)))