moymo,Docs
Skip to content
API Reference

Permission bits ​

Permissions in a server are a 64-bit integer: each permission is one bit. A role holds a number, a bot is given a number when it is added to a server, and the permissions parameter of an install link is that number.

A member's permissions are the sum of the @everyone role and every role they hold. The owner of a server has all of them, and so does anyone with Administrator. In a channel, permissions are then adjusted by that channel's overwrites (first the category's, then the channel's own): a bit that an overwrite denies is taken away, one it allows is given. A member who cannot View channel can do nothing in it.

A permission marked channel can be allowed or denied for one channel; the others belong to the server as a whole.

Everyday ​

NameBitValueWhereWhat it allows
VIEW_CHANNEL01channelSee channels
SEND_MESSAGES12channelSend messages
READ_HISTORY24channelRead message history
ADD_REACTIONS38channelAdd reactions
MENTION_EVERYONE416channelMention @everyone
MANAGE_MESSAGES532channelManage messages
ATTACH_FILES312147483648channelAttach files
EMBED_GAMES324294967296channelEmbed games
CREATE_INVITE1665536channelCreate invites
CHANGE_NICKNAME224194304serverChange its own nickname

Voice ​

NameBitValueWhereWhat it allows
CONNECT8256channelConnect to voice
SPEAK9512channelSpeak in voice
MUTE_MEMBERS101024channelMute members
MOVE_MEMBERS112048channelMove members
STREAM338589934592channelGo live
STREAM_REACT3417179869184channelReact over a stream

Running the server ​

NameBitValueWhereWhat it allows
MANAGE_CHANNELS17131072channelManage channels
MANAGE_ROLES18262144serverManage roles
MANAGE_SERVER19524288serverManage the server
KICK_MEMBERS201048576serverKick members
BAN_MEMBERS212097152serverBan members
MANAGE_NICKNAMES238388608serverManage nicknames
MODERATE_MEMBERS2416777216serverPut members in timeout
ADMINISTRATOR301073741824serverAdministrator (everything, in every channel)

Rooms ​

NameBitValueWhereWhat it allows
CREATE_POSTS3534359738368channelStart forum posts
MANAGE_POSTS3668719476736channelManage forum posts
TODO_ADD37137438953472channelAdd to-do rows
TODO_CHECK38274877906944channelTick to-do rows
TODO_EDIT39549755813888channelEdit others' to-do rows
TODO_MANAGE401099511627776channelManage to-do lists
DOC_EDIT412199023255552channelWrite in documents
DOC_MANAGE424398046511104channelManage documents
CREATE_POLLS438796093022208channelCreate polls
CREATE_GIVEAWAYS4417592186044416channelCreate giveaways
EVENT_CREATE4535184372088832channelCreate events
EVENT_MANAGE4670368744177664channelManage events
PARTY_CREATE47140737488355328channelCreate parties
PARTY_MANAGE48281474976710656channelManage parties

Adding them up ​

To ask for View channels (1), Send messages (2) and Read message history (4), send 1 + 2 + 4 = 7. In code, add or | the values.

Values go up to 248, which is below 253, so an ordinary JavaScript number holds them exactly - but JavaScript's | and & operators work on 32 bits and silently cut higher bits off. Use BigInt for bit arithmetic:

Adding and checking permission bits
js
const VIEW_CHANNEL = 1n << 0n
const SEND_MESSAGES = 1n << 1n
const READ_HISTORY = 1n << 2n

const permissions = VIEW_CHANNEL | SEND_MESSAGES | READ_HISTORY   // 7n
const has = (held, flag) => (held & flag) === flag

console.log(permissions.toString())   // "7" - what goes in the install link
python
VIEW_CHANNEL = 1 << 0
SEND_MESSAGES = 1 << 1
READ_HISTORY = 1 << 2

permissions = VIEW_CHANNEL | SEND_MESSAGES | READ_HISTORY   # 7

def has(held, flag):
    return held & flag == flag

print(str(permissions))   # "7" - what goes in the install link

Who may give what ​

A person can only give a role, or a bot, permissions they hold themselves; Administrator holds everything. A role can only be managed by someone whose highest role is above it. A bot's managed role is made just below the highest role of the person who added it.

The wiki is for Moymo's members and developers. Something wrong or missing? Use "Suggest a change" on any page.