-
Create a Discord application and bot at the Discord Developer Portal, and copy the bot token.
-
Provide the token without committing it (user-secrets):
dotnet user-secrets set "Discord:Token" "<your-bot-token>" --project src/RustPlusBot.Host
This works because
src/RustPlusBot.Host/RustPlusBot.Host.csprojalready contains aUserSecretsId. -
Invite the bot to a test guild with the
applications.commandsandbotscopes. -
Run the bot:
dotnet run --project src/RustPlusBot.Host
On first run the host applies the EF Core migration and creates
rustplusbot.dbin the working directory. -
In the guild, use the slash commands per the provisioning flow below.
A missing or empty Discord:Token makes the host fail fast at startup with a clear OptionsValidationException.
The team chat bridge reads messages typed in each server's #teamchat channel, which requires a
privileged gateway intent:
- Open the Discord Developer Portal → your application → Bot.
- Enable Message Content Intent (under Privileged Gateway Intents). No verification is required while the bot is in fewer than 100 servers.
- Ensure the bot's role/invite grants Manage Webhooks (used to post in-game lines as each player) and Send Messages in the provisioned channels.
If the Discord application was previously used by another bot, leftover global commands can
appear in every guild alongside this bot's commands. Run once with Discord:ResetCommandsOnStartup
enabled to delete all global commands at startup before the current commands are registered:
dotnet run --project src/RustPlusBot.Host -- --Discord:ResetCommandsOnStartup=trueThe flag also reads from the Discord__ResetCommandsOnStartup environment variable or a
"Discord": { "ResetCommandsOnStartup": true } entry in configuration. It is a one-shot: once the
stale global commands are gone, leave it off for normal runs. Per-guild commands are already
overwritten on every startup, so a normal run after the reset leaves only the current command set.
- Invite the bot with the Manage Channels, Manage Roles, Manage Messages, and Embed Links permissions.
- In your test guild, run
/setup. The bot creates a RustPlusBot category with#information,#setup, and#settingschannels and posts its anchored messages. - Re-running
/setupis safe — it reconciles and repairs without creating duplicates. - Change the language from the selector in
#settings. - In Development (
Workspace:EnableDangerCommands = true), use/workspace simulate-server name:<n> ip:<host> port:<port>to create a server category, and/workspace resetto delete the whole workspace.
Each provisioned server category also includes an #events channel, which receives live alerts when a
cargo ship or patrol helicopter enters or leaves the map and when a chinook spawns. No new
Discord gateway intent is required — event markers are detected by polling the Rust+ socket, not the
Discord gateway; only the existing Send Messages and Embed Links permissions on the provisioned
channel are used.