DiscordBot

版本 v1.3.0·更新於 2025-11-14

Enables two-way communication between your Valheim server and Discord channels.

模組介紹 作者原文

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 =

安裝與使用 安裝:BepInEx 外掛

  1. 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
  2. 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
  3. 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
  4. 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。

帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。 多人連線時,主機與所有用戶端需要安裝一致的模組。

前置依賴

下面這些內容需要先安裝,否則該模組不會生效:

denikson-BepInExPack_ValheimValheimModding-JsonDotNET

檔案與校驗

檔案名稱
DiscordBot-1.3.0.zip
檔案大小
129.2 KiB