Exemple #1
0
def afk(update, context):
    args = update.effective_message.text.split(None, 1)
    user = update.effective_user
    if not user:  # ignore channels
        return

    if user.id == 777000:
        return
    start_afk_time = time.time()
    if len(args) >= 2:
        reason = args[1]
    else:
        reason = "none"
    start_afk(update.effective_user.id, reason)
    REDIS.set(f'afk_time_{update.effective_user.id}', start_afk_time)
    fname = update.effective_user.first_name
    try:
        sett_afkk = update.effective_message.reply_text(
            "User <b>{}</b> Is Now AFK!".format(fname), parse_mode="html")
        sleep(15)
        try:
            sett_afkk.delete()
        except BadRequest:
            pass
    except BadRequest:
        pass
Exemple #2
0
def start_afk(userid, reason):
    REDIS.set(f'is_afk_{userid}', reason)