Skip to content

Unity-Developer-Community/UDC-Bot

 
 

Repository files navigation

UDC-Bot

A Discord.NET bot made for the server Unity Developer Community Join us on Discord !

The code is provided as-is and there will be no guaranteed support to help make it run.

Table Of Contents

Compiling

Dependencies

To successfully compile you will need the following.

NOTE: It is highly recommended to install docker and docker-compose to run at least the database in a container for local development.

Running

Once the above has been done, you'll need to setup a few additional things to get the bot to a functional point.

  • Copy the "Server" folder to the build location. If you run the bot, it'll inform you where that location is as an error.
  • Copy the "Settings" to the Server folder, without the "Deserialized" folder.
  • Make another copy of the "Settings.example.json" and rename it to "Settings.json"
  • Walk through the new "Settings.json" file and ensure the Bot Token and "DbConnectionString" have been set.

Several comments have been placed throughout the settings file to indicate what needs changing as well as the settings which aren't currently used.

If you plan on running the bot outside of the IDE, you will want to give Discord Net Deployment a read.

Docker

Running docker should be as simple as running docker-compose up in the root directory of the project. This will use the docker-compose.yml file to build the bot and database images and run them. You may need to change the DbConnectionString in the settings.json file to match the docker-compose.yml file configuration.

Note: Docker will also create an image of the bot, it may be much quicker to run the bot yourself from the IDE if you're making changes. You can also use docker-compose up --build to force a rebuild of the bot image, but I would advise to disable the bot in the docker-compose.yml file, and run the bot from the IDE.

Runtime Dependencies

If you choose to not use docker, you will need to host the database yourself and ensure the bot can connect to it. You will need an accessible SQL database setup, the easiest way to do this is using XAMPP which can host the database and make it easier to setup.

If you run the bot now, it will attempt to generate the table for the database. Depending on the permisions of the user, it may fail. You can get around by importing one of the tables below through phpmyadmin.

  • Emptyusers.sql An empty table that only creates the database structure. (Not yet)
  • Mockusers.sql A table that creates the database structure, but contains some mock user data as well. (Not yet)

Once you have imported the database, be sure to create a user in phpmyadmin which can access the database, and the details match your DbConnectionString.

On Linux you might need sudo apt install ttf-mscorefonts-installer for ImageMagick.

Notes

Logging

The bot does attempt to log issues it runs into during startup, not everything is covered yet and a lot of it is stripped from the release build. A basic Enum is used, Critical/Error uses Red, Warning uses Yellow, Info is White and Verbose/Debug is Gray. (LoggingService)

During startup, if you see any yellow/red, good chance something is wrong.

Discord.Net

I strongly suggest giving Discord.Net API Documention a read when interacting with systems you haven't seen before. Discord Net uses Tasks, Asynchronous Patterns and heavy use of Polymorphism, some systems might not always be straight forward.

FAQ

None yet, ask some, I might add them, additional help isn't garenteed. get gud

Packages

 
 
 

Languages

  • C# 93.5%
  • HTML 6.3%
  • Dockerfile 0.2%