Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Modern and powerful asynchronous telegram bot framework.

Project description

Rocketgram

TEST

Modern and powerful asynchronous telegram bot framework.

Release news available here: @RocketgramNews

How to install

For development

pip install rocketgram[aiohttp]

For production

pip install rocketgram[aiohttp,ujson]

Dependencies

All dependencies are optional but you should install one of aiohttp and tornado to use framework.

ujson is highly recommended to speedup json parsing.

Also you can use uvloop as alternative to standard event loop.

  • Python >= 3.7
  • aiohttp >= 3.6.2
  • ujson >= 1.35
  • tornado >= 6.0.2
  • uvloop >= 0.12.1

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

token = 'YOUR_BOT_TOKEN'

router = Dispatcher()
bot = Bot(token, router=router)

@router.handler
@commonfilters.command('/start')
async def start_command():
    await SendMessage(context.user.user_id, 'Hello there!').send()

@router.handler
@commonfilters.command('/help')
async def start_command():
    await SendMessage(context.user.user_id, 'Some userful help!').send()

UpdatesExecutor.run(bot)

Testing

Code tested automatically using Github Actions. You can see build status here.

To test code manually install and run pytest:

pip install pytest
python -m pytest

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for rocketgram, version 3.2.0
Filename, size File type Python version Upload date Hashes
Filename, size rocketgram-3.2.0-py3-none-any.whl (165.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size rocketgram-3.2.0.tar.gz (53.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page