Exemple #1
0
def callback_andalucia(bot, job):
    if str(job.context) == str(settings["main"]["groupid"]):
        restTime = Utils.getRandomByValue(2)
        now = datetime.now() + timedelta(days=1)
        now = now.replace(hour=17 + restTime, minute=Utils.getRandomByValue(59))
        j.run_once(callback_andalucia, now, context=job.context)
        bot.send_message(chat_id=job.context,
                         text="¡Buenos días, Andalucía! :D")
Exemple #2
0
def startJobs(bot, update):
    now = datetime.now() - timedelta(days=1)
    restTime = Utils.getRandomByValue(2)
    now = now.replace(hour=17 + restTime, minute=Utils.getRandomByValue(59))
    j.run_once(callback_andalucia, now, context=update.message.chat_id)
    # now = now.replace(hour=2, minute=00)
    # job_daily = j.run_daily(callback_bye, now.time(), days=(
    #     0, 1, 2, 3, 4, 5, 6), context=update.message.chat_id)
    data = loadMemories()
    for item in data:
        j.run_once(callback_remember, dateutil.parser.parse(item["when"]), context=update.message.chat_id)