
ValheimDiscordRelay
Relay Valheim chat and shouts to Discord via webhooks, with client screenshots, automatic player death and boss death videos plus server lifecycle and intercepted player arrival-leaving notifications.Valheim Discord Relay
One BepInEx plugin DLL for Valheim that connects your world to Discord through webhooks:
- Chat relay — normal chat and shouts, with their own webhooks.
- Death messages and death videos — a funny, randomly chosen death message plus a short WebP clip of the player's death, ending on a cinematic death camera.
- Boss announcements — an embed with the top damage dealer, plus a short video of the boss dying.
- Server notifications — server up / down / restart.
- Player notifications — "has joined the world" / "had to leave us", with the current population.
- Weekly report — one embed per week: players joined, mob kills and deaths per player, bosses killed, highest damage dealt.
- Manual screenshots — one hotkey, straight from the client.
I made this mod because I wanted something I could not find in the other available mods. It might not be perfect, but it has worked in my tests and I hope it works for you too. Please report any issues.
NOTE!!!
Remove the old config file (BepInEx/config/ValheimDiscordRelay.cfg) before starting the game after an update. Settings are added, renamed and removed between versions.
Requirements
- Valheim 1.0.12
- BepInEx 5.4.2350
- Install the mod on the dedicated server and on every client that should relay chat, report deaths / kills, or use capture features.
- Worlds hosted from Valheim's own menu (no dedicated server) work too: install the mod on the host and set the webhook URLs in the host's config. Other players need the mod for their chat to be relayed.
Installation
Install the Thunderstore/Hexium package, or place ValheimDiscordRelay.dll in BepInEx/plugins/ValheimDiscordRelay/.
The DLL contains both the client and server parts; the server part stays inactive on clients.
What goes where
Every feature that sends something to Discord has its own config category, its own webhook setting and its own enable switch, so you can run only the parts you want and point each at its own channel.
| Feature | Category | Sent by | Webhook setting | Sent as |
|---|---|---|---|---|
| Normal chat | [Chat] |
server | Server - Normal Webhook URL (falls back to Server - Webhook URL) |
the player's name |
| Shouts | [Chat] |
server | Server - Shout Webhook URL (falls back to Server - Webhook URL) |
the player's name |
| Manual screenshots | [Screenshots] |
client | Server - Webhook URL |
the player's name (optional) |
| Death message + video | [Player Deaths] |
client | Server - Webhook URL |
the player's name |
| Boss announcement | [Boss Death] |
server (embed) + client (video) | Server - Webhook URL |
Server - Webhook Username |
| Server up / down / restart | [Server Notifications] |
server | Server - Webhook URL |
Server notifications (or the webhook's own name) |
| Player joined / left | [Player Notifications] |
server | Server - Webhook URL |
Player notifications |
| Weekly report | [Weekly Report] |
server | Server - Webhook URL |
Weekly report |
Configuration
Everything is in one file: BepInEx/config/ValheimDiscordRelay.cfg. BepInEx writes a description above every setting.
Setting names start with who they belong to:
Server - ...— set by the server admin. Either synced to every player or used only on the server.Client - ...— each player's own setting, never synced.
Most categories have a Server - Enabled switch (admin, affects everyone) and a Client - Enabled switch (the player opting out). A feature that has both runs only when both are on.
What is synced. The mod uses ServerSync. Webhooks are set by the admin in the server's config; players do not enter their own.
- Webhooks the clients upload to (screenshots, death videos, boss videos) are synced to every client.
- Webhooks only the server uses (chat, server notifications, player notifications, weekly report) stay on the server and are never sent to clients.
[Admin]
Server - Lock Configuration(defaulttrue) — only players in the server'sadminlist.txtcan change synced settings. If set tofalse, ANY connected player can change them, webhook URLs included, so leave it on for a public server.Server - Log Successful Sends(defaultfalse) — log every successful Discord delivery.
[Chat]
Server - Enabled— enable the chat relay.Server - Webhook URL— fallback webhook, used when the Normal / Shout one is empty.Server - Normal Webhook URL,Server - Shout Webhook URL— webhooks for normal chat and shouts.Server - Max Message Length— maximum chat text sent to Discord (100–1900).Server - Name Display—NameOnly(default),NameWithNumber(Bjorn [1], for duplicate names) orNameWithIdSuffix(Bjorn [5678]).Server - Shout Prefix,Server - Normal Prefix— ANSI colour prefixes (dim red / dim cyan). Leave them alone unless you want other colours.Server - Queue Limit— maximum queued messages; the oldest are dropped when full (10–1000).Server - Minimum Send Interval Ms— pacing between webhook requests (50–5000).Client - Enabled— send the chat typed in this game to the server. Turn off to keep your chat out of Discord.Client - Max Message Length— maximum chat text sent from the client (1–1000).
[Screenshots]
Server - Enabled— turn off to disable screenshots for every player.Server - Webhook URL— the screenshot webhook.Client - Enabled— allow the screenshot hotkey in this game.Client - Key— hotkey, defaultPageUp;Nonedisables it. It works while other keys are held.Client - Include Player Name— use the character name as the Discord username.
[Player Deaths]
Server - Enabled— turn off to disable death messages, shouts and videos for every player.Server - Webhook URL— the webhook for death messages and videos.Client - Enabled— announce this player's deaths (in-game shout and Discord message).Client - Video Enabled— record a death video. When off, the message is still sent without a video.Client - Video FPS—20or30(default30).Client - Video Resolution—480x270,640x360or960x540(default).Client - Video Pre Duration,Client - Video Post Duration—2to4seconds before / after death (default4).Client - Death Camera— after you die, raise the camera and look down at your body (default on). It also moves your own view for those seconds.Client - Death Camera Height— how many metres the camera rises (1to15, default6).Client - Death Camera Look At Killer— turn the view towards whatever killed you (default on).
[Boss Death]
Server - Enabled— announce boss deaths.Server - Webhook URL— the boss webhook, used for both the embed and the video.Server - Webhook Username— sender name; defaultBoss Death Announcement!.Server - Video Source— whose game records the boss video:Boss Owner(default) orLast Attacker.Client - Enabled— take part in boss announcements from this game.Client - Video Enabled— upload the boss video from this game.Client - Video FPS,Client - Video Resolution— only used when[Player Deaths] Client - Video Enabledis off.Client - Video Pre Duration,Client - Video Post Duration—2to4seconds before / after the boss dies.
[Server Notifications]
Server - Enabled,Server - Webhook URL— enable the feature and set its webhook.Server - Use Discord Webhook Name— off: messages are sent as Server notifications. On: Discord shows the name set on the webhook.Server - Up Notification,Server - Down Notification,Server - Restart Notification— turn each message on or off.Server - Restart Window Seconds— a startup within this many seconds of a clean shutdown counts as a restart (10–3600, default 120).
[Player Notifications]
Server - Enabled,Server - Webhook URL— enable the feature and set its webhook.Server - Arrival Avatar URL,Server - Leave Avatar URL— optional image URLs used as the webhook icon for join / leave messages.
[Weekly Report]
Server - Enabled,Server - Webhook URL— enable the feature and set its webhook.Server - Report Day(defaultSunday),Server - Report Time(HH:mm, server time, default20:00) — when the report is posted.Server - Send Test Report— set totrueto post a "(test)" report right now. It resets itself and does not clear the statistics.Client - Enabled— include this player in the report.
Chat relay
The client sends only the chat type and text; the server works out the sender from the network peer. No Discord account linking is used. Normal chat is shown in dim cyan and shouts in dim red. Whispers are never relayed.
Valheim's own "I have arrived!" shout is dropped while [Player Notifications] is enabled (the mod posts its own join message instead), and relayed like any other shout when it is off.
Manual screenshots
Press PageUp (by default) to capture the final rendered frame, including UI from other mods. The PNG is uploaded straight from the client; it does not pass through the server.
Black-screenshot protection. Every screenshot is checked for brightness. If it comes back black, other capture strategies are tried automatically, and as a last resort the newest death-video frame is sent (needs death videos on; file name ends in -buffered). The strategy that worked is remembered for this PC in BepInEx/cache/ValheimDiscordRelay.ScreenshotStrategy.txt; delete the file to detect it again. Each screenshot also logs the game state, which shows whether a black result was a capture problem or a genuinely black screen.
Death messages
When the local player dies, the client works out what killed them from Valheim's hit data, picks a message for that kind of death and:
- shouts it in game chat 5 seconds after the death, so it stays out of the video (it is not sent to the chat webhook), and
- sends it to Discord through
[Player Deaths] Server - Webhook URL, together with the death video.
Both need [Player Deaths] Server - Enabled and Client - Enabled on. Without a webhook the shout still happens and the log says why nothing was sent to Discord. Deaths are always counted for the weekly report.
- Animals and other enemies get a random message from preset lists, chosen by kind of enemy and star count. The same one is never used twice in a row.
- Bosses and special enemies (names with a colour tag, e.g. Geirrhafa) get one fixed message, shown in red in Discord.
- Environmental deaths (drowning, burning, freezing, lava, falling...) get a random message that names the cause.
- Crushing deaths (trees, carts, boats, structures...) get one fixed sentence each.
- Unknown causes use Valheim's own death text, or
got killed by Unknown.
The attacker is remembered when it hits you, so it is still named correctly if it dies first. Burning and poison deaths are credited to the creature that hit you in the previous 5 seconds. Creature level is shown as stars: emoji in Discord, (2 stars) in game chat.
All quotes are in Client/DeathQuotes.cs; edit them there.
Repeat deaths. A second death while the first is still being recorded (or within 30 seconds) gets no new video. Discord gets the normal death message, a "died again" line and a "no video" line instead.
Every Discord death message is sent in a code block.
Death videos
When the local player dies, the client records the configured time before and after the death and uploads it as an animated WebP, directly from the client, together with the death message.
Death camera. Valheim leaves the camera where it was. With Client - Death Camera on, the camera instead rises smoothly while looking down at your body, and with Client - Death Camera Look At Killer on it also turns towards whatever killed you, without losing your body from view. It stops short of ceilings, only runs for recorded deaths, and moves your own view as well as the video.
Frames are kept in memory while you play; disk is only used when a death happens, and leftover files are cleaned up automatically. WebP quality is chosen automatically. The encode runs in parallel at low priority, using at most a quarter of your CPU cores. If every attempt fails, only the death message is sent.
Boss death announcements
When a boss dies, the server posts an embed to the boss webhook, and a player's game uploads a short video of the moment as a separate message.
The embed has the boss's portrait, the title {Boss} has fallen!, and a random party or solo quote naming the top damage dealer and their damage (or {Boss} has been defeated. if no damage was recorded). Quotes are in Server/BossQuotes.cs.
Damage is measured by the game that owns the boss, so the mod must be installed on that client. The server adds up the numbers per boss.
The video is recorded and uploaded by one game, chosen by Server - Video Source:
Boss Owner(default) — the client that owns the boss when it dies.Last Attacker— the player who landed the last hit, who is almost always looking at the boss. That player's own[Player Deaths]video settings apply, and[Player Deaths] Client - Video Enabledmust be on. If that game cannot record, the boss owner's video is used. With a dedicated server that owns the boss, this is the only way to get a video.
When a video is expected, the embed waits for it so both appear together in Discord. If the video is not ready within 75 seconds, the embed is sent anyway.
Which bosses. Known bosses are recognised by prefab name; any other boss is announced with its in-game name and no images. Kall Fimbulbringer is announced once, on its final phase.
Server notifications
[Server Notifications] posts when the server starts, stops or restarts. The server name is bold in every message.
Server **My World** is up.
Server **My World** restarted.
Server **My World** is going down.
A startup within Server - Restart Window Seconds of a clean shutdown is a restart; a longer gap is "is up".
Player notifications
[Player Notifications] posts when someone joins or leaves, sent as Player notifications:
{Player.name} has joined the world. Population: {players.count}. Good luck!
{Player.name} had to leave us. Hope they had fun. Population: {players.count}.
While it is enabled, Valheim's own "I have arrived!" message is intercepted and not sent to Discord. When it is off, nothing is intercepted and no join / leave messages are posted.
Valheim sends no message when a player leaves, so the server watches the connected players instead: one join per connection, one leave per disconnect, nothing on respawn or server shutdown.
Weekly report
[Weekly Report] posts one embed per week through its own webhook, sent as Weekly report.
Weekly report
**My World** · 25 Sep – 2 Oct 2026
Players joined Bosses defeated Highest damage dealt
3 2 Astrid
Eikthyr, Bonemass 48,213 damage
Kills & deaths
Player Kills Deaths
Astrid 212 3
Bjorn 96 1
Ragnhild 41 0
- Kills and damage are measured by the game that owns the creature, so that player needs the mod. Kills by tamed animals or the environment are not credited.
- Deaths are reported by the dying player's own game. Players are identified by character name.
- If the server was off at the due time, the report is posted when it is running again.
- Running totals are saved in
BepInEx/cache/ValheimDiscordRelay.WeeklyReport.txt, so a restart does not lose the week. Delete the file to start over.
Webhook security
The webhooks the clients upload to (screenshots, death videos, boss videos) are sent to every client, so any player can read them (for example in Configuration Manager). Use dedicated Discord webhooks and channels for them, not your normal chat webhook.
The chat, server notification, player notification and weekly report webhooks are only used by the server and are never synced.
Synced webhooks can only be changed by admins while [Admin] Server - Lock Configuration is on (the default).
Logs and troubleshooting
Everything is written to BepInEx/cache/ValheimDiscordRelay.log (kept for 24 hours). Common causes when nothing arrives in Discord:
- The webhook URL for that feature is empty. For screenshots and videos it must be set in the server's config.
- The feature's
Server - Enabledis off, orClient - Enabledis off on that client. - Boss video:
Client - Video Enabledis off on the recording client. WithLast Attacker, that player's[Player Deaths] Client - Video Enabledmust also be on. - Mob kills or damage missing from the weekly report: the player who owned the creature does not have the mod.