documentation

This commit is contained in:
Jannes Höke 2016-04-18 18:13:54 +02:00
parent 687a3b0ba1
commit b6fceefc80
21 changed files with 139 additions and 32 deletions

View file

@ -0,0 +1,7 @@
telegram.ext.handler module
===========================
.. automodule:: telegram.ext.handler
:members:
:undoc-members:
:show-inheritance:

View file

@ -0,0 +1,7 @@
telegram.ext.choseninlineresulthandler module
=============================================
.. automodule:: telegram.ext.choseninlineresulthandler
:members:
:undoc-members:
:show-inheritance:

View file

@ -0,0 +1,7 @@
telegram.ext.commandhandler module
==================================
.. automodule:: telegram.ext.commandhandler
:members:
:undoc-members:
:show-inheritance:

View file

@ -0,0 +1,7 @@
telegram.ext.filters module
===========================
.. automodule:: telegram.ext.filters
:members:
:undoc-members:
:show-inheritance:

View file

@ -0,0 +1,7 @@
telegram.ext.handler module
===========================
.. automodule:: telegram.ext.handler
:members:
:undoc-members:
:show-inheritance:

View file

@ -0,0 +1,7 @@
telegram.ext.inlinequeryhandler module
======================================
.. automodule:: telegram.ext.inlinequeryhandler
:members:
:undoc-members:
:show-inheritance:

View file

@ -0,0 +1,7 @@
telegram.ext.jobqueue module
============================
.. automodule:: telegram.ext.jobqueue
:members:
:undoc-members:
:show-inheritance:

View file

@ -0,0 +1,7 @@
telegram.ext.messagehandler module
==================================
.. automodule:: telegram.ext.messagehandler
:members:
:undoc-members:
:show-inheritance:

View file

@ -0,0 +1,7 @@
telegram.ext.regexhandler module
================================
.. automodule:: telegram.ext.regexhandler
:members:
:undoc-members:
:show-inheritance:

View file

@ -0,0 +1,29 @@
telegram.ext package
====================
Submodules
----------
.. toctree::
telegram.ext.updater
telegram.ext.dispatcher
telegram.ext.jobqueue
telegram.ext.handler
telegram.ext.choseninlineresulthandler
telegram.ext.commandhandler
telegram.ext.inlinequeryhandler
telegram.ext.messagehandler
telegram.ext.filters
telegram.ext.regexhandler
telegram.ext.stringcommandhandler
telegram.ext.stringregexhandler
telegram.ext.typehandler
Module contents
---------------
.. automodule:: telegram.ext
:members:
:undoc-members:
:show-inheritance:

View file

@ -0,0 +1,7 @@
telegram.ext.stringcommandhandler module
========================================
.. automodule:: telegram.ext.stringcommandhandler
:members:
:undoc-members:
:show-inheritance:

View file

@ -0,0 +1,7 @@
telegram.ext.stringregexhandler module
======================================
.. automodule:: telegram.ext.stringregexhandler
:members:
:undoc-members:
:show-inheritance:

View file

@ -0,0 +1,7 @@
telegram.ext.typehandler module
===============================
.. automodule:: telegram.ext.typehandler
:members:
:undoc-members:
:show-inheritance:

View file

@ -1,7 +0,0 @@
telegram.jobqueue module
========================
.. automodule:: telegram.jobqueue
:members:
:undoc-members:
:show-inheritance:

View file

@ -9,9 +9,7 @@ Submodules
telegram.audio
telegram.base
telegram.bot
telegram.ext.updater
telegram.ext.dispatcher
telegram.jobqueue
telegram.ext
telegram.inlinequery
telegram.inlinequeryresult
telegram.choseninlineresult

View file

