Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
CaptainHook
Adds chat-to-server integration with Discord, online player tracking, uptime stats, and full web analytics — all fully configurable.
By Caenos
| Last updated | 10 months ago |
| Total downloads | 464 |
| Total rating | 3 |
| Categories | Mods Tools Server-side Utility |
| Dependency string | Caenos-CaptainHook-4.0.0 |
| Dependants | 5 other packages depend on this package |
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!