A .NET 10 Discord bot template built on Discord.Net, ASP.NET Core, dependency injection, typed configuration, slash commands, prefix commands, background services, and a local setup dashboard.
- Slash commands:
/ping,/server,/avatar,/remind - Utility commands:
/userinfo - Polls:
/poll - Moderation:
/mod kick,/mod ban,/mod purge,/mod slowmode - Tags/custom responses:
/tag create,/tag get,/tag list,/tag delete - XP and levels:
/levels rank,/levels leaderboard - Prefix commands:
!ping,!say - Autorole for new members, configured from the dashboard
- Per-server prefix overrides and welcome messages
- In-memory reminder queue with a hosted delivery service
- Rotating bot status messages
- Structured console logging
- Optional environment-variable seeding for deployment
- Optional guild-only slash command registration for fast development
- Local web dashboard for setup and customization
- Create a Discord application and bot in the Discord Developer Portal.
- Enable
MESSAGE CONTENT INTENTfor prefix commands. - Enable
SERVER MEMBERS INTENTfor autorole. - Invite the bot with
botandapplications.commandsscopes. - Run the app and use the dashboard as the main setup surface:
DOTNET_CLI_HOME=.dotnet dotnet runOpen:
http://localhost:5080/dashboard
Save your token, prefix, development guild, status rotation, and autorole settings there. The dashboard writes to
data/settings.json, which is the bot's main runtime config. Restart after saving a new token or changing the
development guild used for slash command registration.
The server selector in the dashboard scopes server-specific pages. Selecting a server loads that server's prefix override, welcome message settings, autorole rules, assignable roles, level leaderboard, and tags. Global settings stay under Setup.
You can still manually edit environment variables for automation or deployment. Env/appsettings values seed
data/settings.json only when that file does not exist yet:
export DNBOT_Discord__Token="your_bot_token"
export DNBOT_Discord__Prefix="!"
export DNBOT_Discord__DevelopmentGuildId="123456789012345678"
export Dashboard__Url="http://localhost:5080"DOTNET_CLI_HOME=.dotnet dotnet runThe project targets net10.0. DOTNET_CLI_HOME=.dotnet keeps local CLI first-run files inside the repo, which is handy
in sandboxed environments.
Template data is stored as JSON under data/:
settings.json: prefix, development guild id, rotating statuseslevels.json: guild/user XP and levelstags.json: custom server tags- autorole settings live in
settings.jsonunderautoRoles - per-server settings live in
settings.jsonunderguildSettings
The data/ folder is ignored by git so tokens, server data, and local state do not get committed by accident.
Config precedence is intentionally simple: once data/settings.json exists, the dashboard owns bot settings. Delete
that file if you want env/appsettings values to seed a fresh local config again.
If a JSON data file is malformed, the bot preserves it with a .corrupt-* suffix and recreates clean defaults where
possible.
- Add new slash command modules under
Features/<FeatureName>. - Add prefix command modules by inheriting
ModuleBase<SocketCommandContext>. - Add services with
builder.Services.AddSingleton,AddScoped, orAddHostedServiceinProgram.cs. - Replace the JSON stores (
TagStore,LevelStore,BotSettingsStore) with database-backed stores when the bot outgrows single-node file storage. - Replace
ReminderStorewith a persisted store when reminders need to survive restarts.