mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-01-16 14:33:12 +01:00
* Fix #1366: _trigger_timeout() missing 1 required positional argument: 'job' * Add comments
This commit is contained in:
parent
7944805627
commit
2ed4cbd26d
2 changed files with 14 additions and 6 deletions
|
@ -49,6 +49,7 @@ The following wonderful people contributed directly or indirectly to this projec
|
|||
- `Kirill Vasin <https://github.com/vasinkd>`_
|
||||
- `Kjwon15 <https://github.com/kjwon15>`_
|
||||
- `Li-aung Yip <https://github.com/LiaungYip>`_
|
||||
- `Loo Zheng Yuan <https://github.com/loozhengyuan>`_
|
||||
- `macrojames <https://github.com/macrojames>`_
|
||||
- `Michael Elovskikh <https://github.com/wronglink>`_
|
||||
- `Mischa Krüger <https://github.com/Makman2>`_
|
||||
|
|
|
@ -23,7 +23,7 @@ import warnings
|
|||
|
||||
from telegram import Update
|
||||
from telegram.ext import (Handler, CallbackQueryHandler, InlineQueryHandler,
|
||||
ChosenInlineResultHandler)
|
||||
ChosenInlineResultHandler, CallbackContext)
|
||||
from telegram.utils.promise import Promise
|
||||
|
||||
|
||||
|
@ -354,12 +354,19 @@ class ConversationHandler(Handler):
|
|||
if self.persistent:
|
||||
self.persistence.update_conversation(self.name, key, new_state)
|
||||
|
||||
def _trigger_timeout(self, bot, job):
|
||||
def _trigger_timeout(self, context, job=None):
|
||||
self.logger.debug('conversation timeout was triggered!')
|
||||
del self.timeout_jobs[job.context.conversation_key]
|
||||
|
||||
# Backward compatibility with bots that do not use CallbackContext
|
||||
if isinstance(context, CallbackContext):
|
||||
context = context.job.context
|
||||
else:
|
||||
context = job.context
|
||||
|
||||
del self.timeout_jobs[context.conversation_key]
|
||||
handlers = self.states.get(self.TIMEOUT, [])
|
||||
for handler in handlers:
|
||||
check = handler.check_update(job.context.update)
|
||||
check = handler.check_update(context.update)
|
||||
if check is not None and check is not False:
|
||||
handler.handle_update(job.context.update, job.context.dispatcher, check)
|
||||
self.update_state(self.END, job.context.conversation_key)
|
||||
handler.handle_update(context.update, context.dispatcher, check)
|
||||
self.update_state(self.END, context.conversation_key)
|
||||
|
|
Loading…
Reference in a new issue