How Run_daily works (JobQueue || Python telegram bot)

Question:

Testing simple bot that should send message every day at certain time. When i was testing run_repeating it worked normally. But when i use run_daily it’s just doesn’t send anything end ignore time in the parameters. I checked documentation and everything seems normal. But it’s just ignore my time. There is no errors, just waring about "days" parameter format (nothing about time). May be its using some specific time format ? In docs its says by default it’s UTC (exm: 23:45:00). Code run

I thought maybe there is different time zone and i tried to set my local time zone, but it doesn’t work
Maybe i do it wrong ?

trying to change time zone

Asked By: d37t4

||

Answers:

Find out about time. first i change how i initialize time zone. And i just remove "days" parameter and its just worked. And now i cant handle with this warning. By documentation there is need to be tuple. But it works only if i make full 0-6 tuple. It doesn’t work when i change this tuple and remove some days. Its make it half useless. || tuple || time zone || this warning always appears when tuple doesn’t full || Now only thing is left is to handle is this "days" issue

Answered By: d37t4

it’s suddenly start working just by itself. One thing that if i want to make run_daily just for one day in need to make it like this job_queue.run_daily(callback, time=target_time, days=(1,1)) in this case it’s Monday. when i give there just one parameter it’s said that is not iterable cause i give just one int. So i don’t understand why it’s working like that. I looked into definition and there is only this:

 days: Tuple[int, ...] = _ALL_DAYS


if days != tuple(range(7)):  # checks if user passed a custom value
        warn("Prior to v20.0 the `days` parameter was not aligned to that of cron's weekday scheme. We recommend double checking if the passed value is correct.",
        stacklevel=2,
        )
Answered By: d37t4
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.