

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.
Install BepInEx on your Valheim dedicated server
Download CaptainHook.dll
BepInEx/plugins/Start your server once.
BepInEx/config/Caenos.CaptainHook.cfg
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!
You'll need a simple bot that can query your Valheim server using HTTP. Here's how:
DISCORD_TOKENimport 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)
| 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 |
Mod developed by Caenos
Coming soon on GitHub...