Building
Permissions and Discord context
Separate the caller, bot, channel overrides and role hierarchy.
Four independent checks
Caller permission: is this member allowed to request the action?
Bot permission: can the bot perform it?
Channel overrides: does the target channel allow the relevant operations?
Hierarchy/context: can this bot affect that member/role, and is the action running in a server?
Build a safe moderation path
Use Check Context when a command could run in DMs. Use Check Permission with
{author} to check the caller, especially if a user option changes {user} to the target member. Then check the bot's capability and perform the action. Connect denial branches to an understandable private reply.Role assignment
Grant Manage Roles and place the bot's highest role above the role it assigns or removes. A managed integration role cannot be edited like an ordinary role. Restrict which role an untrusted user can request; do not let a self-service button grant an arbitrary powerful role.
Intents are different
Intents determine event delivery/data, not permission to ban or send. Enable the needed intents in Discord Developer Portal and publish the corresponding flow. Test using a normal account: an administrator's successful test can hide channel-override problems.