robo.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:TBot8-1 作者: Danzilla-cool 项目源码 文件源码
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>')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号