A powerful and customizable Discord music bot built using Lavalink and Lavalink4NET, designed to bring seamless music playback, EQ control, and audio filtering to your Discord server.
- Play music from YouTube, SoundCloud, and other sources.
- Advanced Equalizer (EQ) and audio filters support.
- Commands for track management (Play, Pause, Stop, Skip, etc.).
- Automatic status updates for the currently playing song.
- Integrated OAuth support for YouTube access.
- Persistent configuration using
application.ymlandConstants.cs.
.
├── Dockerfile # Docker setup for containerized deployment
├── docker-compose.yml # Compose file for multi-container orchestration
├── application.yml # Lavalink configuration (must be created)
├── src/
│ ├── AudioModule.cs # Core music commands and audio logic
│ ├── Constants.cs # Bot constants (e.g., tokens, IDs)
│ └── Program.cs # Main entry point for the bot
└── plugins/ # Lavalink plugins (optional)
Before running the bot, ensure you have the following:
- Lavalink: A self-hosted audio service.
- Docker and Docker Compose (for containerized deployment).
- application.yml: Required for configuring Lavalink.
This configuration file is essential for Lavalink. It must be placed in the root directory (same level as docker-compose.yml).
Example content:
server:
port: 2333
address: 0.0.0.0
plugins:
youtube:
enabled: true
oauth:
enabled: true
clients:
- "WEB"
token: "your-token-here"
lavalink:
server:
password: "youshallnotpass"Create a Constants.cs file in the src/ directory to store sensitive data like tokens and API keys.
namespace mlean
{
public static class Constants
{
public const string BotToken = "your-bot-token";
public const ulong GuildId = 123456789012345678; // Example Guild ID
}
}docker-compose builddocker-compose up -dThis command will start both the Lavalink service and the mLean bot in detached mode.
Use the following commands to check logs:
docker logs lavalink
docker logs mleanThe bot and Lavalink services rely on several environment variables configured in docker-compose.yml:
BOT_PREFIX: Command prefix (default:!).LAVALINK_SERVER_PASSWORD: Lavalink server password (default:youshallnotpass).SERVER_ADDRESS: Address of the Lavalink server (default:http://lavalink).PULSE_SERVER: PulseAudio configuration for sound devices.
Use the bot's prefix (default: !) followed by the command name.
!join: Joins your current voice channel.!leave: Leaves the voice channel.!play <query>: Plays a song or adds it to the queue.!pause: Pauses the current track.!resume: Resumes playback.!skip: Skips the current song.!stop: Stops the music and clears the queue.
!show-filters: Displays the status of all audio filters.!screw-it: Toggles the Screw-It mode.!timescale <speed> <pitch> <rate>: Adjusts the playback timescale.!vibrato <frequency> <depth>: Applies or disables the vibrato filter.
!set-eq <band>:<gain>: Adjusts the gain of a specific EQ band.!set-eq-all <gain>: Sets all EQ bands to the same gain.!show-eq: Displays the current EQ settings visually.!reset-equalizer: Resets the EQ to default settings.
- Ensure
application.ymlis correctly mounted and accessible. - Check that the Java options are correctly set in
docker-compose.yml.
- Verify that the Lavalink service is running on port 2333.
- Ensure the password matches between the bot and
application.yml.
git clone https://github.com/yourusername/mlean-bot.git
cd mlean-botdotnet restoreMake sure Lavalink is running, then:
dotnet run --project src/mlean.csprojWe welcome contributions! To get started:
- Fork the repository.
- Create a new branch:
git checkout -b feature/your-feature. - Commit your changes:
git commit -m 'Add some feature'. - Push to the branch:
git push origin feature/your-feature. - Submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Lavalink - Audio streaming server.
- Discord.Net - .NET wrapper for the Discord API.
- Lavalink4NET - Lavalink client for .NET.
Feel free to copy, modify, and share this template. Let us know if you encounter any issues! 🎶
This README.md ensures the repository is well-documented, covering all aspects from setup to usage and troubleshooting.