Skip to content

Commit 2534e0d

Browse files
committed
allow jobs to be ran outside of jobqueue
1 parent e7f4a07 commit 2534e0d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

telegram/ext/jobqueue.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def tick(self):
101101
self.logger.debug('Running job %s' % job.name)
102102

103103
try:
104-
job.run()
104+
job.run(self.bot)
105105

106106
except:
107107
self.logger.exception(
@@ -180,7 +180,7 @@ class Job(object):
180180
interval (float):
181181
repeat (bool):
182182
name (str):
183-
enabled (bool): If this job is currently active
183+
enabled (bool): Boolean property that decides if this job is currently active
184184
185185
Args:
186186
callback (function): The callback function that should be executed by the Job. It should
@@ -207,9 +207,9 @@ def __init__(self, callback, interval, repeat=True, context=None):
207207
self._enabled = Event()
208208
self._enabled.set()
209209

210-
def run(self):
210+
def run(self, bot):
211211
"""Executes the callback function"""
212-
self.callback(self.job_queue.bot, self)
212+
self.callback(bot, self)
213213

214214
def schedule_removal(self):
215215
"""

0 commit comments

Comments
 (0)