Ejemplo n.º 1
0
def nlp_mode(update, context):
    message = update.effective_message
    args = context.args

    if len(args) > 1:
        if args[1].lower() in ["on", "yes"]:
            sql.enable_nlp(message.chat.id)
            message.reply_text(
                    "I've enabled NLP moderation in this group. This will help protect you "
                    "from spammers, unsavoury characters, and the biggest trolls."
                )
        elif args[1].lower() in ["off", "no"]:
            sql.disable_nlp(message.chat.id)
            message.reply_text(
                    "I've disabled NLP moderation in this group. NLP wont affect your users "
                    "anymore. You'll be less protected from any trolls and spammers "
                    "though!"
                )
    else:
        message.reply_text(
                "Give me some arguments to choose a setting! on/off, yes/no!\n\n"
                "Your current setting is: {}\n"
                "When True, any messsages will go through NLP and spammers will be banned.\n"
                "When False, they won't, leaving you at the possible mercy of spammers\n"
                "NLP powered by @Intellivoid.".format(sql.does_chat_nlp(message.chat.id))
            )
Ejemplo n.º 2
0
async def nlp_mode(client, message):
    is_admin = await admin_check(message)
    args = message.text.split(None, 1)

    if is_admin == True:
        if len(args) > 1:
            if args[1].lower() in ["on", "yes"]:
                sql.enable_nlp(message.chat.id)
                await message.reply_text(
                    "I've enabled NLP moderation in this group. This will help protect you "
                    "from spammers, unsavoury characters, and the biggest trolls."
                )
            elif args[1].lower() in ["off", "no"]:
                sql.disable_nlp(message.chat.id)
                await message.reply_text(
                    "I've disabled NLP moderation in this group. NLP wont affect your users "
                    "anymore. You'll be less protected from any trolls and spammers "
                    "though!"
                )
        else:
            await message.reply_text(
                "Give me some arguments to choose a setting! on/off, yes/no!\n\n"
                "Your current setting is: {}\n"
                "When True, any messsages will go through NLP and spammers will be banned.\n"
                "When False, they won't, leaving you at the possible mercy of spammers\n"
                "NLP powered by @Intellivoid.".format(sql.does_chat_nlp(message.chat.id))
            )
    else:
        await message.reply_text("You aren't an admin.")