mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-03-16 12:25:45 +01:00
fix code comments by jh0ker
This commit is contained in:
parent
b8c9992eff
commit
1dc9907a70
2 changed files with 10 additions and 8 deletions
|
@ -107,11 +107,13 @@ class Dispatcher:
|
|||
except the first word (usually the command).
|
||||
Example: '/add item1 item2 item3' -> ['item1', 'item2', 'item3']
|
||||
For other updates, args will be None
|
||||
|
||||
Sometimes to handle update you need some context data. You can define
|
||||
handlers with context parameter. To produce context just queue in
|
||||
update_queue.put(update,context=context) or
|
||||
|
||||
In some cases handlers may need some context data to process the update. To
|
||||
procedure just queue in update_queue.put(update, context=context) or
|
||||
processUpdate(update,context=context).
|
||||
|
||||
context:
|
||||
Extra data for handling updates.
|
||||
|
||||
For regex-based handlers, you can also request information about the match.
|
||||
For all other handlers, these will be None
|
||||
|
@ -647,7 +649,7 @@ class Dispatcher:
|
|||
if is_async or 'groupdict' in fargs:
|
||||
target_kwargs['groupdict'] = kwargs.get('groupdict', None)
|
||||
|
||||
if 'context' in fargs:
|
||||
if is_async or 'context' in fargs:
|
||||
target_kwargs['context'] = kwargs.get('context', None)
|
||||
|
||||
handler(self.bot, update, **target_kwargs)
|
||||
|
|
|
@ -48,12 +48,12 @@ class UpdateQueue(Queue):
|
|||
def get(self, block=True, timeout=None, context=False):
|
||||
"""
|
||||
Remove and return an item from the queue. A tuple of
|
||||
(update, context) if required. Overrides standard Queue.get
|
||||
(update, context) if requested. Overrides standard Queue.get
|
||||
method.
|
||||
|
||||
Args:
|
||||
update (any): handled by the dispatcher
|
||||
context (any): extra data to use in handlers
|
||||
context (boolean): set true to get (update, context)
|
||||
|
||||
"""
|
||||
if not context:
|
||||
return Queue.get(self, block, timeout)[0]
|
||||
|
|
Loading…
Add table
Reference in a new issue