
CaptainHook
Adds chat-to-server integration with Discord, online player tracking, uptime stats, and full web analytics — all fully configurable.
By Caenos
Date uploaded | 3 months ago |
Version | 4.0.0 |
Download link | Caenos-CaptainHook-4.0.0.zip |
Downloads | 211 |
Dependency string | Caenos-CaptainHook-4.0.0 |
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 Author: Caenos Version: 4.0.0
The ultimate bridge between your Valheim dedicated server and your Discord community. Real-time server stats, uptime, player locations, and more — all with simple HTTP and powerful bot support.
🚀 Features Real-time Discord Integration — Show online players, uptime, and more directly in your Discord
Toggleable Endpoints — Turn each endpoint on/off in your config (/stats, /uptime, /ping, /whereis, /version, /commands)
Live Config Reload — Change config without server restart using /reload
Multi-Server Ready — Each server runs its own mod, Discord bot merges results
Auto-Generated Configs — Automatically creates .cfg and needed JSON files
Zero-Dependency, No Client Mod Needed — Works on any dedicated server
Safe & Simple — Read-only HTTP API, no risk to your game server
📦 Installation
- Valheim Server Setup Install BepInEx: Download from Thunderstore and install it on your Valheim server.
Install CaptainHook:
Drop CaptainHook.dll into BepInEx/plugins/
Start your server once.
This will auto-create the config: BepInEx/config/Caenos.CaptainHook.cfg
Edit Your Config: Example section:
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 (Optional) Change Endpoint Access: Toggle any command on/off from the config. Use /reload to apply changes instantly—no server restart needed.
- Discord Bot Setup Create Your Bot:
Go to Discord Developer Portal
Click New Application → Bot → Add Bot
Save the Bot Token (keep it private!)
Invite Your Bot:
Go to OAuth2 → URL Generator
Select bot and applications.commands scopes, set permissions (read/send messages), copy and visit the link
Prepare the Example Python Bot:
Copy the example code below to main.py
Install required Python packages:
nginx Copy Edit pip install discord.py requests Flask Set your bot token as environment variable or replace in the script:
arduino Copy Edit export DISCORD_TOKEN=your-bot-token Run it:
css Copy Edit python main.py The bot will query your server and respond to slash commands!
🤖 Example Discord Bot Code python Copy Edit import discord import os import requests
HTTP_SERVER = "http://YOUR.SERVER.IP:port" # Set to your mod's HTTP config port TOKEN = os.environ.get('DISCORD_TOKEN') or "YOUR-TOKEN-HERE"
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 == "@ping": await message.channel.send(get("ping")) elif msg == "@reload": await message.channel.send(get("reload")) elif msg == "@commands": await message.channel.send( "📜 Commands: @stats, @w <name>, @ping, @uptime, @version, @reload, @commands" )
client.run(TOKEN) See package for a full-featured multi-server slash-command version.
🛠️ Configuration and Endpoints Every endpoint can be enabled/disabled in the config.
Edit config, then POST /reload to update instantly.
Supported endpoints: /stats /ping /uptime /version /whereis?name=X /commands /reload
🔥 What can you add with a Discord bot? Full Slash Command Support: List players, uptime, version, biomes, and more as Discord slash commands.
Admin Alerts: Ping admins if server goes offline.
Automated Welcome Messages: Let your bot greet new online players.
Last Seen / Activity Tracking: Extend with /seen using the bot’s database.
Server Multi-query: Merge stats from multiple servers into one reply.
Web Dashboard: Build a status website using the same API.
❓ FAQ & Troubleshooting Q: Do I have to restart my server for config changes? A: No! Use /reload to apply config instantly.
Q: Is it secure? A: The HTTP API is read-only. You should firewall it or reverse-proxy to your bot if exposed to the public.
Q: Can I use multiple bots or servers? A: Yes. Each server runs its own mod and exposes only the endpoints you want.
Q: What about /seen and other advanced features? A: The mod provides core info, but the Discord bot can add richer features like tracking last seen and command usage.
🙌 Credits Mod by Caenos
Community testers and bot contributors
📂 Source GitHub: Coming soon!
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...