def addJob(bot, update, job_queue):
chat_id = update.message.chat_id
logger.info('[%s] Adding job.' % (chat_id))
try:
if chat_id not in jobs:
job = Job(alarm, 30, repeat=True, context=(chat_id, "Other"))
# Add to jobs
jobs[chat_id] = job
job_queue.put(job)
# User dependant
if chat_id not in sent:
sent[chat_id] = dict()
if chat_id not in locks:
locks[chat_id] = threading.Lock()
text = "Scanner started."
bot.sendMessage(chat_id, text)
except Exception as e:
logger.error('[%s] %s' % (chat_id, repr(e)))
评论列表
文章目录