Programming Documentation

logo

Programming Documentation

Search
Light Mode
Contact Us

Contact us

No results for your search.
Sorry, an unexpected error occurred

In order to run and test the Discord bot, we first need to initialize the database. The we will first need to create the appsettings.json file.

Copying the Settings Files

After cloning the P1-CSharp-Bot repository, you should have a copy of a folder called HowToGetStarted as well. In this folder there are three JSON files:

These files have the format to use for the appsettings.json file in the corresponding folder. Make a copy of each file and move them to their respective folders located in the Discord Bot folder.

⚠️
Make sure to rename each file to appsettings.json after moving them to their respective directories.

Formatting the Bot Settings File


Formatting the Models Settings File

This is the simplest of the settings files. All you need for this file is the connection string for the SQL database you will be using. The default connection, which can be found in the WebApp settings file, is this:

 "ConnectionString": "Server=localhost; Port=3306; Database=botdb; Uid=root;"






Formatting the WebApp Settings File


Final Steps

Once you have finished formatting the appsettings.json files, please go to the root folder of `P1-CSharp-Bot` in your local machine and run the following command in the terminal of your choice:

dotnet ef database update --project "Discord Bot/Models"






⚠️
If you are getting errors check if your MySQL instance is up. You can use Installing Development Environment section for running MySQL instance.


On This Page