Bot Telegram con Python
PythonTelegramAPIAutomation
Descrizione
Bot Telegram creato con Python che automaizza diverse attività come promemoria, query di informazioni e gestione delle notifiche. Utilizza l’API di Telegram e vari servizi esterni.
Funzionalità Principali
- Promemoria programmati con cron job
- Query meteo usando API esterne
- Gestione attività con comandi semplici
- Notifiche personalizzate per eventi
- Logging attività per il debugging
Tecnologie
| Tecnologia | Utilizzo |
|---|---|
| Python 3.11 | Linguaggio principale |
| python-telegram-bot | API Telegram |
| SQLAlchemy | Database |
| APScheduler | Attività programmate |
| HTTPX | Richieste HTTP |
Struttura del Progetto
# Esempio di comando del bot
@dp.message_handler(commands=['start'])
async def start(message: types.Message):
await message.reply(
"Ciao! Sono il tuo bot personale.\n"
"Usa /help per vedere i comandi disponibili."
)
Installazione
# Clona il repository
git clone https://github.com/sergio/telegram-bot.git
cd telegram-bot
# Installa le dipendenze
pip install -r requirements.txt
# Configura le variabili d'ambiente
cp .env.example .env
# Esegui
python bot.py
Apprendimento
Questo progetto mi ha aiutato ad approfondire:
- Programmazione asincrona in Python
- Lavoro con API esterne
- Design di bot conversazionali