# Fake permissions

Source: https://righteousbot.dev/docs/protection/fake-permissions/

Let a role run bot commands without holding the permission in Discord.

A fake permission passes Righteous' own checks without being a Discord permission. Grant `BAN_MEMBERS`
and the role can run [`,ban`](/commands/moderation/ban/#ban), while Discord's ban button stays greyed
out. Every [`,fakepermissions`](/commands/server-tools/fakepermissions/#fakepermissions) command
(alias `,fp`) is **Server Owner** only, so a fake permission can never be used to grant more of them.

## Grant a permission to a role [#grant-a-permission-to-a-role]

[`,fp add`](/commands/server-tools/fakepermissions/#fakepermissions-add) takes a role (mention, ID, or one
word of its name, matching the first role containing it) and one permission, in `SCREAMING_CASE`. Grants
belong to the role, so members gain and lose them with it. They apply immediately.

<CommandBlock syntax=",fakepermissions add <role> <permission>" example=",fp add @Moderator BAN_MEMBERS" />

* One permission per run. A duplicate is refused. `/fp add` autocompletes names.
* [`,fp type`](/commands/server-tools/fakepermissions/#fakepermissions-type) lists every valid name.
* Renamed permissions still match: a stored `MANAGE_CHANNEL` satisfies `MANAGE_CHANNELS`.

<Callout type="warn" title="Server-wide, never per channel">
  A role granted `MANAGE_MESSAGES` has it everywhere the bot works. For one channel, use Discord's own
  overwrites instead.
</Callout>

<Callout type="warn" title="A fake ADMINISTRATOR opens everything">
  It satisfies every command's permission gate, like a real administrator. One grant opens
  [`,config`](/commands/server-tools/config/#config), [`,log`](/commands/server-tools/log/#log) and every
  other permission-gated command. A few checks inside a command (such as assigning roles) match the
  exact permission and don't accept it.
</Callout>

## Take permissions back and review them [#take-permissions-back-and-review-them]

| Command                                                                                            | Does                                                                     |
| -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| [`,fp remove <role> <permission>`](/commands/server-tools/fakepermissions/#fakepermissions-remove) | Removes one permission from one role                                     |
| [`,fp list`](/commands/server-tools/fakepermissions/#fakepermissions-list)                         | Every role and permission pair, paginated                                |
| [`,permissions view`](/commands/info/permissions/#permissions-view)                                | One member's real and fake permissions, and flags a fake `ADMINISTRATOR` |

<CommandBlock syntax=",fakepermissions remove <role> <permission>" example=",fp remove @Moderator BAN_MEMBERS" />

## Clear every grant [#clear-every-grant]

[`,fp reset`](/commands/server-tools/fakepermissions/#fakepermissions-reset) empties the table for the
whole server and has no undo. It asks for the word `confirm`.

<CommandBlock syntax=",fakepermissions reset confirm" example=",fp reset confirm" />

<Callout type="error" title="This clears every role, not just one">
  There is no per-role form. To take one permission off one role, use `,fp remove`. Reaching for `reset`
  by mistake deletes your whole staff setup.
</Callout>

## Pick grants for your staff [#pick-grants-for-your-staff]

There is no preset. Start here and trim, granting the narrowest thing that opens the command.

| Staff level      | Grant                                                 | Opens                                                                                                   |
| ---------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| Trial moderator  | `MANAGE_MESSAGES`                                     | [`,clear`](/commands/moderation/clear/#clear) and message moderation                                    |
| Moderator        | `MANAGE_MESSAGES`, `MODERATE_MEMBERS`, `KICK_MEMBERS` | Adds [`,timeout`](/commands/moderation/timeout/#timeout) and [`,kick`](/commands/moderation/kick/#kick) |
| Senior moderator | `BAN_MEMBERS`, `MANAGE_ROLES`                         | [`,ban`](/commands/moderation/ban/#ban) and the roles the bot manages                                   |
| Manager          | `MANAGE_GUILD`                                        | Server settings, the [trap channel](/docs/protection/trap-channel/), most server tools                  |
| Nobody           | `ADMINISTRATOR`                                       | Everything permission-gated. Use it deliberately or not at all                                          |

## What a fake permission will not do [#what-a-fake-permission-will-not-do]

* **Nothing outside Righteous.** Discord is never told: no right-click ban, no extra channels, nothing
  from other bots.
* **Not the server-owner commands.** [`,antinuke`](/commands/server-tools/antinuke/#antinuke),
  [`,stripstaff`](/commands/server-tools/stripstaff/#stripstaff),
  [`,staff`](/commands/server-tools/staff/#staff-add) and `,fakepermissions` check for the actual owner,
  which not even fake `ADMINISTRATOR` satisfies. Otherwise someone holding it could switch off the
  protection meant to contain them.
* **No immunity to filters or the trap.** [Message filters](/docs/protection/message-filters/) and the
  [trap channel](/docs/protection/trap-channel/) exempt only the server owner and whoever you added with
  [`,filter whitelist add`](/commands/server-tools/filter/#filter-whitelist) or
  [`,trap whitelist add`](/commands/server-tools/trap/#trap-whitelist). A fake `ADMINISTRATOR` still has
  invites deleted and still walks into the trap.
* **No outranking.** Commands that act on a member also refuse the server owner and anyone whose highest
  role is not below the caller's. Fake permissions don't touch that check, so a fake `ADMINISTRATOR` at
  the bottom of the role list is refused on anyone above them.

Gated slash commands stay visible to everyone, and a member without the permission gets a private
refusal. Discord hides commands by real permissions before the bot is asked, which would make fake ones
useless.

## Common issues [#common-issues]

**"Invalid Permission".** The name isn't one the bot accepts. Copy it from `,fp type` or use `/fp add`.

**"Invalid Role".** Nothing matched. Mention the role or paste its ID: a name with a space matches only
on its first word.

**"Fake Permission already exists for this role".** It already has it. Check `,fp list`.

**A member with a fake permission still can't run the command.** Check in order: they hold the role, the
command isn't owner-only, and the hierarchy isn't refusing their target. `,permissions view` settles the first.

**A fake ADMINISTRATOR opened more than expected.** It satisfies every check. Remove it and grant
specific permissions.

More in [Protection never fires](/docs/common-issues/#protection-never-fires).
