Skip to content
Developers
Menu

Permissions

How a bot gets its permissions, how Palloo works out what it may do in each channel, and every permission bit.

On this page

How a bot gets its permissions

When someone adds your bot to a server, they choose its permissions, and they can only give permissions they have themselves. Palloo creates a managed role named after the bot that holds exactly those bits, puts it at position 1 (just above @everyone) and gives it to the bot.

  • The managed role has managed: true and bot_id set on the Role object.
  • It cannot be deleted, given to anyone else or taken off the bot (400 managed_role). Its permissions, name, color, position and channel overwrites can be changed like any other role's, so a server can widen or narrow what your bot may do later.
  • The bot also has everything @everyone has, and any other role a member gives it.
  • When the bot leaves, is kicked or is banned, its managed role is deleted with it.

Because the managed role starts at the bottom, your bot can only manage members and roles below it. Ask server owners to move the role up if your bot needs to moderate people.

Permissions are strings

Permission sets are 64-bit numbers. JavaScript numbers cannot hold 64 bits exactly, so the API sends them as decimal strings, such as "601195143". Parse them with BigInt in JavaScript:

JavaScript
const SEND_MESSAGES = 1n << 1n;
const canSend = (BigInt(role.permissions) & SEND_MESSAGES) !== 0n;

Send them back as strings too. A bit Palloo does not know answers 400 invalid_permissions.

Working out permissions in a channel

Palloo uses the same order as Discord:

  1. Start with the @everyone role's permissions, then add the permissions of every role the member has.
  2. If that includes Administrator, the member has every permission everywhere and overwrites do not apply.
  3. In a channel, apply the @everyone overwrite (remove its denied bits, then add its allowed ones), then the role overwrites of all the member's roles together (all denials, then all allows), then the member's own overwrite.
  4. Without View Channel at the end, the member has no permissions in that channel at all.

The server owner has every permission. A timed-out member keeps only View Channel and Read Message History. GET /communities/{id}/members/@me/permissions tells your bot what it has.

If a server requires two-factor authentication for moderation, members without it lose the bits marked "Server 2FA" below. For a bot, its owner's account counts: turn two-factor authentication on for your own account if your bot moderates.

Hierarchy

Managing a role or a member (changing roles, nicknames, kicking, banning, timing out) needs the target below the caller's highest role, and a bot can never give a permission it does not have. The owner is above everyone.

Permission bits

Generated from the server's permission definitions. "Channel" means the bit can be set in a channel's permission overwrites; the others only apply from roles. "@everyone" marks the bits a new server's @everyone role has. "Server 2FA" marks the bits that a server requiring two-factor authentication for moderation removes from members without it (for a bot, its owner's two-factor setting counts).

Permission bits
Value Bit Permission Channel @everyone Server 2FA
1 1 << 0 View Channel See channels and read new messages in them. Without it, a channel is hidden and answers 404. Yes Yes No
2 1 << 1 Send Messages Send messages in text channels, and answer slash commands with messages everyone sees. Yes Yes No
4 1 << 2 Read Message History Read messages sent before the connection loaded the channel. Without it, only new messages arrive. Yes Yes No
8 1 << 3 Manage Messages Delete other people's messages, pin and unpin, and remove attachments. Yes No Yes
16 1 << 4 Manage Channels Create, edit, reorder and delete channels. Yes No Yes
32 1 << 5 Manage Roles Create and edit roles below the highest role, give and take them, and change channel overwrites. Yes No Yes
64 1 << 6 Manage Community Edit the server, see and revoke its invites, and add bots. Shown as Manage server in the app. No No Yes
128 1 << 7 Create Invites Create invites. No Yes No
256 1 << 8 Kick Members Remove members below the highest role. No No Yes
512 1 << 9 Change Nickname Change their own nickname. No Yes No
1024 1 << 10 Manage Nicknames Change the nicknames of members below the highest role. No No No
2048 1 << 11 Administrator Every permission in every channel. Overwrites do not apply; role order still limits what can be changed. No No Yes
4096 1 << 12 Ban Members Ban and unban members below the highest role, and read the ban list. No No Yes
8192 1 << 13 Moderate Members Time out members below the highest role and work through the server's reports. No No Yes
16384 1 << 14 Mention Everyone Ping @everyone and @here, and mention roles that are not mentionable. Yes No No
32768 1 << 15 Connect Join voice channels. Yes Yes No
65536 1 << 16 Speak Talk in voice channels. Yes Yes No
131072 1 << 17 Manage Webhooks Create, rename, delete and regenerate the tokens of webhooks. Yes No Yes
262144 1 << 18 Use Commands Use slash commands. Yes Yes No
524288 1 << 19 View Audit Log Read the server's moderation log. No No No
1048576 1 << 20 Attach Files Attach files to messages (Send Messages is needed too). Yes Yes No
2097152 1 << 21 Manage Threads Rename, archive, lock and delete threads, remove people from them, and see private threads. Yes No Yes
4194304 1 << 22 Create Public Threads Start public threads. Yes Yes No
8388608 1 << 23 Create Private Threads Start private threads. Yes Yes No
16777216 1 << 24 Send Messages in Threads Send messages in threads. Separate from Send Messages, as on Discord. Yes Yes No
33554432 1 << 25 Video Turn on a camera and share a screen in voice channels. Yes Yes No
67108864 1 << 26 Mute Members Mute other members in voice channels for everyone. Yes No Yes
134217728 1 << 27 Deafen Members Deafen other members in voice channels. Yes No Yes
268435456 1 << 28 Move Members Move members between voice channels and disconnect them. Yes No Yes
536870912 1 << 29 Use Voice Activity Talk without push to talk. Yes Yes No
1073741824 1 << 30 Priority Speaker Make others quieter while talking. Yes No No
2147483648 1 << 31 Add Reactions Yes Yes No
34359738368 1 << 35 Manage Expressions No No Yes

A new server's @everyone role holds 2748678791. Every bit not listed here is reserved, and sending it answers 400 invalid_permissions.