Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hearot/pyrubrum
An intuitive framework for creating Telegram bots.
https://github.com/hearot/pyrubrum
bot client dataclass framework pyrogram pyrogram-framework pyrubrum python python-tree python3 telegram telegram-api telegram-callback-query telegram-client telegram-framework tree
Last synced: 7 days ago
JSON representation
An intuitive framework for creating Telegram bots.
- Host: GitHub
- URL: https://github.com/hearot/pyrubrum
- Owner: hearot
- License: gpl-3.0
- Created: 2020-05-17T17:59:18.000Z (over 4 years ago)
- Default Branch: dev
- Last Pushed: 2024-10-14T08:34:23.000Z (3 months ago)
- Last Synced: 2025-01-08T00:14:04.009Z (14 days ago)
- Topics: bot, client, dataclass, framework, pyrogram, pyrogram-framework, pyrubrum, python, python-tree, python3, telegram, telegram-api, telegram-callback-query, telegram-client, telegram-framework, tree
- Language: Python
- Homepage: https://pyrubrum.readthedocs.io
- Size: 864 KB
- Stars: 44
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
An intuitive framework for creating Telegram bots.
Create your own bot in less than 100 lines!
•
## Pyrubrum
```python
from pyrogram import Client
from pyrubrum import Handler, Menu, transformbot = Client(...)
handler = Handler(transform(
{
Menu("Start", "start", "Hello!", default=True): [
Menu("About me", "about_me", "I'm just a bot!"),
Menu("Thoughts", "thoughts",
"I'm a bot, I cannot think properly..."),
]
}
))handler.setup(bot)
bot.run()
```**Pyrubrum** ([*/ˈpaɪɹˈuːbɹəm/*](http://ipa-reader.xyz/?text=%CB%88pa%C9%AA%C9%B9%CB%88u%CB%90b%C9%B9%C9%99m&voice=Russell)) is a versatile, charming framework for creating [Telegram bots](https://core.telegram.org/bots), jointly with [Pyrogram](https://github.com/pyrogram/pyrogram).
### Features
- Automatic [deep-link](https://core.telegram.org/bots#deep-linking) generation with `DeepLinkMenu`
- Built-in support for [Redis](https://redis.io/)
- [Complete documentation](https://pyrubrum.readthedocs.io/)
- Custom styles for inline keyboards
- Database integration
- Fast & optimized using [MTProto](https://core.telegram.org/mtproto) jointly with [Pyrogram](https://github.com/pyrogram/pyrogram)
- Fully encrypted parameters
- Intuitive creation of inline keyboards
- LRU caching with [functools.lru_cache](https://docs.python.org/3/library/functools.html#functools.lru_cache)
- Native support for the *"Go back"* button
- No limit for `callback_data` (see [Telegram Bot API](https://core.telegram.org/bots/api#inlinekeyboardbutton))
- Paging integration with `PageMenu`### Examples
In order to make use of the proposed examples, you need to create your own environment file by renaming [sample.env](./examples/sample.env) into `.env` and editing all the necessary variables.
- [Café](./examples/cafe_bot.py) - Get an overview of the design which lies inside Pyrubrum while interacting with multiple commands and pages.
- [Calendar](./examples/calendar_bot.py) - Get what day of the week a day is by simply choosing a year, a month and a day while discovering the potential of Pyrubrum page menus.
- [Hitchhiker](./examples/hitchhiker_bot.py) - Come to know how media are handled with Pyrubrum and...[get an existential question answered](https://en.wikipedia.org/wiki/Phrases_from_The_Hitchhiker%27s_Guide_to_the_Galaxy#The_Answer_to_the_Ultimate_Question_of_Life,_the_Universe,_and_Everything_is_42).
- [Sample](./examples/sample_bot.py) - Interact with inline menus while understanding how Pyrubrum works.### Changelog
> See [CHANGELOG.md](./CHANGELOG.md).
> Find new features in [FEATURES.md](./FEATURES.md).### Commit messages
> See [Conventional Commits](https://www.conventionalcommits.org).
### Contributing
> See [CONTRIBUTING.md](./CONTRIBUTING.md).
### Versioning
> See [PEP 440](https://www.python.org/dev/peps/pep-0440/).
### Thanks
- [veggero/tytg](https://github.com/veggero/tytg) for giving me the idea of developing a simple framework with which you can code a folder-like bot.
- [bakhoraliev](https://github.com/bakhoraliev) for letting me understand that an object-oriented library would make the difference in developing this project.### Branding
> See [hearot/pyrubrum-assets](https://github.com/hearot/pyrubrum-assets).
### Copyright & License
- Copyright (C) 2020 [Hearot](https://github.com/hearot).
- Licensed under the terms of the [GNU General Public License v3 (GPLv3)](./LICENSE).