Permissions Reference

NexusGuild uses Discord-compatible bitwise permission flags. Every role stores a BIGINT bitmask. A user's effective permissions are the bitwise OR of all their role bitmasks, with channel-level overrides applied on top.

Overview

Permissions are 64-bit integers (BigInt in JavaScript). Each permission is a single bit:

// Combining permissions
const canSendAndRead = SEND_MESSAGES | READ_MESSAGE_HISTORY;  // 2048 | 65536 = 67584

// Checking a permission
function hasPermission(userPerms, flag) {
  if (userPerms & BigInt(8)) return true;  // ADMINISTRATOR bypasses everything
  return (userPerms & flag) === flag;
}

How It Works

  1. Each server has an @everyone role that applies to all members.
  2. Additional roles can grant extra permissions on top.
  3. A member's effective permissions = bitwise OR of all their role permissions.
  4. Channel-level permission overrides can grant or deny specific flags per role for that channel only.
  5. Server owners bypass all permission checks — they always have full access.
  6. The ADMINISTRATOR flag grants all permissions, bypassing channel overrides too.

Default @everyone Permissions

New servers give @everyone this bitmask: 103926848

PermissionValue
VIEW_CHANNEL1024
SEND_MESSAGES2048
EMBED_LINKS16384
ATTACH_FILES32768
READ_MESSAGE_HISTORY65536
ADD_REACTIONS64
CONNECT1048576
SPEAK2097152
USE_VAD33554432
CHANGE_NICKNAME67108864

Checking Permissions in Code

Server-side (Node.js)

import { PERMISSIONS, PermissionHandler } from './config/permissions.js';

// Returns true if userPerms includes the flag (or ADMINISTRATOR)
const canSend = PermissionHandler.hasPermission(userPerms, PERMISSIONS.SEND_MESSAGES);

Client-side (via API)

// Fetch your effective permissions when joining a server
const { myPermissions } = await fetch(`/api/servers/${serverId}/members`)
  .then(r => r.json());

const perms = BigInt(myPermissions);

function hasPermission(flag) {
  if (perms & 8n) return true;    // ADMINISTRATOR
  return (perms & flag) === flag;
}

// Usage
if (hasPermission(16n)) {             // MANAGE_CHANNELS
  showCreateChannelButton();
}

Bot-side (via REST API)

// Permissions are returned as strings from the API
const roles = await fetch(`/api/v1/guilds/${guildId}/roles`, {
  headers: { Authorization: `Bot ${token}` }
}).then(r => r.json());

const modRole = roles.find(r => r.name === 'Mod');
const modPerms = BigInt(modRole.permissions);  // parse the string

General Permissions

NameValueBitDescription
CREATE_INSTANT_INVITE10Create invite links for the server
KICK_MEMBERS21Remove members from the server
BAN_MEMBERS42Permanently ban members
ADMINISTRATOR83Grants all permissions; bypasses channel overrides. Assign with care.
MANAGE_CHANNELS164Create, edit, and delete channels and categories
MANAGE_GUILD325Edit server settings (name, icon, etc.)
ADD_REACTIONS646Add emoji reactions to messages
VIEW_AUDIT_LOG1287View the server audit log
PRIORITY_SPEAKER2568Reduces others' volume when speaking in voice
STREAM5129Share screen / stream in voice channels

Text Channel Permissions

NameValueBitDescription
VIEW_CHANNEL102410See the channel in the list and read its messages
SEND_MESSAGES204811Post messages in text channels
MANAGE_MESSAGES819213Delete others' messages; pin and unpin messages
EMBED_LINKS1638414URLs in messages generate link preview cards
ATTACH_FILES3276815Upload files as message attachments
READ_MESSAGE_HISTORY6553616Load message history; scroll up in channels
MENTION_EVERYONE13107217Send @everyone and @here mentions
USE_EXTERNAL_EMOJIS26214418Use custom emojis from other servers

Voice Channel Permissions

NameValueBitDescription
CONNECT104857620Join voice channels
SPEAK209715221Transmit audio in voice channels
MUTE_MEMBERS419430422Server-mute other members in voice
DEAFEN_MEMBERS838860823Server-deafen other members in voice
MOVE_MEMBERS1677721624Move members between voice channels
USE_VAD3355443225Use voice activity detection (no push-to-talk required)

Nickname Permissions

NameValueBitDescription
CHANGE_NICKNAME6710886426Change your own nickname in this server
MANAGE_NICKNAMES13421772827Change other members' nicknames

Server Management

NameValueBitDescription
MANAGE_ROLES26843545628Create, edit, and delete roles; assign roles to members
MANAGE_WEBHOOKS53687091229Create and manage incoming webhooks
MANAGE_GUILD_EXPRESSIONS107374182430Upload and delete custom emojis
USE_APPLICATION_COMMANDS214748364831Use bot slash commands in this server
REQUEST_TO_SPEAK429496729632Request to speak in Stage channels
MANAGE_EVENTS858993459233Create and manage scheduled events

Thread Permissions

NameValueBitDescription
MANAGE_THREADS1717986918434Delete and archive threads; rename threads
CREATE_PUBLIC_THREADS3435973836835Create public threads inside forum channels
CREATE_PRIVATE_THREADS6871947673636Create private (invite-only) threads
SEND_MESSAGES_IN_THREADS27487790694438Send messages in existing threads

Moderation

NameValueBitDescription
MODERATE_MEMBERS109951162777640Timeout members (temporarily restrict messaging)

Quick Reference — All Flags

// All NexusGuild permission constants
const PERMISSIONS = {
  CREATE_INSTANT_INVITE:    1n,
  KICK_MEMBERS:             2n,
  BAN_MEMBERS:              4n,
  ADMINISTRATOR:            8n,
  MANAGE_CHANNELS:          16n,
  MANAGE_GUILD:             32n,
  ADD_REACTIONS:            64n,
  VIEW_AUDIT_LOG:           128n,
  PRIORITY_SPEAKER:         256n,
  STREAM:                   512n,

  VIEW_CHANNEL:             1024n,
  SEND_MESSAGES:            2048n,
  MANAGE_MESSAGES:          8192n,
  EMBED_LINKS:              16384n,
  ATTACH_FILES:             32768n,
  READ_MESSAGE_HISTORY:     65536n,
  MENTION_EVERYONE:         131072n,
  USE_EXTERNAL_EMOJIS:      262144n,

  CONNECT:                  1048576n,
  SPEAK:                    2097152n,
  MUTE_MEMBERS:             4194304n,
  DEAFEN_MEMBERS:           8388608n,
  MOVE_MEMBERS:             16777216n,
  USE_VAD:                  33554432n,

  CHANGE_NICKNAME:          67108864n,
  MANAGE_NICKNAMES:         134217728n,

  MANAGE_ROLES:             268435456n,
  MANAGE_WEBHOOKS:          536870912n,
  MANAGE_GUILD_EXPRESSIONS: 1073741824n,
  USE_APPLICATION_COMMANDS: 2147483648n,
  REQUEST_TO_SPEAK:         4294967296n,
  MANAGE_EVENTS:            8589934592n,

  MANAGE_THREADS:           17179869184n,
  CREATE_PUBLIC_THREADS:    34359738368n,
  CREATE_PRIVATE_THREADS:   68719476736n,
  SEND_MESSAGES_IN_THREADS: 274877906944n,

  MODERATE_MEMBERS:         1099511627776n,
};