I have the same problem as in this thread
run_daily
doesn’t do its job. run_once
and run_repeating
work well.
I do not understand why. I tested your code but task is not carried out
import telegram.ext
from telegram.ext import Updater
import datetime
updater = Updater('My Token', use_context=True)
job = updater.job_queue
def callback_minute(context: telegram.ext.CallbackContext):
context.bot.send_message(chat_id='My Chat ID', text='One message every minute')
t = datetime.time(20, 2, 00, 000000)
job.run_daily(callback_minute,t,days=(0, 1, 2, 3, 4, 5, 6),context=None,name=None)
updater.start_polling()
updater.idle()
I have tried with this code yet, but it also does not work
from telegram.ext import Updater, CommandHandler
import datetime
def daily_job(bot, update, job_queue):
""" Running on Mon, Tue, Wed, Thu, Fri = tuple(range(5)) """
bot.send_message(chat_id='My Chat ID', text='Setting a daily notifications!')
t = datetime.time(7, 30, 00, 000000)
job_queue.run_daily(notify_assignees, t, days=tuple(range(5)), context=update)
def notify_assignees(bot, job):
bot.send_message(chat_id='My Chat ID', text="Some text!")
updater = Updater('My Token')
updater.dispatcher.add_handler(CommandHandler('notify', daily_job, pass_job_queue=True))
updater.start_polling()
In both cases task added to jobs()
but not done …
2
Answers
I found the cause of the problem. Task time is moved back two hours. task that I ordered at 19 was carried out at 21.
This is most easily observed by commissioning two tasks
run_daily
andrun_repeating
and checking.next_t
I fixed the moved back time issue. Time discrepancy gone in this way.