Skip to main content
← Blog

August 23, 2026 · The Minely team

How to build an auto roles bot with AI (join roles, delayed assign)

Auto roles are the plumbing of a healthy Discord server: every new member gets the right role instantly, bots get tagged as bots, and nobody waits for staff to click anything. It is a small bot with an outsized effect on how organized the server feels.

What an auto roles bot actually is

An auto roles bot assigns configured roles to new members on join, with an optional delay for raid safety, a separate role for bots, and role restoration when a previous member rejoins.

How it works under the hood

The join event triggers role assignment from a per-guild config: human roles, bot roles, and a delay option that waits N minutes before assigning (useful during raids when you want eyes on joins first). The bot/human split checks the account type and assigns accordingly. Rejoin restoration remembers a member's roles when they leave and offers them back on return.

The prompt that builds it

You do not have to write this yourself. A precise description is enough:

an auto roles bot that assigns join roles, splits bot and human roles, supports delayed assignment, and restores roles when a member rejoins

Name the commands, the permissions, and the exact messages players see. Precision here is what makes the first build land close.

Building it in the right order

  1. Wire join assignment with the human role set.
  2. Add the bot/human split.
  3. Implement delayed assignment with a queue.
  4. Build rejoin restoration with an opt-in flag.
  5. Add config commands and a status display.

The details that matter in production

In production, the first thing you learn is that the happy path is the easy half. The edges are where the work lives: restarts, protection interactions, full inventories, and players who treat every system like an exploit puzzle. Build for those from day one and the launch weekend is quiet instead of a fire drill.

Storage and cleanup deserve special attention. Write state as it changes rather than on shutdown, clear per-player state on quit and on world change, and make every admin-facing action leave an audit line. The first time something goes wrong, those records are the difference between a two-minute review and an evening of guessing.

Finally, test like a hostile user. Spam-click every GUI, rejoin mid-action, try the command with no permission and with every permission, and run it while the server is under load. The bugs that survive that pass are the ones worth shipping.

Tuning it after the first build

One member role and one bot role covers most servers; add notification or region starter roles carefully. The delay (2 to 10 minutes) is the raid-damage dial — short enough that real members barely notice, long enough to catch the flood.

Tips that save you a rebuild

  • Assign as few roles on join as possible; the welcome flow should finish the rest.
  • Tag bots with their own role instantly; it makes the log readable at a glance.
  • Make rejoin restoration opt-in; some servers want a clean slate on leave.
  • Log assignments for a week; misconfigured auto-roles are loud in the data.

Questions people ask

Can I have per-invite roles?

Invite-tracked roles assign based on which invite was used — powerful for partner channels.

What about removing roles on leave?

Restoration handles rejoins; stripping on leave is just not storing them.

How do I stop role ping spam?

Keep auto-assigned roles mention-free; pings belong to opt-in roles only.

Describe your version in the composer and see it built in minutes. Iterate with follow-up edits until it is exactly your server's flavor.