TgBee
TgBee is an asynchronous Python wrapper for the Telegram Bot API. It provides a simple and intuitive interface for creating Telegram bots using modern Python features.
Don't forget to ⭐ the repository on
Features
- Asynchronous API calls using
aiohttp - Easy-to-use decorator-based handler system
- Support for inline keyboards and callback queries
- Plugin system for modular bot development
- FastAPI integration for webhook support
Installation
You can install TgBee using pip:
pip3 install -U TgBee
Example
import asyncio
from TgBee import Client, filters
bot = Client(token="YOUR_BOT_TOKEN")
@bot.on_message(filters.command("start"))
async def start_command(client, message):
reply_markup = {
"inline_keyboard": [
[
{"text": "Button 1", "callback_data": "button1"},
{"text": "Button 2", "callback_data": "button2"}
]
]
}
mention = message.from_user.mention
sent_message = await client.send_message(
chat_id=message.chat.id,
text=f"Welcome {mention} to the bot! Here's a message with some buttons:",
parse_mode="HTML",
reply_markup=reply_markup
)
@bot.on_callback_query()
async def handle_callback(client, callback_query):
callback_query_id = callback_query.id
data = callback_query.data
if data == "button1":
await client.answer_callback_query(callback_query_id=callback_query_id, text="You pressed Button 1!", show_alert=True)
elif data == "button2":
await client.answer_callback_query(callback_query_id=callback_query_id, text="You pressed Button 2!", show_alert=True)
else:
await client.answer_callback_query(callback_query_id=callback_query_id, text="Unknown button pressed", show_alert=True)
async def main():
await bot.run()
if __name__ == "__main__":
asyncio.run(main())
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tgbee-1.1.12.tar.gz
(12.8 kB
view details)
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
tgbee-1.1.12-py3-none-any.whl
(15.3 kB
view details)
TgBee-1.1.12-py3-none-any.whl
(13.1 kB
view details)
File details
Details for the file tgbee-1.1.12.tar.gz.
File metadata
- Download URL: tgbee-1.1.12.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
370b57ee622726f96856716421264846c8c423bc7c72716f81ef391f0713aabd
|
|
| MD5 |
5ef87e470f983a658b26510fe1851aa0
|
|
| BLAKE2b-256 |
bfceb79b20337b21c2f8646f7ff6597409d5107c49860c84bcbdfa25e8ef5ed3
|
File details
Details for the file tgbee-1.1.12-py3-none-any.whl.
File metadata
- Download URL: tgbee-1.1.12-py3-none-any.whl
- Upload date:
- Size: 15.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0055ac0dd6688efd7afb02715fa306c3149edc5b7f7f8cfda34fbcd09571414c
|
|
| MD5 |
486768c968117582c7452e9dd6759cd9
|
|
| BLAKE2b-256 |
c3f3e98bf3ae2d7b5fad822d2ce222c4fd7568e84255184582b960a4fc64aaf8
|
File details
Details for the file TgBee-1.1.12-py3-none-any.whl.
File metadata
- Download URL: TgBee-1.1.12-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87e68b5769a328a31ff565221f063862b6fe925d33b9624439d9dd22c47d06e1
|
|
| MD5 |
c6e9dbbd841c09a34b87e6f296a16284
|
|
| BLAKE2b-256 |
48681370665479eb234aedbb26f320db98b42ce4ea4f27a2f4ed6b82da6c7acc
|