Job(callback, interval=None, repeat=True, context=None, days=(0, 1, 2, 3, 4, 5, 6), name=None, job_queue=None, tzinfo=datetime.timezone.utc)¶
This class encapsulates a Job.
The callback function that should be executed by the new job.
Optional. Additional data needed for the callback function.
Optional. The name of the new job.
- callback (
callable) – The callback function that should be executed by the new job. It should take
bot, jobas parameters, where
telegram.ext.Jobinstance. It can be used to access it’s
contextor change it to a repeating job.
- interval (
datetime.timedelta, optional) – The time interval between executions of the job. If it is an
float, it will be interpreted as seconds. If you don’t set this value, you must set
time_specwhen you put the job into the job queue.
- repeat (
bool, optional) – If this job should be periodically execute its callback function (
True) or only once (
False). Defaults to
- context (
object, optional) – Additional data needed for the callback function. Can be accessed through
job.contextin the callback. Defaults to
- name (
str, optional) – The name of the new job. Defaults to
- days (Tuple[
int], optional) – Defines on which days of the week the job should run. Defaults to
- job_queue (
telegram.ext.JobQueue, optional) – The
JobQueuethis job belongs to. Only optional for backward compatibility with
- tzinfo (
datetime.tzinfo, optional) – timezone associated to this job. Used when checking the day of the week to determine whether a job should run (only relevant when
days is not Days.EVERY_DAY). Defaults to UTC.
Optional. Defines on which days of the week the job should run.
Whether this job is enabled.
Optional. The interval in which the job will run.
The interval for this job in seconds.
Whether this job is due to be removed.
Optional. If this job should periodically execute its callback function.
Executes the callback function.
Schedules this job for removal from the
JobQueue. It will be removed without executing its callback function again.