Skip to content
/ Silk Public
forked from VelvetToroyashi/Silk

Simple to use, effective, and blazing fast! All in C# too. Open to PRs, features added regularly.

Notifications You must be signed in to change notification settings

mwerschy/Silk

 
 

Repository files navigation

Silk!

Silk is a simple, and, the fastest Discord bot written in C# until proven otherwise. Built on top of DSharpPlus for Discord API interactions. The goal of Silk! is be not only a great bot, but fill in the gaps that certain bots have. A bot your members will want to use, while not being a cookie-cutter game, moderation, or entertainment bot. Silk! is also made with large guilds in mind. Feel free to join the Silk! server to ask any questions you may have or any general support you may need. Want this bot on your server? Feel free to invite it!

CodeQuality CodeSize Lines of code GitHub closed issues Discord



Development

Silk! Is an open source bot, obviously, and if you know C#, you're more than welcome to contribute! If you're on the server, and your PR gets merged, you get a nice light blue role on the server to signify your contributions. Active contributors are given a special role as well.

Resources

Database

Silk uses PostgreSQL for its backend database store. So if you don't have PostgreSQL installed, make sure to install it before trying to run the Visual Studio solution.

Configuration / Secrets Management

  • To manage storage of the needed Discord Token and Database Connection String, Silk uses an appSettings.json file.

Default

  1. When you clone Silk, before running the Visual Studio solution, you'll need to create this appSettings.json file in the following directory: Silk\Silk.Core

  2. Now that the configuration file has been created, you'll need to fill out the structure:

    • {
         "ConnectionStrings": {
            "dbConnection": "",
            "BotToken": ""
         }
      }
      
    • For the dbConnection property, in the double quotes, add your connection string.

      • Note: The PostgreSQL connection string will look something like this: Server=;Database=;Username=;Password=
    • For the BotToken property, in the double quotes, add your Discord Bot Token.

      • If you don't have your token off-hand, you can get it from the Discord Developer Portal; Select your application once logged in, then select Bot in the menu, and you should be able to Reveal your token from there.

App Secrets

  • The alternative, and more recommended (but still NOT suitable for Production) for managing the configuration file is using User Secrets

  • The great advantage of using User Secrets, is that the file is stored in a separate location from the project tree, and because of this, secrets also aren't checked into source control.

  1. In Silk's Core project, a UserSecretsId is defined:
    • <UserSecretsId>VelvetThePanda-SilkBot</UserSecretsId>
      
  2. The location of the secrets file is different between Operating Systems, but in a system-protected user profile folder on your computer.
    • Windows: %APPDATA%\Microsoft\UserSecrets\VelvetThePanda-SilkBot\secrets.json
    • Linux / Mac: ~/.microsoft/usersecrets/VelvetThePanda-SilkBot/secrets.json
  3. The structure is the same for the Default - appSettings.json approach
    • Just fill out the skeleton and you're good to go!

Running the Project

  • If you're starting fresh, just cloned the repo, then you'll need to make sure you've done the needed configuration, before running or debugging Silk.

  • If you're already using Silk, you may need to do any or all of the following to ensure that you have everything you need to run the latest and greatest!


Update your PostgeSQL database to the latest migration

  1. If you have dotnet ef command line tools installed, you can run the following command in the src/Silk.Core folder to apply the latest migration

  2. If you're using Visual Studio you can this command using the Package Manager Console



⚠️ A NOTE ABOUT SELF-HOSTING ⚠️

Self-hosting Silk! is easy. Instructions have been provided to self-host locally.

Docker:

To run Silk! as a docker container, you can simply create an appSettings.json file in the root directory, and run docker pull velvetthepanda/silk, assuming you have a postgres database running already. If not, you can download a pre-configured docker-compose file here.

Both Postgres and Silk! will have to initialize on the first run, and if run without the -d flag, you will see an exception thrown as Silk! tries to access tables that don't exist (signifying it needs to migrate). Fear not, running docker-compose up -d again will have Postgres configured, and Silk! will create requisite tables if they do not already exist upon startup.

About

Simple to use, effective, and blazing fast! All in C# too. Open to PRs, features added regularly.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 99.9%
  • Dockerfile 0.1%