Telegram bot that receives music files, optionally publishes lyrics to Telegraph, and posts curated tracks to a channel.
- Accepts music via direct upload or forwarded messages
- Prompts for lyrics (with skip option) and creates a Telegraph page when provided
- Collects hashtags and builds a formatted caption
- Sends a preview to the user before publishing
- Publishes to a configured channel after confirmation
- Python 3.12+
- A Telegram bot token (@BotFather)
- A Telegram channel where the bot is an admin
- Clone the repository and create a virtual environment:
python -m venv .venv
.venv\Scripts\activate # Windows
# source .venv/bin/activate # Linux/macOS- Install dependencies:
pip install -r requirements.txt
pip install -e . -i https://pypi.org/simpleIf editable install fails due to network issues, run with:
set PYTHONPATH=src # Windows
# export PYTHONPATH=src # Linux/macOS
python -m lyrabot- Copy the example environment file and fill in your values:
copy .env.example .env # Windows
# cp .env.example .env # Linux/macOS| Variable | Description |
|---|---|
BOT_TOKEN |
Telegram bot token |
CHANNEL_ID |
Channel ID (-100…) or @username |
CHANNEL_NAME |
Name shown in captions (e.g. @mychannel) |
TELEGRAPH_ACCESS_TOKEN |
Optional; created automatically on first run |
TELEGRAPH_SHORT_NAME |
Short name for Telegraph account creation |
TELEGRAPH_AUTHOR_NAME |
Author name on Telegraph pages |
- Run the bot:
lyrabot
# or
python -m lyrabot- Send
/startor directly send a music file - Paste lyrics or tap Skip lyrics
- Send hashtags (e.g.
#pop #iran) - Review the preview and tap Publish or Cancel
Use /cancel at any time to abort the current session.
src/lyrabot/
├── __main__.py # Entry point
├── config.py # Settings via pydantic-settings
├── bot/
│ ├── app.py # Handler registration
│ ├── keyboards.py # Inline keyboards
│ ├── states.py # Conversation states
│ └── handlers/ # Step-by-step handlers
├── models/
│ └── track.py # Track data model
└── services/
├── caption.py # Caption builder
└── telegraph.py # Telegraph page creation
MIT