Skip to content

lelextb/telegram-autonomous-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🤖 Telegram Autonomous Bot – High Concurrency, Reminders, Fuzzing

Python Telethon PostgreSQL Fuzzing

An autonomous, production‑ready Telegram bot built with Telethon.
Handles ≥100 concurrent updates, per‑user rate limiting, scheduled reminders (DM), command logging, and continuous fuzzing integration (Hypothesis + AFL).
Packaged as Snap and Flatpak for Linux desktop.

✨ Features

  • High concurrency – async Telethon, handles 100+ events simultaneously.
  • ⏲️ Per‑user rate limiting – sliding window (5 commands / 10 sec).
  • Reminder system – set reminders via /remind, get DM notifications.
  • 📊 Command logging – all commands stored in PostgreSQL (shared with dashboard).
  • 🔥 Continuous fuzzing – Hypothesis property‑based tests + AFL harness.
  • 📦 Snap / Flatpak – easy desktop installation (recipes included).
  • 🛡️ Error resilient – automatic retries, graceful shutdown.

🚀 Quick Start (Local)

Prerequisites

  • Python 3.11+
  • PostgreSQL 14+ (shared with dashboard)
  • Telegram API credentials (my.telegram.org)

Setup

git clone https://github.com/lelextb/telegram-autonomous-bot.git
cd telegram-autonomous-bot
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env   # fill API_ID, API_HASH, BOT_TOKEN, DATABASE_URL
python -m bot.main

Database

The bot expects a PostgreSQL database with tables:

  • command_logs
  • reminders
  • moderation_rules

Run the migrations from the dashboard repository.

🧪 Fuzzing

# Hypothesis fuzzing
python -m bot.main --fuzz

# AFL++ (requires afl‑gcc)
afl-fuzz -i fuzzing/inputs -o fuzzing/findings -- python fuzzing/afl_harness.py @@

📦 Packaging

  • Snap: snapcraftsudo snap install --dangerous telegram-bot_*.snap
  • Flatpak: flatpak-builder build-dir flatpak/org.example.bot.yml --force-clean

🐳 Docker (optional)

docker build -t telegram-bot .
docker run --env-file .env telegram-bot

📈 Integration with Dashboard

The bot writes to the same PostgreSQL database used by the dashboard.
Once the dashboard is running, you will see:

  • Command heatmap
  • Hourly analytics
  • Active reminders (cancel from dashboard)
  • Moderation rules (bot reads them automatically)

📝 License

MIT – free to use and modify.

About

High‑concurrency Telegram bot (Telethon) with rate limiting, reminders, fuzzing, and Snap/Flatpak packaging. Shares database with analytics dashboard.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors