Giter Site home page Giter Site logo

roboto's Introduction

Roboto

codecov

A type-hinted async Telegram bot library, supporting trio, curio and asyncio.

Roboto's API is not perfectly stable nor complete yet. It will be kept a 0.x.0 until the Telegram Bot API is completely implemented, and will be bumped to 1.0.0 when it is complete.

Basic usage

Roboto is still a low-level bot API, meaning it does not provide much abstraction over the Bot API yet (that is planned, though).

Currently, a basic echo bot with roboto looks like:

from roboto import Token, BotAPI
from trio import run  # This could be asyncio or curio as well!


api_token = Token('your-bot-token')


async def main() -> None:
    async with BotAPI.make(api_token) as bot:
        offset = 0

        while True:
            updates = await bot.get_updates(offset)

            for update in updates:
                if update.message is not None and update.message.text is not None:
                    await bot.send_message(
                        update.message.chat.id,
                        update.message.text,
                    )

            if updates:
                offset = updates[-1].update_id + 1


# In asyncio it should be "main()".
run(main)

Being statically-typed, Roboto supports easy autocompletion and mypy static checking.

Contributing

Check our contributing guide to know how to develop on Roboto and contribute to our project.

Goals

Principles

  • Ease of static checking for client code, especially static typing.
  • Forwards compatibility (additions to the bot HTTP API should not break older versions of Roboto easily).

Achieved milestones

Next milestones

Acknowledgements

This used to be a disclaimer that we were vendoring asks. We are not anymore (the feature we needed is now on upstream), but I will still keep the acknowledgemente because it (through anyio) gives us the ability to support the three major async event loops, asyncio, trio and curio!

roboto's People

Contributors

gabrielsimonetto avatar tarcisioe avatar

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.