75 lines
1.9 KiB
JavaScript
75 lines
1.9 KiB
JavaScript
'use strict';
|
|
const BitField = require('./BitField');
|
|
|
|
/**
|
|
* Data structure that makes it easy to calculate intents.
|
|
* @extends {BitField}
|
|
*/
|
|
class Intents extends BitField {}
|
|
|
|
/**
|
|
* @name Intents
|
|
* @kind constructor
|
|
* @memberof Intents
|
|
* @param {IntentsResolvable} [bits=0] Bit(s) to read from
|
|
*/
|
|
|
|
/**
|
|
* Data that can be resolved to give a permission number. This can be:
|
|
* * A string (see {@link Intents.FLAGS})
|
|
* * An intents flag
|
|
* * An instance of Intents
|
|
* * An array of IntentsResolvable
|
|
* @typedef {string|number|Intents|IntentsResolvable[]} IntentsResolvable
|
|
*/
|
|
|
|
/**
|
|
* Numeric WebSocket intents. All available properties:
|
|
* * `GUILDS`
|
|
* * `GUILD_MEMBERS`
|
|
* * `GUILD_BANS`
|
|
* * `GUILD_EMOJIS_AND_STICKERS`
|
|
* * `GUILD_INTEGRATIONS`
|
|
* * `GUILD_WEBHOOKS`
|
|
* * `GUILD_INVITES`
|
|
* * `GUILD_VOICE_STATES`
|
|
* * `GUILD_PRESENCES`
|
|
* * `GUILD_MESSAGES`
|
|
* * `GUILD_MESSAGE_REACTIONS`
|
|
* * `GUILD_MESSAGE_TYPING`
|
|
* * `DIRECT_MESSAGES`
|
|
* * `DIRECT_MESSAGE_REACTIONS`
|
|
* * `DIRECT_MESSAGE_TYPING`
|
|
* * `MESSAGE_CONTENT`
|
|
* * `GUILD_SCHEDULED_EVENTS`
|
|
* * `AUTO_MODERATION_CONFIGURATION`
|
|
* * `AUTO_MODERATION_EXECUTION`
|
|
* @type {Object}
|
|
* @see {@link https://discord.com/developers/docs/topics/gateway#list-of-intents}
|
|
*/
|
|
Intents.FLAGS = {
|
|
GUILDS: 1 << 0,
|
|
GUILD_MEMBERS: 1 << 1,
|
|
GUILD_BANS: 1 << 2,
|
|
GUILD_EMOJIS_AND_STICKERS: 1 << 3,
|
|
GUILD_INTEGRATIONS: 1 << 4,
|
|
GUILD_WEBHOOKS: 1 << 5,
|
|
GUILD_INVITES: 1 << 6,
|
|
GUILD_VOICE_STATES: 1 << 7,
|
|
GUILD_PRESENCES: 1 << 8,
|
|
GUILD_MESSAGES: 1 << 9,
|
|
GUILD_MESSAGE_REACTIONS: 1 << 10,
|
|
GUILD_MESSAGE_TYPING: 1 << 11,
|
|
DIRECT_MESSAGES: 1 << 12,
|
|
DIRECT_MESSAGE_REACTIONS: 1 << 13,
|
|
DIRECT_MESSAGE_TYPING: 1 << 14,
|
|
MESSAGE_CONTENT: 1 << 15,
|
|
GUILD_SCHEDULED_EVENTS: 1 << 16,
|
|
AUTO_MODERATION_CONFIGURATION: 1 << 20,
|
|
AUTO_MODERATION_EXECUTION: 1 << 21,
|
|
};
|
|
|
|
Intents.ALL = Object.values(Intents.FLAGS).reduce((all, p) => all | p, 0);
|
|
|
|
module.exports = Intents;
|