コード例 #1
0
def setDefense(bot: Bot, update: Update, args: List[str]):
    chat = update.effective_chat
    msg = update.effective_message
    if len(args)!=1:
        msg.reply_text("Invalid arguments!")
        return
    param = args[0]
    if param == "on" or param == "true":
        sql.setDefenseStatus(chat.id, True)
        msg.reply_text("Defense mode has been turned on, this group is under attack. Every user that now joins will be auto kicked.")
        return
    elif param == "off" or param == "false":
        sql.setDefenseStatus(chat.id, False)
        msg.reply_text("Defense mode has been turned off, group is no longer under attack.")
        return
    else:
        msg.reply_text("Invalid status to set!") #on or off ffs
        return 
コード例 #2
0
ファイル: welcome.py プロジェクト: FiestaLake/tgbot
def setDefense(update: Update, context: CallbackContext):
    bot = context.bot
    args = context.args
    chat = update.effective_chat
    msg = update.effective_message
    if len(args) != 1:
        msg.reply_text("Invalid arguments!")
        return
    param = args[0]
    if param in ("on", "true"):
        sql.setDefenseStatus(chat.id, True)
        msg.reply_text(
            "Defense mode has been turned on, this group is under attack. Every user that now joins will be auto kicked."
        )
        return
    if param in ("off", "false"):
        sql.setDefenseStatus(chat.id, False)
        msg.reply_text(
            "Defense mode has been turned off, group is no longer under attack."
        )
        return
    msg.reply_text("Invalid status to set!")  # on or off ffs
    return