Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
CaptainHook
A lightweight Valheim mod that bridges server info to a Discord bot using HTTP. Shows player stats, uptime, biome location, and more.
| Date uploaded | a year ago |
| Version | 2.5.3 |
| Download link | Caenos-CaptainHook-2.5.3.zip |
| Downloads | 151 |
| Dependency string | Caenos-CaptainHook-2.5.3 |
This mod requires the following mods to function
denikson-BepInExPack_Valheim
BepInEx pack for Valheim. Preconfigured and includes unstripped Unity DLLs.
Preferred version: 5.4.2201README
CaptainHook - Valheim Discord Bridge
CaptainHook is a lightweight Valheim server mod that opens a simple HTTP interface so your Discord bot can request real-time server information like online players, uptime, biome locations, and more.
Built for ease of use, server admins can set it up in minutes and customize settings through a config file. It's ideal for anyone who wants a bot to talk to their server โ no file sharing, no messy log parsing, no complicated dependencies.
๐ฉ๏ธ Features
- ๐ก Discord bot support for real-time Valheim stats
- ๐ง View online players and their biomes
- ๐ Get server uptime and current in-game time
- ๐ Uses HTTP (no port forwarding required if hosted locally)
- ๐ ๏ธ Easily customizable via config file (IP, port, bot name)
- โ Fully works on dedicated servers
๐ฆ Installation
๐ง Server Setup (Valheim Server)
-
Install BepInEx on your Valheim dedicated server
-
Download
CaptainHook.dll- Place it into:
BepInEx/plugins/
- Place it into:
-
Start your server once.
- This will generate the config file:
BepInEx/config/Caenos.CaptainHook.cfg
- This will generate the config file:
-
Open the config file and edit the values:
[General] ServerPort = 25662 ServerIP = 31.214.xxx.xxx # Your public IP BotDisplayName = CaptainHook -
Restart the server โ you're ready to connect a bot!
๐ค Discord Bot Setup
You'll need a simple bot that can query your Valheim server using HTTP. Here's how:
- Create a bot at: https://discord.com/developers/applications
- Set the bot token as an environment variable:
DISCORD_TOKEN - Use the Python bot template (see below)
- Invite the bot to your server
๐ Example Bot Code (Python)
import discord
import os
import requests
HTTP_SERVER = "http://your.ip.here:25662" # Match the config file
TOKEN = os.environ['DISCORD_TOKEN']
intents = discord.Intents.default()
intents.message_content = True
client = discord.Client(intents=intents)
def get(endpoint):
try:
response = requests.get(f"{HTTP_SERVER}/{endpoint}", timeout=3)
return response.text
except:
return "โ ๏ธ Could not reach server"
@client.event
async def on_ready():
print(f"Logged in as {client.user}")
@client.event
async def on_message(message):
if message.author.bot:
return
msg = message.content.lower()
if msg == "@stats":
await message.channel.send(get("stats"))
elif msg.startswith("@w "):
await message.channel.send(get(f"whereis?name={message.content[3:].strip()}"))
elif msg == "@uptime":
await message.channel.send(get("uptime"))
elif msg == "@version":
await message.channel.send(get("version"))
elif msg == "@day":
await message.channel.send(get("day"))
elif msg == "@ping":
await message.channel.send(get("ping"))
elif msg == "@commands":
await message.channel.send(
"""๐ Available Commands:
@stats - Online players
@w <name> - Player's biome
@ping - Server ping
@uptime - Server uptime
@version - Mod version
@day - In-game day/time
@commands - This list""")
client.run(TOKEN)
โ Bot Commands
| Command | Description |
|---|---|
@stats |
List all online players |
@w <name> |
Show the biome a player is in |
@ping |
Checks if server is alive |
@uptime |
Server uptime (real-world time) |
@version |
Shows mod version and author |
@day |
Shows current in-game day & time |
@commands |
Lists all bot commands |
๐ Security Notes
- This mod opens an HTTP port โ it does not use encryption.
- It is read-only and does not allow any control commands.
- If youโre using a public server, consider a reverse proxy or local firewall to restrict access.
๐ง Tips
- You can host the bot anywhere โ even on Replit, a Raspberry Pi, or a VPS
- If you're behind NAT or don't have port forwarding, consider using a tunnel like ngrok
- The mod works even if no players are online โ great for uptime monitors!
๐งช Planned Features
- Discord slash command support
- Embedded visual status replies
- Admin ping alerts for server down
๐ Credits
Mod developed by Caenos
๐ Source / Repository
Coming soon on GitHub...
CHANGELOG
CaptainHook - Valheim Discord Bridge Version: 4.0.0 by Caenos
๐ฉ๏ธ What is CaptainHook? CaptainHook is a lightweight, server-side mod that lets you connect your Valheim server to a Discord botโdelivering real-time info about players, server status, uptime, and more, all over a secure HTTP interface.
This update brings full per-command toggling via config, on-the-fly reloading, and smooth multi-server Discord integration. Built for ease of use and reliabilityโno log file scraping, no messy dependencies, and zero downtime for config changes!
โจ New in v4.0.0 ๐ Live Config Reload: Change your mod config and use the new /reload endpointโno need to restart your server to update which commands are enabled.
โ๏ธ Per-Endpoint Toggles: Enable or disable any HTTP endpoint (/stats, /uptime, /version, /whereis, /commands, etc) directly from your config file.
๐ค Multi-Server Ready: Each server runs its own mod and exposes just the endpoints you want; your Discord bot can aggregate all servers and display results as one.
๐๏ธ Auto-generated Configs: The mod will auto-create Caenos.CaptainHook.cfg, seen.json, and debug.json if they're missing.
๐ง Cleaner API: Removed /day and dashboard endpoints for simplicity and accuracy.
๐ก๏ธ Designed for Dedicated Servers: No Valheim client requiredโjust drop in on your server.
โ Full Discord Slash Command Support (with included example bot).
๐ฆ Installation
- Server Setup Install BepInEx BepInExPack Valheim on Thunderstore
Drop CaptainHook.dll Place CaptainHook.dll into BepInEx/plugins/.
Start your server once. The config file BepInEx/config/Caenos.CaptainHook.cfg will be generated. Edit it to your needs:
ini Copy Edit [General] Port = 25681 BotName = CaptainHook ServerIP = 127.0.0.1
[Endpoints] EnableStats = true EnablePing = true EnableUptime = true EnableVersion = true EnableWhereIs = true EnableCommands = true ; EnableDay = false # /day endpoint is removed in 4.0.0
No server restart needed for config changes! Just hit the /reload endpoint with your bot or browser to re-read the config instantly.
- Discord Bot Integration The mod is designed to work with the provided Python Discord bot template
Each server can run its own instance of CaptainHook, and the bot can fetch stats from all servers (S1, S2, S3, etc) and merge/forward results in Discord
See full example bot code below (supports /stats, /uptime, /whereis, /seen, /version, more...)
๐ Features ๐ก Discord bot support: Real-time stats and slash command integration
๐ง View online players and their biomes (/whereis)
โฑ๏ธ Get server uptime
๐ All endpoints toggleable in config
๐ ๏ธ No restarts for config changes
๐ Auto-creates needed config and JSON files
โก No log scraping, file sharing, or modded clients needed
โ Safe for dedicated servers
๐ค Example Discord Bot Commands /stats โ Lists all online players from all your servers
/whereis <name> โ Shows a playerโs biome (per-server)
/uptime โ Displays server uptime
/version โ Shows mod version and author
/reload โ Reloads the mod config on the fly
/seen <name> โ When was a player last seen online (Discord-bot only)
/commands โ Lists all commands and descriptions
๐ Security Notes The HTTP server is read-only; it never accepts commands or controls the game/server
For extra safety, use a firewall or reverse proxy to restrict access to your botโs IP
๐ Credits Mod developed by Caenos Discord Bot example, testing, and feedback from the community
๐ Source / Repository Coming soon on GitHub...