A Discord music with some specific features and tweaks for use on a personal server.
The project is an Hosted Service interacting with Lavalink to search and interact with media. IaC Bicep templates are included for Azure deployment.
The Bot service host needs to establish a connection to a Lavalink server to start properly.
The lavalink server can be started either manually by executing the .jar
java executable or using Docker compose to start both images (Bot and Lavalink).
This section assumes Docker is used to start the Bot and its dependency.
- Ensure .NET 8 Sdk is installed
- Ensure Docker is installed and running.
- Create a Discord App and generate a bot token at Discord Developer.
- Connect Bot to a server
- Permissions include: [Slash Commands, Send Messages, Connect, Speak]
- To test track search from Spotify, an Spotify Application must be created with a generated client secret Spotify Developer.
⚠️ Note: Spotify source is a track search source, not a streaming source. Music streaming of Spotify tracks still requires Youtube as a source.
- To limit Youtube API blocks on bots, a "Proof of Origin Token" may be generated and passed into config and help limiting 403 errors. See Lavalink Youtube Plugin
-
Create a Discord App and generate a bot token at Discord Developer.
-
Clone the repo
git clone https://github.com/hmathieu31/Discord.BotABordelV2.git
-
In
Lavalink
, copy.env.template
into.env
and fill with your configuration. -
Pull and Run Lavalink image
docker pull ghcr.io/lavalink-devs/lavalink:4
At repository root, run
docker run -d \ --name lavalink \ --restart unless-stopped \ -e _JAVA_OPTIONS="-Xmx6G" \ --env-file ./Lavalink/.env \ -v $(pwd)/Lavalink/application.yml:/opt/Lavalink/application.yml \ -p 2333:2333 \ ghcr.io/lavalink-devs/lavalink:<lavalink-version>
-
Enter your generated token in User Secrets (In Visual Studio, VS Code with extension, or through environment variables) and add lavalink config
{ "DiscordBot:Token": "your bot token", "Lavalink:Password": "youshallnotpass" }
-
Build Bot
dotnet build