@ -38,7 +38,8 @@ class ChosenInlineResultHandler(Handler):
"""
def __init__(self, callback, pass_update_queue=False):
super(ChosenInlineResultHandler, self).__init__(callback, pass_update_queue)
super(ChosenInlineResultHandler, self).__init__(callback,
pass_update_queue)
def checkUpdate(self, update):
return isinstance(update, Update) and update.chosen_inline_result

View file

@ -26,7 +26,7 @@ from telegram import Update
class CommandHandler(Handler):
"""
Handler class to handle Telegram commands. Commands are Telegram messages
that start with ``/``, optionally followed by an @ and the bot's
that start with ``/``, optionally followed by an ``@`` and the bot's
name and/or some additional text.
Args:
@ -36,8 +36,8 @@ class CommandHandler(Handler):
has determined that an update should be processed by this handler.
pass_args (optional[bool]): If the handler should be passed the
arguments passed to the command as a keyword argument called `
`args``. It will contain a list of strings, which is the text
following the command split on spaces. Default is ``False``
``args``. It will contain a list of strings, which is the text
following the command split on spaces. Default is ``False``
pass_update_queue (optional[bool]): If the handler should be passed the
update queue as a keyword argument called ``update_queue``. It can
be used to insert updates. Default is ``False``

View file

@ -89,8 +89,8 @@ class Dispatcher(object):
Args:
bot (telegram.Bot): The bot object that should be passed to the
handlers
update_queue (telegram.UpdateQueue): The synchronized queue that will
contain the updates.
update_queue (Queue): The synchronized queue that will contain the
updates.
"""
def __init__(self, bot, update_queue, workers=4, exception_event=None):
self.bot = bot
@ -163,7 +163,7 @@ class Dispatcher(object):
Processes a single update.
Args:
update (any):
update (object):
"""
# An error happened while polling
@ -212,7 +212,7 @@ class Dispatcher(object):
Args:
handler (Handler): A Handler instance
group (object): The group identifier
group (optional[object]): The group identifier. Default is 0
"""
if not isinstance(handler, Handler):
@ -229,7 +229,7 @@ class Dispatcher(object):
Args:
handler (Handler): A Handler instance
group (object): The group identifier
group (optional[object]): The group identifier. Default is 0
"""
if handler in self.handlers[group]:
self.handlers[group].remove(handler)
@ -239,8 +239,8 @@ class Dispatcher(object):
Registers an error handler in the Dispatcher.
Args:
handler (function): A function that takes (Bot, TelegramError) as
arguments.
handler (function): A function that takes ``Bot, Update,
TelegramError`` as arguments.
"""
self.error_handlers.append(callback)
@ -250,7 +250,7 @@ class Dispatcher(object):
De-registers an error handler.
Args:
handler (any):
handler (function):
"""
if callback in self.error_handlers:
@ -261,7 +261,7 @@ class Dispatcher(object):
Dispatches an error.
Args:
update (any): The update that caused the error
update (object): The update that caused the error
error (telegram.TelegramError): The Telegram error that was raised.
"""

View file

@ -22,7 +22,7 @@
from .handler import Handler
from telegram import Update
from .filters import *
from .filters import * # flake8: noqa
class MessageHandler(Handler):

View file

@ -34,8 +34,8 @@ class StringCommandHandler(Handler):
has determined that an update should be processed by this handler.
pass_args (optional[bool]): If the handler should be passed the
arguments passed to the command as a keyword argument called `
`args``. It will contain a list of strings, which is the text
following the command split on spaces. Default is ``False``
``args``. It will contain a list of strings, which is the text
following the command split on spaces. Default is ``False``
pass_update_queue (optional[bool]): If the handler should be passed the
update queue as a keyword argument called ``update_queue``. It can
be used to insert updates. Default is ``False``

View file

@ -116,9 +116,10 @@ class Updater(object):
False.
bootstrap_retries (Optional[int[): Whether the bootstrapping phase
of the `Updater` will retry on failures on the Telegram server.
< 0 - retry indefinitely
0 - no retries (default)
> 0 - retry up to X times
| < 0 - retry indefinitely
| 0 - no retries (default)
| > 0 - retry up to X times
Returns:
Queue: The update queue that can be filled from the main thread
@ -183,9 +184,10 @@ class Updater(object):
is False.
bootstrap_retries (Optional[int[): Whether the bootstrapping phase
of the `Updater` will retry on failures on the Telegram server.
< 0 - retry indefinitely
0 - no retries (default)
> 0 - retry up to X times
| < 0 - retry indefinitely
| 0 - no retries (default)
| > 0 - retry up to X times
webhook_url (Optional[str]): Explicitly specifiy the webhook url.
Useful behind NAT, reverse proxy, etc. Default is derived from
`listen`, `port` & `url_path`.