Skip to content

DiscordSH Bot

discordsh-bot is the standalone Discord gateway bot extracted from the axum-discordsh monolith. It handles all Discord interactions independently of the HTTP server.

  • Poise/serenity Discord gateway with shard support
  • Slash commands: /github, /gh, /dungeon, /ping, /status, /health, /admin, /skills, /n8n
  • Embed Dungeon game with bevy_battle combat, bevy_inventory item management
  • GitHub issue/PR management with SVG card rendering
  • Player persistence via Supabase
  • HMAC-signed forwarder into in-cluster n8n (/n8n)
  • Minimal health HTTP server for k8s probes

Required at runtime. In production the values come from discordsh-config (ConfigMap) and the discordsh-redis-secret / discordsh-supabase-shared / discordsh-n8n-hmac Secrets. For the dev container, drop them into apps/discordsh/discordsh-bot/.env (loaded via dotenvy at startup) — anything missing simply disables the related feature instead of failing the boot.

VariableRequiredDefaultNotes
DISCORD_TOKENYes*Bot token. *Resolved from Supabase Vault in prod if unset locally.
GUILD_IDNoDev guild for fast slash-command registration
SHARD_ID / SHARD_COUNTNosingle-shardDistributed sharding
HEALTH_PORTNo4322Health server bind port
FONT_PATHNoalagard.ttfCard render font
SYMBOL_FONT_PATHNoNotoSansSymbols-Regular.ttfUnicode symbol font
DB_PATHNoLocal KV (redb) path for L2 profile cache
VariableRequiredNotes
SUPABASE_URLNoAPI URL; enables persistence + shard tracker
SUPABASE_SERVICE_ROLE_KEYNoService-role JWT; pair with SUPABASE_URL
GITHUB_TOKENNoPAT for /github + /gh commands
GITHUB_DEFAULT_REPONoDefault owner/name (default KBVE/kbve)
GITHUB_ALLOWED_REPOSNoComma-separated repo allowlist

/n8n <webhook_path> [args] forwards Discord input to the in-cluster n8n webhook receiver. Every payload is signed X-KBVE-Signature: sha256=HMAC(secret, "{ts}.{body}") so n8n workflows verify origin + reject replays in a Function node. All three required vars must be present or the command unregisters itself.

VariableRequiredDefaultNotes
N8N_BASE_URLYeshttp://n8n.n8n.svc.cluster.local:5678/webhook/ in cluster; https://n8n.kbve.com/webhook/ for dev against public n8n
N8N_HMAC_SECRETYesShared secret with the n8n workflow ($env.N8N_HMAC_SECRET)
N8N_ALLOWED_PATHSYesGlobset allowlist, comma-separated (e.g. kbve/*,deploy-*)
N8N_RATE_LIMITNo1Max calls per user per window
N8N_RATE_WINDOWNo5Sliding window length in seconds

Dev-container .env example:

N8N_BASE_URL=https://n8n.kbve.com/webhook/
N8N_HMAC_SECRET=<shared>
N8N_ALLOWED_PATHS=kbve/*,deploy-*
N8N_RATE_LIMIT=1
N8N_RATE_WINDOW=5

In production the same secret lives once as a SealedSecret in the n8n namespace and is mirrored into discordsh via ExternalSecret — see apps/kube/discordsh/seal-n8n-hmac.sh.

  • DiscordSH — HTTP server (Astro site, REST API)
KBVE

Open-source tools, games, and applications crafted for developers and creators.

© 2026KBVE. All rights reserved.