def set(bot, update, args, job_queue):
"""Adds a job to the queue"""
chat_id = update.message.chat_id
try:
# args[0] should contain the time for the timer in seconds
due = int(args[0])
if due < 0:
bot.sendMessage(chat_id, text='?? ???? ??? ?? ????? ?????? ? ???????!')
return
if due > 3600 * 24 * 31:
bot.sendMessage(chat_id, text='??????? ??????? ?????!')
return
# Add job to queue
job = Job(alarm, due, repeat=False, context=chat_id)
timers[chat_id] = job
job_queue.put(job)
bot.sendMessage(chat_id, text='?????? ??????????!')
except (IndexError, ValueError):
bot.sendMessage(chat_id, text='????????? ??????: /set <seconds>')
评论列表
文章目录