Install Visual Studio and .NET 5. It's also possible to use VS Code or another IDE that supports C# development (JetBrains Rider, for example).
wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update;
sudo apt-get install -y apt-transport-https;
sudo apt-get update;
sudo apt-get install -y dotnet-sdk-5.0;
sudo dnf install dotnet-sdk-5.0
https://docs.microsoft.com/en-US/dotnet/core/install/macos
- Create an app on the Discord Developer portal and retrieve a token from the Bot section.
- Create a copy of
appsettings.json
and name itappsettings.Development.json
. - Fill your bot token into
appsettings.Development.json
. - Run the application either in an IDE (VS, VSC, Rider, ...) or via the command prompt:
dotnet run --project <path_to_src/Inkluzitron>
Using Docker is recommended for production deployment. All files necessary can be found in the src
directory.
- Enter the
src/
directory (cd src/
). - Create a copy of the
environment.template.env
file namedenvironment.env
, and fill the required values inside. - Run
docker-compose up
. The bot should be automatically built and run.
Prepare your environment file (first two steps in section Local build), and then run these commands:
docker pull misha12/inkluzitron
docker run -d --name Inkluzitron --env-file '/path/to/environment/environment.env' misha12/inkluzitron
src/
- Source code.Inkluzitron
– Directory containing project.bin/
– Binaries.obj/
– You don't need to know.Data/
- Classes that constitute the bot's data model.Migrations/
- Code responsible for updating the database schema. It is generated automatically, do not edit these files manually.Extensions/
– Extension methods that can make your life easier.Handlers/
– Classes and methods for handling events. You're probably not going to need them.Modules/
– Classes and modules that handle commands, reactions, etc. You're mostly going to implement your shiny new code here.Services/
– Support services to make life nicer. You're probably never going to modify these.appsettings.json
– The primary configuration file (and configuration template as well).Inkluzitron.csproj
– The project file.- ... (You can ask the others about the other files.)
.editorconfig
– DO NOT TOUCH!Inkluzitron.sln
– The solution file (this encapsulates the project and this is the file to open in VS or Rider).
README.md
– The thing you are reading right now.README.cs.md
– The thing you are reading right now but in Czech..gitignore
- If you add a new configuration section, remember to include it in
appsettings.json
, so that the others know what you've added and don't have a hard time adjusting their own config files. - Use PRs (pull requests) to add features or make changes. NO ONE may push directly to the
master
branch. - If you are not sure or don't know how to do something, don't be shy about asking others for help.
- Check the console (stdout, stderr) for any logs.
- This project uses a dependency-injection container. It's required by the Discord.NET library.
- If you want to start saving a new entity into the bot's database, you'll need to create an entity class and add it as a property of type
DbSet<TridaNoveEntity>
inData/BotDatabaseContext.cs
. - If you make any changes to the data model (i.e. touch anything in the
Data
) folder, remember to also generate a migration using the below command:You might need to install thedotnet ef migrations add TerseSummaryOfChangesMadeToDataModel
dotnet ef
tool first according to the EF Core documentation. - If you want to add something, just follow these steps (everything should load automatically):
- Create a new class in the
Modules/
directory (and namespace). - Inherit from the
ModuleBase
class. - Enjoy!
- Create a new class in the
- Each module that contains commands will be automatically promoted when the
help
command is called. If you want the commands to display correctly, follow these steps:- Set the
Name
attribute to the class. If theName
attribute is missing, the class name is used. - For each command, you can enter a summary description of the command using the
Summary
attribute. If theSummary
attribute is missing, the string---
will be added instead.
- Set the