Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jlmadurga committed Jan 28, 2016
1 parent 563e4a3 commit a8ca68a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
18 changes: 12 additions & 6 deletions README.rst
Expand Up @@ -56,15 +56,21 @@ Add webhook url to your urlpatterns::

url(r'^telegrambot/', include('telegrambot.urls', namespace="telegrambot")

Define whe file where commands will be defined in ``commandspatterns`` variable, analogue to django ``urls``
Define whe file where commands will be defined in ``bothandlers`` variable, analogue to django ``urls``
and ``ROOT_URLCONF``::

TELEGRAM_BOT_COMMANDS_CONF = "app.commands"
TELEGRAM_BOT_HANDLERS_CONF = "app.handlers"
Set bot commands handlers is very easy just define a module with ``commandspatterns`` list of tuples
('command', command_view)::

commandspatterns = [('start', StartView.as_command_view())
Set bot commands handlers is very easy just as defining `urls` in django. Module with ``bothandlers`` that list
different handlers::

bothandlers = [command('start', StartView.as_command_view()),
command('author', AuthorCommandView.as_command_view()),
command('author_inverse', AuthorInverseListView.as_command_view()),
command('author_query', AuthorCommandQueryView.as_command_view()),
unknown_command(UnknownView.as_command_view()),
regex(r'author_(?P<name>\w+)', AuthorName.as_command_view()),
]
Use command ``set_webhook`` to specify the url to receive the incoming updates via webhook::

Expand Down
23 changes: 17 additions & 6 deletions docs/usage.rst
Expand Up @@ -13,15 +13,26 @@ Add webhook url to your urlpatterns::

url(r'^telegrambot/', include('telegrambot.urls', namespace="telegrambot")

Define whe file where commands will be defined in ``commandspatterns`` variable, analogue to django ``urls``
Define whe file where commands will be defined in ``bothandlers`` variable, analogue to django ``urls``
and ``ROOT_URLCONF``::

TELEGRAM_BOT_COMMANDS_CONF = "app.commands"
Set bot commands handlers is very easy just define a module with ``commandspatterns`` list of tuples
('command', command_view)::
TELEGRAM_BOT_HANDLERS_CONF = "app.handlers"

Set bot commands handlers is very easy just as defining `urls` in django. Module with ``bothandlers`` that list
different handlers::

bothandlers = [command('start', StartView.as_command_view()),
command('author', AuthorCommandView.as_command_view()),
command('author_inverse', AuthorInverseListView.as_command_view()),
command('author_query', AuthorCommandQueryView.as_command_view()),
unknown_command(UnknownView.as_command_view()),
regex(r'author_(?P<name>\w+)', AuthorName.as_command_view()),
]

Set bot commands handlers is very easy just as defining `urls`in django. Module with ``bothandlers`` list
of different handlers `command('command', command_view)`, `regex('re_expresion', command_view)`,...::

commandspatterns = [('start', StartView.as_command_view())
bothandlers = [command('start', StartView.as_command_view())]
Use command ``set_webhook`` to specify the url to receive the incoming updates via webhook::

Expand Down

0 comments on commit a8ca68a

Please sign in to comment.