Deploy Shugo
Context-aware Discord auto-moderation bot powered by Jev
bot
Just deployed
/data
Deploy and Host Shugo on Railway
Shugo is a context-aware Discord auto-moderation bot powered by Jev, TypeSafe's System One model. It reads every message in your server, weighs it against the author's account age, how long they've been a member and their recent messages, then flags, deletes or times out rule breakers. Every action it takes is reported to the log channels each server picks with /settings.
About Hosting Shugo
Shugo is a single Go binary shipped as a small distroless Docker image. It keeps an outbound gateway connection to Discord and calls the Jev API over HTTPS. It has no web server and no public port. Recent messages are kept in memory for a few minutes, and each server's settings live in a SQLite file on a volume mounted at /data, so they survive redeploys. Railway mounts volumes as root while the image runs as a non-root user, so the template sets RAILWAY_RUN_UID=0 to let Shugo write its database. Hosting it means running one always-on container with two secrets, a Discord bot token and a TypeSafe API key. Run exactly one replica: the volume attaches to a single deployment, and a second replica would moderate every message again. Start with DRY_RUN=true, pick a log channel with /settings log-channel set, tune the thresholds on real traffic, then turn enforcement on.
Common Use Cases
- Stop spam bots and raids that join and post links within minutes
- Catch compromised accounts that suddenly blast scams across channels
- Remove harassment, hate and sexual content around the clock without a human on call
- Give a small moderation team a reviewable log of every borderline message
- Try AI moderation safely in dry-run mode before it touches anything
- Moderate several servers from one bot, each with its own log channels and exemptions
Dependencies for Shugo Hosting
- A Discord bot from the Discord Developer Portal, with the Message Content privileged intent enabled
- A TypeSafe API key for Jev, or an OpenRouter key through OpenRouter's Decisions API
- A Railway volume mounted at
/data, which the template creates
Implementation Details
Invite the bot with the bot and applications.commands scopes and these permissions:
- View Channels, Read Message History, Manage Messages and Moderate Members in every channel you want moderated
- Send Messages and Embed Links in the log channels
Then move Shugo's role above the roles of the members it should moderate. Discord rejects timeouts on members whose highest role is at or above the bot's. Members with Administrator or Manage Messages are never moderated.
Members with Manage Server configure Shugo for their server with /settings. Replies are only visible to the person who ran the command:
| Command | Effect |
|---|---|
/settings show | Show the current settings |
/settings log-channel set | Send flagged messages, or deletes and timeouts, to a channel |
/settings log-channel clear | Remove that channel |
/settings exempt-channel add/remove | Skip moderation in a channel and its threads |
/settings exempt-role add/remove | Skip moderation for members with a role |
Flagged messages and enforced actions can go to separate channels. When only one is set, it receives both.
A deterministic policy turns Jev's probabilities into actions. The first matching row wins:
| Condition | Action |
|---|---|
risk ≥ DELETE_RISK and (severity ≥ TIMEOUT_SEVERITY or suspicious author) | delete + timeout |
risk ≥ DELETE_RISK | delete |
risk ≥ FLAG_RISK and suspicious author | delete |
risk ≥ FLAG_RISK | flag (report only) |
Why Deploy Shugo on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Shugo on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content
DISCORD_TOKEN
Bot token from the Discord Developer Portal (Bot → Reset Token). Enable the Message Content intent on the same page.
TYPESAFE_API_KEY
API key for Jev from TypeSafe. If you use OpenRouter, put your OpenRouter key here instead.
