Folds
Folds is an elegant and scalable framework for bots, wrapping Telethon library.
- Easy to read for humans and agents.
- Designed to avoid boilerplate and ugly code.
- Supports all niche Telegram features.
- Built with Telegram API without Bot API — I explain it below.
from folds import Bot, Message, ThisSender
bot = Bot(bot_token, api_id, api_hash)
@bot.added_to_group
async def handle_added():
return 'Hello!'
@bot.group_commands.help
async def handle_help_command():
return 'You called for /help?'
@bot.group_commands.hello
async def handle_hello_command(message: Message, user: ThisSender):
await message.reply('Hmm!')
await message.reply(f'Hello, {user.first_name}')
bot.run()
Built with Telegram API
Folds is built on top of Telethon, a Telegram API library. This means Folds doesn't use Bot API.
Pros
- No limitations. Folds doesn't have natural limitations that Bot API has: see the API explanation and the comparison table from the Papercraft Book for details.
- Reuse code for userbots. When you are familiar with Telethon concepts, you can not only program bots with Folds but also program user accounts. In particular, our Telegram script tool named TGPy is also based on Telethon.
Cons
- Setting up requires a little extra step.
Should I use it?
The framework is in its early version, and the features will change, so...
For small hobby bots — yes. For big complex projects — also yes, but better come back later! I will appreciate if you show your interest by leaving a star on the repo.
Learn
Here is how to get familiar with Folds:
- Read the docs, of course. I tried to make them friendly!
- Read the Telethon docs because Folds bases on Telethon.
- For specific features, read the Papercraft Book, my book on developing Telegram bots. It includes code examples for Folds.
Getting Started
Head over to Quick Start.
Metadata
Release files for folds 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| folds-0.3.0.tar.gz | 97.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| folds-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 119.5 kB
Release files / folds-0.3.0.tar.gz
| Download URL | folds-0.3.0.tar.gz |
|---|---|
| Size | 97.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
35f4bd8117045098b121fed09d1b017e0b1bfcdcfdf00f9547ee3ae11fb16528
|
|
BLAKE2b-256 checksum How to use checksums |
03be0586562ca81191da6b05149594faccd4675988e05a98d682595b256709ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / folds-0.3.0-py3-none-any.whl
| Download URL | folds-0.3.0-py3-none-any.whl |
|---|---|
| Size | 21.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a615d7c40a789436178451005bb02c521a18f61ae596037140c0b82a9baba40b
|
|
BLAKE2b-256 checksum How to use checksums |
8b776db7eea6be304f0f0e27fa939f4b7c7e55e51d551168843b4f6bb1b598b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|