-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
📋 stalework status: stalework status: stale
Description
I want to restart a job queue after being stopped.
So, I can start a task task() by a timer and I can stop it.
When I try to start it for the second time and timer() content works great but not task() at all
class MyBot:
def __init__(self, some_params):
self.updater = tg.Updater(TOKEN, ...)
def start_bot(self):
self.updater.start_pooling()
def task():
...logic...
def timer(update: telegram.Update, context: telegram.ext.CallbackContext):
context.job_queue.run_repeating(
task, poll,
context=update.message.chat_id, first=5)
def stop(update: telegram.Update, context: telegram.ext.CallbackContext):
context.job_queue.stop()
handlers = [
{'command': 'start', 'callback': timer},
{'command': 'stop', 'callback': stop, 'pass_job_queue': False} ]
for h in handlers:
self.updater.dispatcher.add_handler(CommandHandler(**h))
Metadata
Metadata
Assignees
Labels
📋 stalework status: stalework status: stale