JsonTelegramBot
Build lightweight Telegram bots from JSON configuration in Python. JsonTelegramBot is a configuration-driven wrapper around
Features
- Configure Telegram bot handlers with a Python dictionary or a JSON file.
- Reply to commands and text messages without writing repetitive handler code.
- Add an explicit
"*"wildcard response for otherwise unhandled text. - Handle inline callback data with
inline-messages. - Send a configured response to a specific Telegram user ID.
- Generate equivalent
osonbotPython code. - MIT licensed and compatible with Python 3.10 and newer.
Installation
pip install json-telegram-bot
Usage
from JSONTelegramBot import JsonBot
JsonBot("token", {
"messages": {
"/start": {"response": "hello *{first_name}*", "parse_mode": "MarkdownV2"},
"/help": {"response": "Hello how can i help you"}
}
}).run()
Generate osonbot code
Generate standalone Python code for the supported osonbot library:
from JSONTelegramBot import JsonBot
JsonBot("token", {
"messages": {
"/start": {"response": "hello *{first_name}*", "parse_mode": "MarkdownV2"},
"/help": {"response": "Hello how can i help you"}
}
}).generate_code(library="osonbot", file="main.py")
Handling inline callback messages
from JSONTelegramBot import JsonBot
JsonBot("token", {
"inline-messages": {
"callback_data1": {"response": "you clicked the first inline button"},
"callback_data2": {"response": "you clicked the sedond inline button"}
}
}).run()
Send message to specific user by their Telegram ID
from JSONTelegramBot import JsonBot
JsonBot("token", {
"messages": {
"/start": {"response": "hello *{first_name}*", "parse_mode": "MarkdownV2"},
"/send": {"id": 123456789, "response": "This is a message for a specific user"}
}
}).run()
License
JsonTelegramBot is released under the MIT License.
Metadata
Release files for json-telegram-bot 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| json_telegram_bot-0.1.2.tar.gz | 4.7 kB | Without provenance | Details for json_telegram_bot-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| json_telegram_bot-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for json_telegram_bot-0.1.2-py3-none-any.whl |
Total release size: 9.8 kB
Release files / json_telegram_bot-0.1.2.tar.gz
| Download URL | json_telegram_bot-0.1.2.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a44b10d78600d6893e4b1845dae11d0c41a8f780f2a045a168c36ff7774c0f03
|
|
BLAKE2b-256 checksum How to use checksums |
46b25c1ad9fd322dc95b332fc4f21f57fb8c42a492bd10fff37e235509e64fbe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.0
|
Release files / json_telegram_bot-0.1.2-py3-none-any.whl
| Download URL | json_telegram_bot-0.1.2-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6503b50992a7d5e12c5129ee1f8ac32672f19e90acc28bb12d9899d63061916f
|
|
BLAKE2b-256 checksum How to use checksums |
35521f75781b66667d471e8880b97225d93b33a272af8fd45cfc1d55dd7e2e1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.0
|
Security for json-telegram-bot 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.