Discord.js v13.7
This commit is contained in:
@@ -156,6 +156,8 @@ exports.Endpoints = {
|
||||
`${root}/stickers/${stickerId}.${stickerFormat === 'LOTTIE' ? 'json' : 'png'}`,
|
||||
RoleIcon: (roleId, hash, format = 'webp', size) =>
|
||||
makeImageUrl(`${root}/role-icons/${roleId}/${hash}`, { size, format }),
|
||||
guildScheduledEventCover: (scheduledEventId, coverHash, format, size) =>
|
||||
makeImageUrl(`${root}/guild-events/${scheduledEventId}/${coverHash}`, { size, format }),
|
||||
};
|
||||
},
|
||||
invite: (root, code, eventId) => (eventId ? `${root}/${code}?event=${eventId}` : `${root}/${code}`),
|
||||
@@ -647,6 +649,7 @@ exports.ActivityTypes = createEnum(['PLAYING', 'STREAMING', 'LISTENING', 'WATCHI
|
||||
* * `GUILD_PUBLIC_THREAD` - a guild text channel's public thread channel
|
||||
* * `GUILD_PRIVATE_THREAD` - a guild text channel's private thread channel
|
||||
* * `GUILD_STAGE_VOICE` - a guild stage voice channel
|
||||
* * `GUILD_DIRECTORY` - the channel in a hub containing guilds
|
||||
* * `UNKNOWN` - a generic channel of unknown type, could be Channel or GuildChannel
|
||||
* @typedef {string} ChannelType
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#channel-object-channel-types}
|
||||
@@ -665,6 +668,7 @@ exports.ChannelTypes = createEnum([
|
||||
'GUILD_PUBLIC_THREAD',
|
||||
'GUILD_PRIVATE_THREAD',
|
||||
'GUILD_STAGE_VOICE',
|
||||
'GUILD_DIRECTORY',
|
||||
]);
|
||||
|
||||
/**
|
||||
@@ -676,6 +680,13 @@ exports.ChannelTypes = createEnum([
|
||||
* @typedef {DMChannel|TextChannel|NewsChannel|ThreadChannel} TextBasedChannels
|
||||
*/
|
||||
|
||||
/**
|
||||
* Data that resolves to give a text-based channel. This can be:
|
||||
* * A text-based channel
|
||||
* * A snowflake
|
||||
* @typedef {TextBasedChannels|Snowflake} TextBasedChannelsResolvable
|
||||
*/
|
||||
|
||||
/**
|
||||
* The types of channels that are text-based. The available types are:
|
||||
* * DM
|
||||
@@ -1160,6 +1171,7 @@ exports.ApplicationCommandOptionTypes = createEnum([
|
||||
'ROLE',
|
||||
'MENTIONABLE',
|
||||
'NUMBER',
|
||||
'ATTACHMENT',
|
||||
]);
|
||||
|
||||
/**
|
||||
@@ -1186,6 +1198,7 @@ exports.InteractionTypes = createEnum([
|
||||
'APPLICATION_COMMAND',
|
||||
'MESSAGE_COMPONENT',
|
||||
'APPLICATION_COMMAND_AUTOCOMPLETE',
|
||||
'MODAL_SUBMIT',
|
||||
]);
|
||||
|
||||
/**
|
||||
@@ -1209,6 +1222,7 @@ exports.InteractionResponseTypes = createEnum([
|
||||
'DEFERRED_MESSAGE_UPDATE',
|
||||
'UPDATE_MESSAGE',
|
||||
'APPLICATION_COMMAND_AUTOCOMPLETE_RESULT',
|
||||
'MODAL',
|
||||
]);
|
||||
|
||||
/**
|
||||
@@ -1216,10 +1230,11 @@ exports.InteractionResponseTypes = createEnum([
|
||||
* * ACTION_ROW
|
||||
* * BUTTON
|
||||
* * SELECT_MENU
|
||||
* * TEXT_INPUT
|
||||
* @typedef {string} MessageComponentType
|
||||
* @see {@link https://discord.com/developers/docs/interactions/message-components#component-object-component-types}
|
||||
*/
|
||||
exports.MessageComponentTypes = createEnum([null, 'ACTION_ROW', 'BUTTON', 'SELECT_MENU']);
|
||||
exports.MessageComponentTypes = createEnum([null, 'ACTION_ROW', 'BUTTON', 'SELECT_MENU', 'TEXT_INPUT']);
|
||||
|
||||
/**
|
||||
* The style of a message button
|
||||
@@ -1262,6 +1277,15 @@ exports.NSFWLevels = createEnum(['DEFAULT', 'EXPLICIT', 'SAFE', 'AGE_RESTRICTED'
|
||||
*/
|
||||
exports.PrivacyLevels = createEnum([null, 'PUBLIC', 'GUILD_ONLY']);
|
||||
|
||||
/**
|
||||
* The style of a text input component
|
||||
* * SHORT
|
||||
* * PARAGRAPH
|
||||
* @typedef {string} TextInputStyle
|
||||
* @see {@link https://discord.com/developers/docs/interactions/message-components#text-inputs-text-input-styles}
|
||||
*/
|
||||
exports.TextInputStyles = createEnum([null, 'SHORT', 'PARAGRAPH']);
|
||||
|
||||
/**
|
||||
* Privacy level of a {@link GuildScheduledEvent} object:
|
||||
* * GUILD_ONLY
|
||||
@@ -1323,6 +1347,15 @@ exports.GuildScheduledEventStatuses = createEnum([null, 'SCHEDULED', 'ACTIVE', '
|
||||
*/
|
||||
exports.GuildScheduledEventEntityTypes = createEnum([null, 'STAGE_INSTANCE', 'VOICE', 'EXTERNAL']);
|
||||
/* eslint-enable max-len */
|
||||
/**
|
||||
* The camera video quality mode of a {@link VoiceChannel}:
|
||||
* * AUTO
|
||||
* * FULL
|
||||
* @typedef {string} VideoQualityMode
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#channel-object-video-quality-modes}
|
||||
*/
|
||||
exports.VideoQualityModes = createEnum([null, 'AUTO', 'FULL']);
|
||||
|
||||
exports.HypeSquadOptions = createEnum(['LEAVE', 'HOUSE_BRAVERY', 'HOUSE_BRILLIANCE', 'HOUSE_BALANCE']);
|
||||
|
||||
exports._cleanupSymbol = Symbol('djsCleanup');
|
||||
@@ -1376,6 +1409,7 @@ function createEnum(keys) {
|
||||
* @property {StickerFormatType} StickerFormatTypes The value set for a sticker's format type.
|
||||
* @property {StickerType} StickerTypes The value set for a sticker's type.
|
||||
* @property {VerificationLevel} VerificationLevels The value set for the verification levels for a guild.
|
||||
* @property {VideoQualityMode} VideoQualityModes The camera video quality mode for a {@link VoiceChannel}.
|
||||
* @property {WebhookType} WebhookTypes The value set for a webhook's type.
|
||||
* @property {WSEventType} WSEvents The type of a WebSocket message event.
|
||||
*/
|
||||
|
@@ -10,7 +10,6 @@ const {
|
||||
hyperlink,
|
||||
inlineCode,
|
||||
italic,
|
||||
memberNicknameMention,
|
||||
quote,
|
||||
roleMention,
|
||||
spoiler,
|
||||
@@ -111,15 +110,6 @@ Formatters.inlineCode = inlineCode;
|
||||
*/
|
||||
Formatters.italic = italic;
|
||||
|
||||
/**
|
||||
* Formats a user id into a member-nickname mention.
|
||||
* @method memberNicknameMention
|
||||
* @memberof Formatters
|
||||
* @param {string} memberId The user id to format.
|
||||
* @returns {string}
|
||||
*/
|
||||
Formatters.memberNicknameMention = memberNicknameMention;
|
||||
|
||||
/**
|
||||
* Formats the content into a quote. This needs to be at the start of the line for Discord to format it.
|
||||
* @method quote
|
||||
|
@@ -6,7 +6,7 @@ const JSONBig = require('json-bigint');
|
||||
/**
|
||||
* Rate limit data
|
||||
* @typedef {Object} RateLimitData
|
||||
* @property {number} timeout Time until this rate limit ends, in ms
|
||||
* @property {number} timeout Time until this rate limit ends, in milliseconds
|
||||
* @property {number} limit The maximum amount of requests of this endpoint
|
||||
* @property {string} method The HTTP method of this request
|
||||
* @property {string} path The path of the request relative to the HTTP endpoint
|
||||
@@ -77,7 +77,7 @@ const JSONBig = require('json-bigint');
|
||||
* @property {PresenceData} [presence={}] Presence data to use upon login
|
||||
* @property {IntentsResolvable} [intents] Intents to enable for this connection
|
||||
* @property {number} [waitGuildTimeout=15_000] Time in milliseconds that Clients with the GUILDS intent should wait for
|
||||
* missing guilds to be recieved before starting the bot. If not specified, the default is 15 seconds.
|
||||
* missing guilds to be received before starting the bot. If not specified, the default is 15 seconds.
|
||||
* @property {SweeperOptions} [sweepers={}] Options for cache sweeping
|
||||
* @property {WebsocketOptions} [ws] Options for the WebSocket
|
||||
* @property {HTTPOptions} [http] HTTP options
|
||||
|
@@ -16,7 +16,7 @@ class SnowflakeUtil extends null {
|
||||
* ```
|
||||
* 64 22 17 12 0
|
||||
* 000000111011000111100001101001000101000000 00001 00000 000000000000
|
||||
* number of ms since Discord epoch worker pid increment
|
||||
* number of milliseconds since Discord epoch worker pid increment
|
||||
* ```
|
||||
* @typedef {string} Snowflake
|
||||
*/
|
||||
|
@@ -192,6 +192,15 @@ class Sweepers {
|
||||
return this._sweepGuildDirectProp('stageInstances', filter, { outputName: 'stage instances' }).items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sweeps all guild stickers and removes the ones which are indicated by the filter.
|
||||
* @param {Function} filter The function used to determine which stickers will be removed from the caches.
|
||||
* @returns {number} Amount of stickers that were removed from the caches
|
||||
*/
|
||||
sweepStickers(filter) {
|
||||
return this._sweepGuildDirectProp('stickers', filter).items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sweeps all thread members and removes the ones which are indicated by the filter.
|
||||
* <info>It is highly recommended to keep the client thread member cached</info>
|
||||
|
@@ -10,6 +10,7 @@ const { Error: DiscordError, RangeError, TypeError } = require('../errors');
|
||||
const has = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
|
||||
const isObject = d => typeof d === 'object' && d !== null;
|
||||
|
||||
let deprecationEmittedForSplitMessage = false;
|
||||
let deprecationEmittedForRemoveMentions = false;
|
||||
|
||||
/**
|
||||
@@ -70,9 +71,19 @@ class Util extends null {
|
||||
* Splits a string into multiple chunks at a designated character that do not exceed a specific length.
|
||||
* @param {string} text Content to split
|
||||
* @param {SplitOptions} [options] Options controlling the behavior of the split
|
||||
* @deprecated This will be removed in the next major version.
|
||||
* @returns {string[]}
|
||||
*/
|
||||
static splitMessage(text, { maxLength = 2_000, char = '\n', prepend = '', append = '' } = {}) {
|
||||
if (!deprecationEmittedForSplitMessage) {
|
||||
process.emitWarning(
|
||||
'The Util.splitMessage method is deprecated and will be removed in the next major version.',
|
||||
'DeprecationWarning',
|
||||
);
|
||||
|
||||
deprecationEmittedForSplitMessage = true;
|
||||
}
|
||||
|
||||
text = Util.verifyString(text);
|
||||
if (text.length <= maxLength) return [text];
|
||||
let splitText = [text];
|
||||
@@ -603,6 +614,17 @@ class Util extends null {
|
||||
filter.isDefault = true;
|
||||
return filter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves the maximum time a guild's thread channels should automatcally archive in case of no recent activity.
|
||||
* @param {Guild} guild The guild to resolve this limit from.
|
||||
* @returns {number}
|
||||
*/
|
||||
static resolveAutoArchiveMaxLimit({ features }) {
|
||||
if (features.includes('SEVEN_DAY_THREAD_ARCHIVE')) return 10080;
|
||||
if (features.includes('THREE_DAY_THREAD_ARCHIVE')) return 4320;
|
||||
return 1440;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Util;
|
||||
|
Reference in New Issue
Block a user