https://github.com/mhewedy/telebot
Telegram bot library abstraction on top of python-telegram-bot
https://github.com/mhewedy/telebot
telebot telegram telegram-bot
Last synced: about 1 year ago
JSON representation
Telegram bot library abstraction on top of python-telegram-bot
- Host: GitHub
- URL: https://github.com/mhewedy/telebot
- Owner: mhewedy
- Created: 2024-05-16T12:26:57.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-05-25T11:43:52.000Z (about 2 years ago)
- Last Synced: 2025-03-31T11:11:37.027Z (about 1 year ago)
- Topics: telebot, telegram, telegram-bot
- Language: Python
- Homepage:
- Size: 19.5 KB
- Stars: 10
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Telebot
Telegram bot library abstraction on top
of [python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot)
## Features
Help you to get started quickly by providing decorators `@command` and `@job`
## Install
```bash
pip install --upgrade --force-reinstall git+https://github.com/mhewedy/telebot
```
### Example:
```python
bot = BotApp()
@bot.command(text=True)
async def echo(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
await update.message.reply_text(update.message.text)
@bot.command(name="ping", desc="test the bot")
async def ping(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
await update.message.reply_text("Pong!")
@bot.job(time="08:00", enabled=False)
async def hell_timer(context: ContextTypes.DEFAULT_TYPE, chat_id):
await context.bot.send_message(chat_id, text="hello from timer")
@bot.job(interval=5, enabled=True)
async def hello_interval(context: ContextTypes.DEFAULT_TYPE, chat_id):
await context.bot.send_message(chat_id, text="hello from interval")
```
see example.py for the whole running example