Project · Live
RoleLogic
Discord role automation. Roles granted and removed by rules and by what happens on other platforms, instead of by a moderator with a checklist.
The problem
Roles are how Discord servers organise everything: who can see which channels, who gets pinged, who is staff, who supports the creator. Discord's built-in tools assign roles when someone joins or picks one from a menu, but most real rules are conditional ("members who have role A but not role B", "anyone holding at least two of these three roles") or depend on something outside Discord ("people who follow my Twitch channel"). Without automation, a moderator keeps those up to date by hand, and they drift.
What it does
- Rules. Each rule matches members by the roles they hold (any, all or none of a set, or at least, at most or exactly a number of them) and adds or removes roles. Rules run in priority order, so later rules see the roles earlier ones set.
- Continuous enforcement. The bot re-evaluates members as things change, and works through large servers in the background within Discord's rate limits.
- Cross-server sync. A role in one server can follow a role in another, which is useful for networks of related communities.
- Audit trail. Role changes are logged, and Discord's own audit log names the rule behind each one, so "why does this person have this role?" has an answer.
- Role Link plugins. Roles can mirror what happens on other platforms: Twitch followers, YouTube subscribers, Kick channels, TikTok creators, Steam players, Roblox players, osu! players, Genshin Impact players, GitHub contributors, Bluesky accounts, Stripe subscribers, Top.gg voters, form respondents, referral codes, birthdays, where a member came from.
- Safe edits. Changing a rule that is already running doesn't pull it out from under the server. The edit is held, checked against Discord and the server's other rules, and applied in one step.
- AI assistance (beta). You can connect your own AI client over MCP to explain or draft rules. RoleLogic runs no AI of its own, the assistant only sees servers you share with it, and it can't change anything without your approval.
How it's built
The Discord bot is written in Rust and does the rule evaluation. A TypeScript API with PostgreSQL and Redis stores rules, logs and plans, and the dashboard is a React app available in several languages. The hard parts are less about code than about correctness under change: rules that interact, members who join and leave mid-scan, and Discord's rate limits on large servers. A rule set is checked for loops before it is saved, and the bot processes a server's rules in a fixed, documented order, so the same rules always give the same result.
DWEEB, my other live app, integrates with RoleLogic: its Link buttons can point at RoleLogic plugin pages, and its template catalogue includes ready-made role panels.
Related writing
- Nested deadlines: answering Discord interactions inside three secondsRouting Discord button clicks through a dispatcher to plugin services inside the 3-second window: failure classes, safe retries and nested timeouts.9 November 2026 · 7 min read · Discord API, Rust, Reliability
- A dropped DNS packet that looked like a Discord outageA 5-second "connect timed out" to discord.com was a DNS stall inside Docker. How one lost UDP packet stalls lookups, and how serving stale answers fixes it.9 November 2026 · 5 min read · Operations, DNS, Rust
- A short page is not the last page: counting a Discord bot's serversMy bot's server count sat at 199 for weeks, then jumped to 344. Paginating GET /users/@me/guilds correctly, and a per-token rate limit I raced myself.9 November 2026 · 5 min read · Discord API, Rust, Rate limits
