Giter Site home page Giter Site logo

Rocketgram

TEST

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

Rocketgram's Projects

rocketgram icon rocketgram

Modern and powerful asynchronous telegram bot framework.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.