Exemple #1
0
def setTimeSetting(bot: Bot, update: Update, args: List[str]):
    chat = update.effective_chat
    msg = update.effective_message
    if (not args) or len(args) != 1 or (not args[0].isdigit()):
        msg.reply_text("Give me a valid value to set! 30 to 900 secs")
        return
    value = int(args[0])
    if value < 30 or value > 900:
        msg.reply_text("Invalid value! Please use a value between 30 and 900 seconds (15 minutes)")
        return
    sql.setKickTime(str(chat.id), value)
    msg.reply_text("Success! Users that don't confirm being people will be kicked after " + str(value) + " seconds.")
    return
Exemple #2
0
def setTimeSetting(update: Update, context: CallbackContext):
    bot, args = context.bot, context.args
    chat = update.effective_chat
    msg = update.effective_message
    if args[0] == "false" or args[0] == "off":
        msg.reply_text("Disabled auto kick!")
        sql.setKickTime(str(chat.id), 0)
        return
    if (not args) or len(args) != 1 or (not args[0].isdigit()):
        msg.reply_text("Give me a valid value to set! 30 to 900 secs")
        return
    value = int(args[0])
    if value < 30 or value > 900:
        msg.reply_text(
            "Invalid value! Please use a value between 30 and 900 seconds (15 minutes)"
        )
        return
    sql.setKickTime(str(chat.id), value)
    msg.reply_text(
        "Success! Users that don't confirm being people will be kicked after "
        + str(value) + " seconds.")
    return