SpTubeBot is a high-performance Telegram bot developed in Go using the gotdbot library. It provides advanced media downloading capabilities for various platforms, mathematical expression evaluation, and a unique bot cloning system.
- Multi-Platform Media Downloader: Supports downloading content from YouTube (Regular and Shorts), Instagram, TikTok, Pinterest, X (Twitter), Facebook, Threads, Twitch, Reddit, and Snapchat.
- Music Downloader Support: Automatically detects and downloads music from Spotify, SoundCloud, JioSaavn, and Tidal. It fetches track metadata and high-quality audio files.
- YouTube Optimization: Automatically detects YouTube links. Regular videos are delivered as M4A audio by default, while Shorts are delivered as MP4 videos.
- Bot Cloning System: Users can create their own instances of the bot by forwarding a message containing a bot token from @BotFather.
- Mathematical Evaluation: Evaluates complex mathematical expressions via a dedicated command.
- Inline Query Support: Allows users to search and share media directly in any chat using inline queries.
- Dockerized Architecture: Simplified deployment using Docker and Docker Compose.
- Go 1.25.6 or higher
- MongoDB instance
yt-dlp(nightly builds recommended)ffmpeg- Telegram API ID and API Hash
- Telegram Bot Token
The application requires the following environment variables. You can use the sample.env as a template.
| Variable | Description |
|---|---|
API_ID |
Telegram API ID from my.telegram.org |
API_HASH |
Telegram API Hash from my.telegram.org |
API_KEY |
RapidAPI or internal service key for media extraction |
TOKEN |
Primary bot token from @BotFather |
MONGO_URL |
MongoDB connection string |
API_URL |
(Optional) Custom API endpoint for media extraction |
OWNER_ID |
(Optional) Telegram User ID of the bot owner |
-
Clone the repository:
git clone https://github.com/FallenProjects/SpTubeBot cd SpTubeBot -
Create and configure your
.envfile:cp sample.env .env # Edit .env with your credentials -
Build and start the container:
docker-compose up -d --build
- Ensure
yt-dlpandffmpegare installed and available in your system's PATH. - Install the required
libtdjsonlibrary:go generate
- Build the application:
go build -o main . - Run the binary:
./main
/start- Initialize interaction with the bot./ping- Check system status, latency, and uptime./yt <url>- Download a specific YouTube link as a high-quality video./math <expression>- Evaluate a mathematical expression (e.g.,/math 2+2)./stop- Stop a cloned instance and remove the token from the database (Owner only).
To clone the bot:
- Message @BotFather and create a new bot.
- Forward the message containing the API token to the primary SpTubeBot instance.
- The system will automatically register a new client and persist the configuration in MongoDB.
- Repository: https://github.com/FallenProjects/SpTubeBot
- Support: Join @FallenProjects
- API: https://api.fallenapi.fun
This project is licensed under the MIT License - see the LICENSE file for details.