A type-hinted async Telegram bot library.
Project description
Roboto
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.
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
- Support for other async runtimes other than asyncio (especially
trio
) (done in v0.2.0).
Next milestones
- Full Telegram Bot API implementation.
- High-level API (abstraction for command handlers, necessary internal state, etc.).
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
roboto-telegram-0.2.0.tar.gz
(11.4 kB
view hashes)
Built Distribution
Close
Hashes for roboto_telegram-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ecc690be49234c5bc852f306af48bc5a64c8d1a6cb6b5ebd353bd8864312147a |
|
MD5 | 5b5f846f1f5f97cb584adaa56b69a3c4 |
|
BLAKE2b-256 | 4c2f3095c88e7c786329086da7e94244e143daafe487df88d3f6fd32caf5e793 |