run.py
def autolog(update, context):
    """Command handler: /autolog <on/off> - set autolog on or off."""
    logging.info(f"Command: /autolog triggered by {update.effective_chat.id}")
    if len(context.args) != 1:
        context.bot.send_message(
            chat_id=update.effective_chat.id,
            text="Not enough or too many parameters, autolog either on or off.",
        )
    else:
        ses = apollodb.UserQuery(apollodb.Session())
        u = ses.get_user(update.effective_chat.id)
        if u:
            if context.args[0] == "on":
                context.bot.send_message(
                    chat_id=update.effective_chat.id,
                    text="I will automatically clock you in and out. Reminder is also enabled.",
                )
                ses.set_reminder(update.effective_chat.id, True)
                ses.set_autolog(update.effective_chat.id, True)
            elif context.args[0] == "off":
                context.bot.send_message(
                    chat_id=update.effective_chat.id,
                    text="I will stop automatically clocking you in and out.",
                )
                ses.set_autolog(update.effective_chat.id, False)
            else:
                context.bot.send_message(
                    chat_id=update.effective_chat.id, text="Sorry, I don't understand."
                )
        else:
            context.bot.send_message(
                chat_id=update.effective_chat.id,
                text="I don't have any information on you. /login first.",
            )
        ses.close()
Command handler: /autolog <on/off> - set autolog on or off.
Command handler: /autolog  - set autolog on or off.
Command handler : / autolog - set autolog on or off .
def autolog(update, context):
    logging.info(f"Command: /autolog triggered by {update.effective_chat.id}")
    if len(context.args) != 1:
        context.bot.send_message(
            chat_id=update.effective_chat.id,
            text="Not enough or too many parameters, autolog either on or off.",
        )
    else:
        ses = apollodb.UserQuery(apollodb.Session())
        u = ses.get_user(update.effective_chat.id)
        if u:
            if context.args[0] == "on":
                context.bot.send_message(
                    chat_id=update.effective_chat.id,
                    text="I will automatically clock you in and out. Reminder is also enabled.",
                )
                ses.set_reminder(update.effective_chat.id, True)
                ses.set_autolog(update.effective_chat.id, True)
            elif context.args[0] == "off":
                context.bot.send_message(
                    chat_id=update.effective_chat.id,
                    text="I will stop automatically clocking you in and out.",
                )
                ses.set_autolog(update.effective_chat.id, False)
            else:
                context.bot.send_message(
                    chat_id=update.effective_chat.id, text="Sorry, I don't understand."
                )
        else:
            context.bot.send_message(
                chat_id=update.effective_chat.id,
                text="I don't have any information on you. /login first.",
            )
        ses.close()
def autolog ( update , context ) : logging . info ( f"Command: /autolog triggered by {update.effective_chat.id}" ) if len ( context . args ) != 1 : context . bot . send_message ( chat_id = update . effective_chat . id , text = "Not enough or too many parameters, autolog either on or off." , ) else : ses = apollodb . UserQuery ( apollodb . Session ( ) ) u = ses . get_user ( update . effective_chat . id ) if u : if context . args [ 0 ] == "on" : context . bot . send_message ( chat_id = update . effective_chat . id , text = "I will automatically clock you in and out. Reminder is also enabled." , ) ses . set_reminder ( update . effective_chat . id , True ) ses . set_autolog ( update . effective_chat . id , True ) elif context . args [ 0 ] == "off" : context . bot . send_message ( chat_id = update . effective_chat . id , text = "I will stop automatically clocking you in and out." , ) ses . set_autolog ( update . effective_chat . id , False ) else : context . bot . send_message ( chat_id = update . effective_chat . id , text = "Sorry, I don't understand." ) else : context . bot . send_message ( chat_id = update . effective_chat . id , text = "I don't have any information on you. /login first." , ) ses . close ( )
Command handler: /autolog <on/off> - set autolog on or off.
Command handler : / autolog <on / off > - set autolog on or off .
"""Command handler: /autolog <on/off> - set autolog on or off."""
update
context