From 2534e0df9b08965d22f90e1a2385d37efbe05d13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannes=20H=C3=B6ke?= Date: Sat, 28 May 2016 13:41:23 +0200 Subject: [PATCH] allow jobs to be ran outside of jobqueue --- telegram/ext/jobqueue.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/telegram/ext/jobqueue.py b/telegram/ext/jobqueue.py index 600287eaf..4094bc284 100644 --- a/telegram/ext/jobqueue.py +++ b/telegram/ext/jobqueue.py @@ -101,7 +101,7 @@ class JobQueue(object): self.logger.debug('Running job %s' % job.name) try: - job.run() + job.run(self.bot) except: self.logger.exception( @@ -180,7 +180,7 @@ class Job(object): interval (float): repeat (bool): name (str): - enabled (bool): If this job is currently active + enabled (bool): Boolean property that decides if this job is currently active Args: callback (function): The callback function that should be executed by the Job. It should @@ -207,9 +207,9 @@ class Job(object): self._enabled = Event() self._enabled.set() - def run(self): + def run(self, bot): """Executes the callback function""" - self.callback(self.job_queue.bot, self) + self.callback(bot, self) def schedule_removal(self): """