Modern and powerful asynchronous telegram bot framework.
Project description
Rocketgram
Modern and powerful asynchronous telegram bot framework.
Release news available here: @RocketgramNews
Dependencies
All dependencies are optional, but you should install aiohttp to use the framework.
orjson or ujson is highly recommended to speed up json parsing.
Also, you can use uvloop as alternative to standard event loop.
How to install
For development
pip install rocketgram[aiohttp]
For production
pip install uvloop rocketgram[aiohttp,orjson]
Example
There is a trivial example below. Here is useful bot template.
from rocketgram import Bot, Dispatcher, UpdatesExecutor
from rocketgram import context, commonfilters
from rocketgram import SendMessage
try:
import uvloop
uvloop.install()
except ImportError:
pass
token = f'YOUR_BOT_TOKEN'
router = Dispatcher()
bot = Bot(token, router=router)
@router.handler
@commonfilters.command('/start')
async def start_command():
await SendMessage(context.user.id, f'Hello there!').send()
@router.handler
@commonfilters.command('/help')
async def start_command():
await SendMessage(context.user.id, f'Some userful help!').send()
UpdatesExecutor.run(bot)
Testing
Code tested automatically using Github Actions.
You can see the build status here.
To test code manually run pytest:
pytest
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 rocketgram-6.0.4.tar.gz.
File metadata
- Download URL: rocketgram-6.0.4.tar.gz
- Upload date:
- Size: 72.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.13.3 CPython/3.12.2 Linux/6.5.0-1017-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc33a7d65883877c31451e3c3486c5a64dbf910923f52b76a67d3216ef27627d
|
|
| MD5 |
143fb83212c283c729d660713b2ef172
|
|
| BLAKE2b-256 |
2111a2006af271b60a41ddd1c0900b71a61dcd20a478e194cad13ab9c82aca9e
|
File details
Details for the file rocketgram-6.0.4-py3-none-any.whl.
File metadata
- Download URL: rocketgram-6.0.4-py3-none-any.whl
- Upload date:
- Size: 231.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.13.3 CPython/3.12.2 Linux/6.5.0-1017-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be9d5a9529d985cdcc4926567a8e985eead3b2a6094120cbdeb8b2a66e1eac29
|
|
| MD5 |
030a308a9b1edbbff96f703e1e8b20cc
|
|
| BLAKE2b-256 |
da294824e8b39a4fca408e18a94e2d23b888623b8eec525312a171f33ec54ea9
|