Permission model
Community permissions are a u64 bit field. Effective access combines @everyone, assigned roles and channel overwrites. Administrator bypasses ordinary permission checks; community owners bypass both permissions and role-position checks. A moderator cannot create, edit or assign a role equal to or above their highest role.
Canonical permission values
| Bit | Constant | Meaning | Decimal value |
|---|---|---|---|
| 0 | ADMINISTRATOR | Administrator | 1 |
| 1 | VIEW_AUDIT_LOG | View audit log | 2 |
| 2 | MANAGE_GUILD | Manage community | 4 |
| 3 | MANAGE_ROLES | Manage roles | 8 |
| 4 | MANAGE_CHANNELS | Manage channels | 16 |
| 5 | KICK_MEMBERS | Kick members | 32 |
| 6 | BAN_MEMBERS | Ban members | 64 |
| 7 | CREATE_INVITES | Create invites | 128 |
| 8 | CHANGE_NICKNAME | Change nickname | 256 |
| 9 | MANAGE_NICKNAMES | Manage nicknames | 512 |
| 10 | MANAGE_EMOJIS | Manage emojis | 1024 |
| 11 | MANAGE_WEBHOOKS | Manage webhooks | 2048 |
| 12 | VIEW_GUILD_INSIGHTS | View community insights | 4096 |
| 13 | MODERATE_MEMBERS | Moderate members | 8192 |
| 14 | PROMOTE_TO_UNIVERSE | Promote to Universe | 16384 |
| 15 | VOTE_IN_POLLS | Vote in polls | 32768 |
| 20 | VIEW_CHANNEL | View channels | 1048576 |
| 21 | SEND_MESSAGES | Send messages | 2097152 |
| 22 | SEND_TTS_MESSAGES | Send TTS messages | 4194304 |
| 23 | MANAGE_MESSAGES | Manage messages | 8388608 |
| 24 | EMBED_LINKS | Embed links | 16777216 |
| 25 | ATTACH_FILES | Attach files | 33554432 |
| 26 | READ_MESSAGE_HISTORY | Read message history | 67108864 |
| 27 | MENTION_EVERYONE | Mention everyone | 134217728 |
| 28 | USE_EXTERNAL_EMOJIS | Use external emojis | 268435456 |
| 29 | ADD_REACTIONS | Add reactions | 536870912 |
| 30 | USE_APPLICATION_COMMANDS | Use application commands | 1073741824 |
| 31 | MANAGE_THREADS | Manage threads | 2147483648 |
| 32 | CREATE_PUBLIC_THREADS | Create public threads | 4294967296 |
| 33 | CREATE_PRIVATE_THREADS | Create private threads | 8589934592 |
| 34 | SEND_MESSAGES_IN_THREADS | Send messages in threads | 17179869184 |
| 40 | CONNECT | Connect | 1099511627776 |
| 41 | SPEAK | Speak | 2199023255552 |
| 42 | MUTE_MEMBERS | Mute members | 4398046511104 |
| 43 | DEAFEN_MEMBERS | Deafen members | 8796093022208 |
| 44 | MOVE_MEMBERS | Move members | 17592186044416 |
| 45 | USE_VOICE_ACTIVITY | Use voice activity | 35184372088832 |
| 46 | PRIORITY_SPEAKER | Priority speaker | 70368744177664 |
| 47 | STREAM | Stream | 140737488355328 |
| 48 | START_EMBEDDED_ACTIVITIES | Start activities | 281474976710656 |
| 50 | USE_DRIVE | Use Drive | 1125899906842624 |
| 51 | MANAGE_DRIVE | Manage Drive | 2251799813685248 |
Calculate values safely in JavaScript
JavaScript number bitwise operators truncate to 32 bits. Use BigInt for every permission calculation, then serialize the result as a decimal string in JSON and invitation query parameters.
typescript
const VIEW_CHANNEL = 1n << 20n
const SEND_MESSAGES = 1n << 21n
const READ_MESSAGE_HISTORY = 1n << 26n
const permissions = VIEW_CHANNEL | SEND_MESSAGES | READ_MESSAGE_HISTORY
console.log(permissions.toString()) // 70254592Least-privilege checklist
- Do not request Administrator as a convenience
- Separate read, publish and moderation capabilities
- Explain sensitive permissions on the consent screen
- Reinstalling a bot updates its managed role instead of duplicating membership
- The installer cannot grant permissions they do not possess