telegram.ext.Job¶
-
class
telegram.ext.Job(callback: Callable[[CallbackContext], None], context: object = None, name: str = None, job_queue: telegram.ext.jobqueue.JobQueue = None, job: apscheduler.job.Job = None)¶ Bases:
objectThis class is a convenience wrapper for the jobs held in a
telegram.ext.JobQueue. With the current backend APScheduler,jobholds aapscheduler.job.Jobinstance.Note
- All attributes and instance methods of
jobare also directly available as attributes/methods of the correspondingtelegram.ext.Jobobject. - Two instances of
telegram.ext.Jobare considered equal, if their correspondingjobattributes have the sameid. - If
jobisn’t passed on initialization, it must be set manually afterwards for thistelegram.ext.Jobto be useful.
Parameters: - callback (
callable) –The callback function that should be executed by the new job. Callback signature for context based API:
def callback(CallbackContext)a
context.jobis thetelegram.ext.Jobinstance. It can be used to access itsjob.contextor change it to a repeating job. - context (
object, optional) – Additional data needed for the callback function. Can be accessed throughjob.contextin the callback. Defaults toNone. - name (
str, optional) – The name of the new job. Defaults tocallback.__name__. - job_queue (
telegram.ext.JobQueue, optional) – TheJobQueuethis job belongs to. Only optional for backward compatibility withJobQueue.put(). - job (
apscheduler.job.Job, optional) – The APS Job this job is a wrapper for.
-
callback¶ The callback function that should be executed by the new job.
Type: callable
-
context¶ Optional. Additional data needed for the callback function.
Type: object
-
name¶ Optional. The name of the new job.
Type: str
-
job_queue¶ Optional. The
JobQueuethis job belongs to.Type: telegram.ext.JobQueue
-
job¶ Optional. The APS Job this job is a wrapper for.
Type: apscheduler.job.Job
-
enabled¶ Whether this job is enabled.
Type: bool
-
next_t¶ Datetime for the next job execution. Datetime is localized according to
tzinfo. If job is removed or already ran it equals toNone.Type: datetime.datetime
-
removed¶ Whether this job is due to be removed.
Type: bool
-
run(dispatcher: Dispatcher) → None¶ Executes the callback function independently of the jobs schedule.
-
schedule_removal() → None¶ Schedules this job for removal from the
JobQueue. It will be removed without executing its callback function again.
- All attributes and instance methods of