This part is about how to run bot depending on enviroment used.
Before trying to run you need to aquire token from Discord.
Project supports use of Seq server which can be run locally or remotly for storing logs.
Here are the steps to use a deployable version of DiscordBot. Default Docker Hub image can be found here
Running in docker requires setting important environmental variables as well as some volumes for files that should be accessible after shutdown of container.
Variables marked with Seq server are referenced to different image for running Seq toghether with DiscordBot more details here
Enviroment variables:
| Name | Value | Required | Purpose |
|---|---|---|---|
| TOKEN | string (long chain) | X | Discord bot token can't be run without it. |
| SEQ_URL | string (url) | Seq application url, local or remote | |
| SEQ_KEY | string (long chain) | Key used for connection to seq | |
| ACCEPT_EULA | Y or N (single char) | Seq server container acceptance of eula if run with DiscordBot together |
Volumes:
| Name | Container Path | Required | Purpose |
|---|---|---|---|
| Audio | /app/audio |
X | All sounds files are stored here |
| Data | /app/data |
Database file is stored here with all servers configurations | |
| Seq/logs | /data |
Seq server container data folder for logs storage if run with DiscordBot together |
Pulling and running container can be done using command below, simply place the TOKEN and name, and set the volume path in PWD.
docker run --rm -d -e "TOKEN=<discord app client secret here>" --name <name> -v <PWD>/audio:/app/audio seker212/discord_bot:2.0Use provided docker-compose-template.yaml and rename it to docker-compose.yaml. Or create your own docker-compose.yaml file based on example below and enviroment variables. Replace required values and run by using docker compose up -d command for Docker v2 or docker-compose up -d for v1.
version: "3.9"
services:
DiscordBot:
image: seker212/discord_bot:2.0
environment:
# Set this a discord token generated on discord page
- TOKEN=0
volumes:
# Where audio files from sound commands should be placed
- ./audio:/app/audio
For running locally it is required to install in your system .Net 6. For managing project Visual Studio is recommended but any editor will do with sufficient knowledge.
Before running the project, ffmpeg should be added to PATH (available from cli) if any music/sound related commands will be run. Additionally yt-dlp also needs to be added for commands connected to YouTube servicer will be used.
Steps:
- Clone this repo with checkout to branch
master-2.0. - Open
DiscordBot.slnwith Visual studio (or editor of your choice) - Place
token.txtfile in main folder with token aqured earlier. - Run the
DiscordBotproject
If there are some issues with packages try reimporting NuGet.
Here are stored important informations for debugging and development of bot.
Here are table schemase currently implemented. Detailed short names:
- PK -> Primary key
- FK -> Foreign key
- NN -> Not null
- AI -> Auto increment
Config table
| Name | Type | PK | FK | NN | AI |
|---|---|---|---|---|---|
| Id | Integer | X | X | X | |
| GuildId | Text | ||||
| ParameterName | Text | ||||
| ParameterValue | Text |
Responses table
| Name | Type | PK | FK | NN | AI |
|---|---|---|---|---|---|
| Id | Integer | X | X | X | |
| GuildId | Text | ||||
| Response | Text |
Facts table
| Name | Type | PK | FK | NN | AI |
|---|---|---|---|---|---|
| Id | Integer | X | X | X | |
| GuildId | Text | ||||
| Fact | Text |