DiscordBot
Enables two-way communication between your Valheim server and Discord channels.
About this mod Author’s original text
Discord Bot Plugin for Valheim
Enables two-way communication between your Valheim server and Discord channels.
Features
- 🗨️ Chat Integration: Send messages between Discord and in-game chat
- 🤖 Discord Commands: Execute server commands from Discord
- 📢 Server Notifications: Get notified when the server starts up
- 💻 Death GIF / Screenshot: On player death, send gif or image of event along side a death quip
- ✨ Screenshot to Discord chat command / hotkey
- 📱 ChatAI: Prompt AI service and improve death quips
Prerequisites
- BepInEx installed
- JsonDotNet installed
- Discord Webhooks configured for your server
- Discord Bot Token (If you want your discord server to be able to send messages into your game)
- Required on client and server
Installation
Discord Setup
How to create Discord Bot
- Create a Discord Application
- Go to the Discord Developer Portal
- Click "New Application" (top-right)
- Give your application a name (e.g. ValheimBot) and click "Create".
- Add a Bot to the Application
- In the left sidebar, click "Bot"
- Click "Add Bot" ----> confirm by clicking "Yes, do it!"
- You now have a bot user attached to your application.
- You must enable Message Content Intent
- Copy the Bot Token
- On the Bot page, under the "Token" section, click "Reset Token" (or "Copy" if it is already shown).
- Confirm, then copy the generated token.
- Keep this token secret!, if it leaks, click "Reset Token" to generate a new one
- Invite the Bot to your Discord Server
- In the sidebar, click "O2Auth2" ----> "URL Generator".
- Under SCOPES, check bot
- Under BOT PERMISSIONS, check the permissions your bot will need
- Send Messages
- Read Message History
- View Channels
- Copy the generated URL at the bottom
- Open that URL in your browser and invite the bot to your Discord server
Creating Discord Webhooks
Webhooks allow the plugin to send messages to Discord channels without using the bot's identity.
- Create Webhook
- Go to "Integrations" tab
- Click "Create Webhook"
- Give it a name (e.g., "Valheim Chat")
- Copy Webhook URL
- Click "Copy Webhook URL"
- Save this URL for your plugin configuration
Getting Channel IDs
You'll need Discord Channel IDs for the bot to read messages:
- Enable Developer Mode
- In Discord, go to User Settings (gear icon)
- Go to "Advanced" settings
- Enable "Developer Mode"
- Copy Channel IDs
- Right-click on each channel you want to use
- Select "Copy ID"
- Save these IDs for your configuration
Configure the Plugin
After first run, configuration files will be generated in BepInEx/config. Edit the Discord Bot config file to set up your:
- Channel IDs
- Webhook URLs
- Bot Token [SERVER ONLY]
Configurations
Find DiscordBot plugin configurations in BepinEx/config/RustyMods.DiscordBot.cfg
Here's what your configuration might look like:
[1 - General]
If on, the configuration is locked and can be changed by server admins only. [Synced with Server]
Lock Configuration = On
Set interval between check for messages in discord, in seconds [Synced with Server]
Poll Interval = 5
If on, errors will log to console as warnings [Synced with Server]
Log Errors = Off
[2 - Notifications]
Set webhook to receive notifications, like server start, stop, save etc... [Synced with Server]
Webhook URL =
If on, bot will send message when server is starting [Synced with Server]
Startup = Off
If on, bot will send message when server is shutting down [Synced with Server]
Shutdown = Off
If on, bot will send message when server is saving [Synced with Server]
Saving = Off
If on, bot will send message when player dies [Synced with Server]
On Death = On
If on, bot will send message when new player connects [Synced with Server]
New Connection = Off
[3 - Chat]
Set discord webhook to display chat messages [Synced with Server]
Webhook URL =
Install & use Install: BepInEx plugin
- The archive from playbuff is the mod itself — usually a BepInEx plugin (a .dll or a plugin folder once unzipped).
- Recommended: use a community mod manager (such as r2modman) — pick this game, import the mod, and the manager sets up BepInEx and its dependencies for you.
- Manual route: install the BepInEx loader in the game folder, then drop the unzipped .dll or plugin folder into BepInEx/plugins/.
- Launch the game — the BepInEx console logs every plugin it loads; seeing this mod in the log means it is installed.
Mods with listed dependencies need those installed too, or they will not load. Options are usually changed in-game or in the plugin's config file. In multiplayer, the host and every client need the same mods installed.
Install these first, or the mod will not work: