Valheim
You are viewing a potentially older version of this package. View Latest Version
Install with App

Details

Date Uploaded
Downloads
71
Size
639KB
ADDatHost Valheim hosting
30% off

Valheim Discord Relay

One BepInEx plugin DLL for Valheim that relays normal chat and shouts to Discord using webhooks, provides client-side screenshots, and can automatically create a short WebP death video around the local player's death.

Requirements

  • Valheim 1.0.12
  • BepInEx 5.4.2350
  • Install the mod on the dedicated server and on every client that should relay chat or use client capture features.

Installation

Install the Thunderstore/Hexium package, or place ValheimDiscordRelay.dll in:

BepInEx/plugins/ValheimDiscordRelay/

The package contains one mod DLL. It contains both client and server components.

Configuration

The mod uses one shared file:

BepInEx/config/ValheimDiscordRelay.cfg

[Server]

  • Enabled — enable server-side chat relay.
  • Webhook URL — fallback Discord webhook.
  • Normal Webhook URL — webhook for normal chat; falls back to Webhook URL.
  • Shout Webhook URL — webhook for shouts; falls back to Webhook URL.
  • Max Message Length — maximum chat text sent to Discord.
  • Name Display — NameOnly, NameWithNumber, or NameWithIdSuffix.
  • Shout Prefix — ANSI prefix for shouts; default is dim red.
  • Normal Prefix — ANSI prefix for normal chat; default is dim cyan.
  • Queue Limit — maximum queued Discord messages.
  • Minimum Send Interval Ms — pacing between webhook requests.
  • Log Successful Sends — log successful Discord deliveries.

[Client]

  • Enabled — enable local chat interception and client capture features.
  • Max Message Length — maximum chat text sent from the client to the server.
  • Screenshot Key — screenshot hotkey; default PageUp.
  • Screenshot Webhook URL — Discord webhook for manual screenshots.
  • Include Player Name — use the local Valheim character name as the Discord webhook username for manual screenshots.
  • Death Video Enabled — enable automatic death videos.
  • Death Video FPS — 20 or 30.
  • Death Video Resolution — 480x270, 640x360, or 960x540.
  • Death Video Pre Duration — 2 to 4 seconds before death.
  • Death Video Post Duration — 2 to 4 seconds after death.
  • Death Video Webhook URL — Discord webhook for death videos and fallback death messages.

The default death-video configuration is 30 FPS, 960x540, 4 seconds before death, and 4 seconds after death.

Example:

[Server]
Enabled = true
Webhook URL = https://discord.com/api/webhooks/...
Normal Webhook URL =
Shout Webhook URL =
Max Message Length = 1800
Name Display = NameWithNumber
Shout Prefix = ?[2;31m
Normal Prefix = ?[2;36m
Queue Limit = 100
Minimum Send Interval Ms = 250
Log Successful Sends = false

[Client]
Enabled = true
Max Message Length = 1000
Screenshot Key = PageUp
Screenshot Webhook URL = https://discord.com/api/webhooks/...
Include Player Name = true
Death Video Enabled = true
Death Video FPS = 30
Death Video Resolution = 960x540
Death Video Pre Duration = 4
Death Video Post Duration = 4
Death Video Webhook URL = https://discord.com/api/webhooks/...

Chat relay

The client sends only the chat type and text to the Valheim server. The server resolves the sender from the actual network peer, including character name and platform identifier. No Discord account linking is used.

Normal chat uses dim cyan ANSI formatting (ESC[2;36m); shouts use dim red (ESC[2;31m).

Whisper/private chat is intentionally not relayed.

The server uses sequential webhook delivery with queueing, pacing, and retry handling for Discord rate limits and temporary HTTP errors.

Manual screenshots

Press PageUp by default to capture the final rendered Valheim frame. The capture waits for the end of the frame so visible UI from other mods is included.

Screenshots are encoded as PNG and uploaded directly from the client. They do not pass through the Valheim server.

After a successful upload, the temporary screenshot file is deleted. Failed temporary files are automatically cleaned after 30 seconds.

Death videos

When the local player dies, the client records the configured period immediately before the death and continues recording for the configured period afterward.

The result is an animated WebP uploaded directly from the client to the configured Death Video Webhook URL.

Each successful video upload includes a death-cause message resolved from Valheim's local HitData.HitType. Creature names are normalized to lowercase. The current message formats are:

Creature deaths

%Player% got killed by a %enemy_name%. The %enemy_name% is dancing on %Player%'s tombstone.

For example:

PlayerName got killed by a troll. The troll is dancing on PlayerName's tombstone.

Trees, carts, boats, and other object/impact deaths

%Player% got crushed by a falling tree.
%Player% got crushed by a cart.
%Player% got crushed by a boat.
%Player% got crushed by a collapsing structure.
%Player% got crushed by a stalagmite.
%Player% got crushed by a drawbridge.
%Player% got crushed by a turret.
%Player% got crushed by a catapult.
%Player% got crushed by an impact.

Environmental deaths

Deaths caused by drowning, burning, freezing, poison, water, smoke, the edge of the world, Cinder Fire, Ashlands ocean, Ashlands lava, the incinerator, falling, or self-damage use:

%Player% learned the hard way why you can't fight nature.

If the cause cannot be resolved from the available Valheim hit data, the fallback is:

%Player% got killed by Unknown.

The player and attacker/cause information is resolved from Valheim's local gameplay data.

The recorder uses a disk-backed rolling frame buffer rather than retaining the complete video in RAM. Temporary frame files are removed after processing, and stale capture files are automatically cleaned after 30 seconds.

The WebP encoder's quality/compression strategy is automatic. If an encoding attempt is too large or fails, the client retries internally with more compact settings. These details are intentionally not exposed as user configuration. Death-video frames are staged under the system temporary directory in a short path (%TEMP%\ValheimDiscordRelay\DeathEncoding\...) and are passed to img2webp using filenames relative to its working directory. This avoids excessively long command lines caused by repeating the full Gale/BepInEx cache path for every frame. If all WebP upload/encoding attempts fail, the client sends only the same resolved death message described above.

No failed WebP is left behind after the fallback completes.

Webhook security

Screenshot and death-video webhook URLs are stored on clients because those uploads go directly from the client to Discord. Use dedicated Discord webhooks/channels if you do not want clients to have access to your normal chat webhook.

Thunderstore development is made possible with ads. Please consider making an exception to your adblock.