Random-Image Telegram Bot
A Telegram bot that serves random images from SQLite, with categories and interactive buttons, deployable via Docker or Render.
Project Summary
An educational open-source bot demonstrating a clean Telegram-bot structure: menus, buttons, an image database, and Docker packaging.
The Problem
Managing and sharing an image library with a small team or audience quickly turns messy: scattered files, duplicates, and no reliable way to know what has been sent and what has not. Simple bots solve sending and leave the organising problem entirely unsolved.
The Telegram random-image bot was built on an SQLite database to give an organised archive rather than a folder dump: every image is identified in the database, send state is known, and commands are limited to the admin.
Key Features
Interactive buttons
Inline menus for category selection.
SQLite image database
Lightweight and easy to back up.
Docker-ready
Dockerfile + quick Render deployment.
Technical Challenges & Design Decisions
- Organising, not sending: the real challenge was the index — a portable SQLite database that identifies every image and prevents sending the same one twice in a cycle.
- Response speed: slow replies ruin a bot experience. Queries are light and indexed so the user never waits for a lookup.
- Permissions: add and delete commands are restricted to the admin, because a bot with open permissions becomes a misuse vector.
- Maintenance without downtime: adding new images to the database and taking backups requires no restart or redeployment.
Technical Architecture
Testing Methodology
- Testing each core command and its response for every input case, including invalid input.
- Confirming no image repeats within a single cycle and that random selection covers the whole database.
- Testing behaviour when images run out or the database is empty, instead of crashing or going silent.
- Testing unauthorised access to admin commands to confirm rejection.
- Measuring response time under several concurrent requests.
Outcome & Impact
- A structured image archive in a portable database instead of unfiled loose files.
- Random delivery with no repeats inside a cycle and consistent bot responsiveness.
- Clear permissions: the admin manages, users only receive.
- A small public repository that serves as a template for anyone building a bot for their own archive.