Sabot is a modular Telegram bot that converts music files into voice messages 🎵, handles file uploads 🗂️, and manages user sessions 🧑💻. It's designed for scalability and ease of use, making it easy to add more features as needed.
- 🎶 Music to Voice Conversion: Converts music files to Telegram voice messages.
- 💾 Session Management: Uses Redis and MongoDB for session storage.
- 📂 File Uploads: Stores user-uploaded music in a
userdata/
folder. - 🔮 Future Features: Planned support for YouTube to MP3, MP3 tag editing, and more.
Before running the bot, ensure you have the following installed:
-
Node.js: Install Node.js from here.
- Verify installation:
node -v
- Verify installation:
-
MongoDB: Install MongoDB from here.
- Verify installation:
mongod --version
- Verify installation:
-
Redis: Install Redis from here.
- Verify installation:
redis-server --version
- Verify installation:
-
FFmpeg: Install FFmpeg from here.
- Verify installation:
ffmpeg -version
- Verify installation:
📦 Project Root
/
├── handler
│ ├── main.js
│ └── music.js
├── server
│ ├── /api
│ │ ├── user.js
│ └── /database
│ ├── post.js
│ ├── users.js
│ ├── db.config.js
│ └── index.js
├── /userdata
├── /utils
│ ├── converter.js
│ ├── downloader.js
│ └── sendVoiceMessage.js
├── .env
├── bot.js
├── colors.config.js
├── redis.config.js
├── responses.js
├── package.json
└── README.md
-
Clone the repository:
git clone https://github.com/your-username/sabot.git cd sabot
-
Install dependencies:
npm install
-
Set up your environment variables: Create a
.env
file in the root directory and add your secrets:TELEGRAM_BOT_TOKEN=your-telegram-bot-token MONGO_URI=mongodb://localhost:27017/sabot REDIS_URL=redis://localhost:6379
-
Start the bot:
npm start
Sabot interacts with users by converting their uploaded music into voice messages. Users upload their favorite songs, and the bot automatically converts them into .ogg
format and sends them back.
To adjust the bot’s functionality, modify the relevant files in the utils/
directory, such as the audio converter settings in convertor.js
.
For example:
// utils/convertor.js
ffmpeg(audioFile)
.audioCodec('libopus')
.audioBitrate(25)
.audioChannels(1)
.audioFrequency(48000)
.toFormat('ogg')
.save(outputFilePath);
Sabot uses Redis and MongoDB to securely store session data and user information.
- Redis configuration:
redis.config.js
- MongoDB models:
server/user.js
- Convert music files to Telegram voice messages.
- Add YouTube to MP3 converter.
- Schedule posts to Telegram channels.
- Edit MP3 tags on uploaded files.
Feel free to contribute! Fork the repo, make your changes, and submit a pull request. All contributions are welcome.
This project is licensed under the MIT License. See the LICENSE file for details.