Here's a basic example to get started with tgram:
from tgram import TgBot, filters
from tgram.types import Message
bot = TgBot("YOUR_BOT_TOKEN")
@bot.on_message(filters.text & filters.private)
async def on_message(bot: TgBot, message: Message) -> Message:
# Echo the incoming message
return await message.reply_text(
message.text,
entities=message.entities
)
bot.run()
- Smart Plugins: Auto-loadable plugins for modular development.
- Filters for Handlers: Simplify event handling with filters.
- Bound Methods: Access bound methods for different update types easily.
Full documentation is available here.
You can install the tgram library using one of the following methods:
pip install git+https://github.com/z44d/tgram -U
pip install tgram -U
- Python: Version 3.8 or higher.
- Telegram Bot Token: Obtain one by following this guide.
- For general questions and help, join our Telegram chat.
- Follow updates via the Telegram Channel.