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
rocketgram-6.0.0.tar.gz
(72.7 kB
view hashes)
Built Distribution
rocketgram-6.0.0-py3-none-any.whl
(231.6 kB
view hashes)
Close
Hashes for rocketgram-6.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 068306d16c7229e62b0b5d6d8832ca9ca39d0f3116927bb652c511a8a415bc35 |
|
MD5 | 323c933be24cc53153d99bd8dd80db70 |
|
BLAKE2b-256 | b6d5cdb4a7e7f97c7bf0a3086b934585bbe3c2b50ab6a0a0239aa39a6bdc466b |