Template project for creating Discord bots with .NET, using the DSharpPlus library. Sample code is completely cross-platform and modular. This repository should also work with with Visual Studio, VS Code, Jetbrains Rider, or the dotnet CLI. Project files for Rider are included.
- Structured logging support
- Configuration options through appsettings.json
- .NET 5
A few basic setup steps are required in order to run the sample bot. These are:
- Register a bot with the Discord Developer Portal, and get an auth / access token.
- Open a terminal / command prompt to the
Main
folder. - Run
dotnet user-secrets init
. - Run
dotnet user-secrets set "DiscordAuth:DiscordToken" "INSERT TOKEN HERE"
, using the token from step 1.
The sample bot responds to bot!hello
with Hello, world!
.
It will not join any servers on its own, so you will need to invite it to a server in the typical way.
Make sure to assign the bot
scope and request permission to send messages.