Job(callback, interval=None, repeat=True, context=None, days=(0, 1, 2, 3, 4, 5, 6), name=None, job_queue=None)¶
This class encapsulates a Job.
callable– The callback function that should be executed by the new job.
object– Optional. Additional data needed for the callback function.
str– 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 interval in which the job will run. If it is an
float, it will be interpreted as seconds. If you don’t set this value, you must set
next_twhen 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
int] – Optional. Defines on which days of the week the job should run.
bool– Whether this job is enabled.
datetime.timedelta– Optional. The interval in which the job will run.
int– The interval for this job in seconds.
bool– Whether this job is due to be removed.
bool– 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.