This work is licensed under the BSD 2-Clause "Simplified" License.
StickfixBot is a Telegram bot that lets you tag, store, and retrieve stickers more easily.
You can find it at https://t.me/stickfixbot or on Telegram as @stickfixbot.
Core workflow: Reply to a sticker with /add to tag and save it, then retrieve matching stickers later with /get or via inline queries.
This bot is built with python-telegram-bot and uses uv for dependency management.
-
Clone the repository:
git clone https://github.com/r8vnhill/stickfix.git cd stickfix -
Create a token configuration file (
secret.yml— never commit this):token: "YOUR_BOT_TOKEN_HERE"
Obtain your token from @BotFather on Telegram by sending
/newbot. -
Install dependencies and run:
uv sync uv run python bot.py
The bot will create data/users.yaml for storage and logs/stickfix.log for logging automatically.
/add <tags...>— Reply to a sticker to save it with one or more tags/get <tags...>— Retrieve stickers matching all specified tags/deleteFrom <tags...>— Remove a sticker/tag association/setMode <public|private>— Change whether new stickers are stored publicly or privately/shuffle <on|off>— Toggle random ordering of results/deleteMe— Remove your stored data and user account/help— Show usage instructions in Telegram
Python 3.14 or newer — Verify with python --version or install via python.org.
uv — Install globally: python -m pip install --user uv or follow uv installation docs.
Telegram Bot Token — Obtain from @BotFather on Telegram by sending /newbot and following the prompts.
- Create a local bot entry point (
bot.py— gitignored):from bot.stickfix import Stickfix import yaml with open('secret.yml') as f: token = yaml.safe_load(f)['token'] Stickfix(token).run()
Start the bot with:
uv run python bot.pyOn startup, the bot will:
- Create
data/users.yamlfor sticker storage (auto-backed up every 5 minutes) - Create
logs/stickfix.logfor application logs - Listen for commands and inline queries on Telegram
Press Ctrl+C to stop the bot gracefully.
- Open Telegram and search for your bot by username
- Send
/startor/helpto see available commands - Try adding a sticker with
/add tag1 tag2(reply to a sticker) - Test inline queries by typing
@yourbotusername tag1in any chat
When the bot starts, it creates and manages these files in the working directory:
data/users.yaml— All sticker data, backed up automatically every 5 minuteslogs/stickfix.log— Application logs and debug output
Warning
secret.yml and any local launcher scripts (like bot.py) must never be committed to version control.
Stickfix is organized around a clean-layered architecture with inward-only dependencies:
- Telegram handlers and other interface adapters depend on the application layer.
- Application layer owns request/result DTOs, application errors, and outbound ports.
- Domain models hold sticker and user rules without Telegram-specific concerns.
- Infrastructure adapters implement application ports without exposing YAML or filesystem details.
The current architecture introduces an explicit application seam:
bot.application.requestsdefines transport-agnostic request DTOs.bot.application.resultsdefines result types for successful application flows.bot.application.errorsdefines Telegram-free application failures.bot.application.ports.user_repository.UserRepositorydefines the first outbound repository port.bot.domain.services.StickerPackServicecentralizes Telegram-free sticker pack resolution and mutation for the extracted sticker commands.
Handlers and runtime wiring currently preserve the existing behavior and YAML persistence model. /setMode, /add, /get, and /deleteFrom now execute through application use cases while handlers remain responsible for Telegram-specific parsing and replies.
- Install
uvglobally (e.g.,python -m pip install --user uvor see uv docs). - Run
uv syncfrom the repo root to create or refresh the locked virtual environment defined byuv.lock. - When the dependency graph changes, update it with
uv lockand commit bothpyproject.tomland the regenerateduv.lock.
Ensure uv is pointing to a Python 3.14 or newer interpreter (uv python list/uv python use).
uv run ruff check— run lint rules and formatting checks defined inruff.toml.uv run ruff format— autoformat files that need cleanup.uv run pytest— execute the test suite (or pass-- -k <pattern>for subsets).uv run python -m bot.stickfix— run the bot or other scripts inside the locked environment.
For CI/CD configuration, optional database and graph extras, and legacy tooling migration, see CONTRIBUTING.md.
- Import errors: Run
uv syncto ensure all dependencies are installed. - Token errors: Verify your token in
secret.ymlmatches the one from BotFather. - Permission errors: Ensure
data/andlogs/directories are writable. - Bot not responding: Check
logs/stickfix.logfor error messages.