This project tries to replace my old Discord bot called "Aivapt". On one hand I really had to improve my old code so that the bot would run more stable. On the other hand I really wanted use Discord .NET this time instead of discord.py. Therefore I'm using C# and not Python anymore.
The bot offers a wide range of built-in commands. In addition to them you can also create your own commands. I call them
SimpleCommands
. COMMANDS.md contains a small explanation for each command.
First of all you need to create a bot Discord user. You can create your bot on this website. You'll get a unique token which consists of 60 symbols. See credentials for further information. However, you probably want to adjust some permissions. I'm using following permission integer for my bot:
Permission Integer: 2217856064
I'm using user-secrets to store my credentials for development purposes. You need following variables:
Key | Value |
---|---|
AIVAPT__ADMIN_ID | Discord admin-user ID |
AIVAPT__BOT_TOKEN | Discord bot token |
AIVAPT__DB_CONNECTION_STRING | credentials for database connection |
AIVAPT__LAVALINK_PASSWORD | Lavalink server password |
A MariaDB (MySQL should work too) connection is needed. You can find everything you need in the migrations folder. Follow the instructions in credentials for authentication.
The audio module and respectively the whole audio service is based on Lavalink. I'm using a wrapper for Discord .NET called Victoria to play any kind of audio. The bot connects to a local Lavalink server which needs to be configured using a simple configuration file. You can find a more detailed explanation here. Keep in mind that you also need to change the corresponding password. More about it in credentials. I'm already working on an own library that simplifies any voice channel interaction. Once it's finished it'll probably remove Lavalink.
To simplify the deployment process, I created a simple docker-compose file. Using this approach, you need to clone the whole repository to build the Docker image locally. The docker-compose setup includes the Dockerfile of the bot, a MariaDB instance and a Lavalink server. You only need to insert your credentials with an environment file. Then you can start the compose file:
docker-compose up -d
Alternatively you can also pull the latest image right from GitHub's container registry:
docker pull ghcr.io/mapmanagement/aivaptdotnet:master