Django app to write Telegram bots
Project description
CI:
PyPI:
Docs:
Django app to write Telegram bots. Just define commands and how to handle them.
NOTE: Just for text messages at this moment.
Documentation
The full documentation is at https://django-telegram-bot.readthedocs.org.
Telegram API documentation at https://core.telegram.org/bots/api
Quickstart
Install django-telegram-bot:
pip install django-telegram-bot
Add telegrambot and rest_framework to your INSTALLED_APPS, and run:
python manage.py migrate
After creating a bot in Telegram Platform set token received:
TELEGRAM_BOT_TOKEN = "token from your telegram bot"
Add webhook url to your urlpatterns:
url(r'^telegrambot/', include('telegrambot.urls'), name="telegrambot")
Define whe file where commands will be defined in commandspatterns 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):
commandspatterns = [('start', StartView.as_command_view())
Command views responses with Telegram messages to the user who send the command with a text message and keyboard. Compound with a context and a template. The way it is handled is analogue to Django views. Visits docs for more details https://django-telegram-bot.readthedocs.org/usage.html
Features
Commands handling definition.
Text responses and keyboards.
Media messages not supported.
Only Markup parse mode.
Running Tests
Does the code actually work?
source <YOURVIRTUALENV>/bin/activate (myenv) $ pip install -r requirements/test.txt (myenv) $ make test (myenv) $ make test-all
History
0.1.0 (2016-21-01)
First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-telegram-bot-0.1.0.tar.gz.
File metadata
- Download URL: django-telegram-bot-0.1.0.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb7bc346c28770b9e2b68a442e7903dcb85869cf927ab5fd7467b23ea36b86bf
|
|
| MD5 |
fbdf0e2f20ce7435246998b849a6498f
|
|
| BLAKE2b-256 |
3838459bcc8fae1b66d836f90a220984b9102b87e83764760caffebfc723394d
|
File details
Details for the file django_telegram_bot-0.1.0-py2.py3-none-any.whl.
File metadata
- Download URL: django_telegram_bot-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 14.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1c28aa72225ab93654e25d5d9473ae56c99f496de1d60d323db17e1656b0346
|
|
| MD5 |
28796945c791f4494c4f6428b70bdee3
|
|
| BLAKE2b-256 |
e7bd25cb4f246c53a3fa8a6588cebe1cf76ca419de1da29efd7f527be50e4692
|