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: update.effective_message.reply_text("{} is now Away!".format(fname)) except BadRequest: pass
def start_afk(userid, reason): REDIS.set(f'is_afk_{userid}', reason)