Compare commits

...

12 Commits

Author SHA1 Message Date
Vlad Frangu
0d1d54a537 chore(ws): release @discordjs/ws@2.0.2 2025-04-26 01:09:37 +03:00
Vlad Frangu
dd8bb397a8 chore(deps): bump discord-api-types round at least 2 2025-04-26 01:08:54 +03:00
Vlad Frangu
61d3d6d4ae chore: bump builders and ws 2025-04-26 00:59:43 +03:00
Vlad Frangu
512b0c67b9 chore(rest): release @discordjs/rest@2.5.0 2025-04-26 00:07:10 +03:00
Vlad Frangu
532c3842bc fix: correctly extend CachedManager in GuildSoundboardSoundManager 2025-04-25 23:52:21 +03:00
Qjuh
edace17a13 feat: components v2 in v14 (#10781)
Co-authored-by: Naiyar <137700126+imnaiyar@users.noreply.github.com>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Vlad Frangu <me@vladfrangu.dev>
Co-authored-by: Timo <mail@geniustimo.de>
2025-04-25 23:43:09 +03:00
Danial Raza
d3154cf8f1 feat: add soundboard in v14 (#10843) 2025-04-25 23:37:03 +03:00
René
45552faf02 types: make Client.on() compatible with esnext.disposable in TS5.6+ (#10773) 2025-02-24 11:39:22 +02:00
Danial Raza
ebfd52695e fix(MessagePayload): preserve existing flags when editing (#10766)
* fix(MessagePayload): preserve existing flags when editing

* refactor: sync with #10765
2025-02-21 15:21:16 +00:00
Vlad Frangu
595bded8a5 chore(discord.js): release discord.js@14.18.0 2025-02-11 01:05:37 +02:00
Vlad Frangu
c74c632cdb build: bump @discordjs/ws to 1.2.1 2025-02-11 01:04:37 +02:00
Vlad Frangu
fc003050de build: bump @discordjs/builders to 1.10.1 2025-02-11 00:57:15 +02:00
54 changed files with 1800 additions and 187 deletions

View File

@@ -565,7 +565,7 @@ describe('Slash Commands', () => {
});
describe('integration types', () => {
test('GIVEN a builder with valid integraton types THEN does not throw an error', () => {
test('GIVEN a builder with valid integration types THEN does not throw an error', () => {
expect(() =>
getBuilder().setIntegrationTypes([
ApplicationIntegrationType.GuildInstall,

View File

@@ -70,7 +70,7 @@
"@discordjs/ws": "workspace:^",
"@sapphire/snowflake": "^3.5.3",
"@vladfrangu/async_event_emitter": "^2.4.6",
"discord-api-types": "^0.37.119"
"discord-api-types": "^0.38.1"
},
"devDependencies": {
"@discordjs/api-extractor": "workspace:^",

View File

@@ -2,6 +2,47 @@
All notable changes to this project will be documented in this file.
# [14.18.0](https://github.com/discordjs/discord.js/compare/14.17.3...14.18.0) - (2025-02-10)
## Bug Fixes
- **Guild:** Type error with permissionOverwrites (#10527) ([8e1e1be](https://github.com/discordjs/discord.js/commit/8e1e1be0c23a0a063a6b530ac8cee30cf7629644))
- Incorrect relative path (#10734) ([b7f1ebc](https://github.com/discordjs/discord.js/commit/b7f1ebc334e110be3208c476b61b82a69386fd84))
- **PresenceUpdate:** Correctly add user regardless of their properties (#10672) ([7c1b73c](https://github.com/discordjs/discord.js/commit/7c1b73cc697fd3b85011bdb2c098ca3a3f863b1f))
- **InteractionResponses:** Mark replied true for followUps (#10688) ([32dff01](https://github.com/discordjs/discord.js/commit/32dff01f291271bde3cfb354964ed140a6fa82d7))
## Documentation
- Use link tags to render links on the documentation (#10731) ([66b9718](https://github.com/discordjs/discord.js/commit/66b971899ab702240642e3ae2d189fd9e7efc701))
- **Message:** Improve message snapshots description (#10709) ([31df3d2](https://github.com/discordjs/discord.js/commit/31df3d21cdc53400672924bc7c5dc7fd3053630b))
## Features
- Message forwards (#10733) ([89c076c](https://github.com/discordjs/discord.js/commit/89c076c89e90e8f5912786e8899ced9e8eea6003))
- Incident Actions (#10727) ([41dee51](https://github.com/discordjs/discord.js/commit/41dee5177d9cb15f667e60a34619882222bf249c))
- **website:** Type parameters links, builtin doc links, default values (#10515) ([43235d4](https://github.com/discordjs/discord.js/commit/43235d43fe76e26805c52dcff13519652bcb6a4a))
- **PartialGroupDMChannel:** Add missing properties (#10502) ([5e66f85](https://github.com/discordjs/discord.js/commit/5e66f85f55724a583921252b035eb2097345fec8))
- **Subscription:** Add `renewalSkuIds` (#10662) ([efa50fc](https://github.com/discordjs/discord.js/commit/efa50fc3fa463b09bde11c1640daa2abb8c22686))
- **website:** Include reexported members in docs (#10518) ([aa61c20](https://github.com/discordjs/discord.js/commit/aa61c20ffdac3f3a0dca224f9e48e614309ecb2e))
## Refactor
- Use throw instead of Promise.reject (#10712) ([2663d76](https://github.com/discordjs/discord.js/commit/2663d767099f2e14a23f9cbfb868f279ffb253d1))
- Remove data resolver exports (#10701) ([4606041](https://github.com/discordjs/discord.js/commit/46060419a9593dc5132ba6f13b58d0c18613679b))
- **IntegrationApplication:** Move common properties to Application (#10627) ([95db597](https://github.com/discordjs/discord.js/commit/95db597fc844e7951b07cfb5741e27086ac7451a))
## Styling
- Prettier ([92aea94](https://github.com/discordjs/discord.js/commit/92aea944119638b12c03be0f627f20fe5fe5145e))
## Typings
- Fix recurrence rule types (#10694) ([193a5e9](https://github.com/discordjs/discord.js/commit/193a5e9e20fc4832592b2a3b6f142752121f43d5))
- **ThreadOnlyChannel:** Remove incorrect `messages` property (#10708) ([44a1e85](https://github.com/discordjs/discord.js/commit/44a1e858473a51809cb1e6114d6a659fe28587f0))
- Add `undefined` to `flags` for `exactOptionalPropertyTypes` (#10707) ([d2e1924](https://github.com/discordjs/discord.js/commit/d2e1924fa6a06120879a1158d501a899db3d6d96))
- Allow only ephemeral for defer reply (#10696) ([68dd260](https://github.com/discordjs/discord.js/commit/68dd260dee1a7b0bbd4fcdff1b39283ea8dcedec))
- Remove createComponent and createComponentBuilder (#10687) ([0047a49](https://github.com/discordjs/discord.js/commit/0047a49b7395acf0936702f233e7fb89e9f352fe))
# [14.17.3](https://github.com/discordjs/discord.js/compare/14.17.2...14.17.3) - (2025-01-08)
## Bug Fixes

View File

@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "discord.js",
"version": "14.17.3",
"version": "14.18.0",
"description": "A powerful library for interacting with the Discord API",
"scripts": {
"test": "pnpm run docs:test && pnpm run test:typescript",
@@ -65,16 +65,17 @@
"homepage": "https://discord.js.org",
"funding": "https://github.com/discordjs/discord.js?sponsor",
"dependencies": {
"@discordjs/builders": "^1.10.0",
"@discordjs/builders": "^1.11.1",
"@discordjs/collection": "1.5.3",
"@discordjs/formatters": "^0.6.0",
"@discordjs/formatters": "^0.6.1",
"@discordjs/rest": "workspace:^",
"@discordjs/util": "workspace:^",
"@discordjs/ws": "^1.2.0",
"@discordjs/ws": "^1.2.2",
"@sapphire/snowflake": "3.5.3",
"discord-api-types": "^0.37.119",
"discord-api-types": "^0.38.1",
"fast-deep-equal": "3.1.3",
"lodash.snakecase": "4.1.1",
"magic-bytes.js": "^1.10.0",
"tslib": "^2.6.3",
"undici": "6.21.1"
},

View File

@@ -18,6 +18,7 @@ const ClientPresence = require('../structures/ClientPresence');
const GuildPreview = require('../structures/GuildPreview');
const GuildTemplate = require('../structures/GuildTemplate');
const Invite = require('../structures/Invite');
const { SoundboardSound } = require('../structures/SoundboardSound');
const { Sticker } = require('../structures/Sticker');
const StickerPack = require('../structures/StickerPack');
const VoiceRegion = require('../structures/VoiceRegion');
@@ -390,6 +391,19 @@ class Client extends BaseClient {
return this.fetchStickerPacks();
}
/**
* Obtains the list of default soundboard sounds.
* @returns {Promise<Collection<string, SoundboardSound>>}
* @example
* client.fetchDefaultSoundboardSounds()
* .then(sounds => console.log(`Available soundboard sounds are: ${sounds.map(sound => sound.name).join(', ')}`))
* .catch(console.error);
*/
async fetchDefaultSoundboardSounds() {
const data = await this.rest.get(Routes.soundboardDefaultSounds());
return new Collection(data.map(sound => [sound.sound_id, new SoundboardSound(this, sound)]));
}
/**
* Obtains a guild preview from Discord, available for all guilds the bot is in and all Discoverable guilds.
* @param {GuildResolvable} guild The guild to fetch the preview for

View File

@@ -112,6 +112,10 @@ class GenericAction {
return this.getPayload({ user_id: id }, manager, id, Partials.ThreadMember, false);
}
getSoundboardSound(data, guild) {
return this.getPayload(data, guild.soundboardSounds, data.sound_id, Partials.SoundboardSound);
}
spreadInjectedData(data) {
return Object.fromEntries(Object.getOwnPropertySymbols(data).map(symbol => [symbol, data[symbol]]));
}

View File

@@ -43,6 +43,7 @@ class ActionsManager {
this.register(require('./GuildScheduledEventUpdate'));
this.register(require('./GuildScheduledEventUserAdd'));
this.register(require('./GuildScheduledEventUserRemove'));
this.register(require('./GuildSoundboardSoundDelete.js'));
this.register(require('./GuildStickerCreate'));
this.register(require('./GuildStickerDelete'));
this.register(require('./GuildStickerUpdate'));

View File

@@ -0,0 +1,29 @@
'use strict';
const Action = require('./Action.js');
const Events = require('../../util/Events.js');
class GuildSoundboardSoundDeleteAction extends Action {
handle(data) {
const guild = this.client.guilds.cache.get(data.guild_id);
if (!guild) return {};
const soundboardSound = this.getSoundboardSound(data, guild);
if (soundboardSound) {
guild.soundboardSounds.cache.delete(soundboardSound.soundId);
/**
* Emitted whenever a soundboard sound is deleted in a guild.
* @event Client#guildSoundboardSoundDelete
* @param {SoundboardSound} soundboardSound The soundboard sound that was deleted
*/
this.client.emit(Events.GuildSoundboardSoundDelete, soundboardSound);
}
return { soundboardSound };
}
}
module.exports = GuildSoundboardSoundDeleteAction;

View File

@@ -0,0 +1,24 @@
'use strict';
const { Collection } = require('@discordjs/collection');
const Events = require('../../../util/Events.js');
module.exports = (client, { d: data }) => {
const guild = client.guilds.cache.get(data.guild_id);
if (!guild) return;
const soundboardSounds = new Collection();
for (const soundboardSound of data.soundboard_sounds) {
soundboardSounds.set(soundboardSound.sound_id, guild.soundboardSounds._add(soundboardSound));
}
/**
* Emitted whenever multiple guild soundboard sounds are updated.
* @event Client#guildSoundboardSoundsUpdate
* @param {Collection<Snowflake, SoundboardSound>} soundboardSounds The updated soundboard sounds
* @param {Guild} guild The guild that the soundboard sounds are from
*/
client.emit(Events.GuildSoundboardSoundsUpdate, soundboardSounds, guild);
};

View File

@@ -0,0 +1,18 @@
'use strict';
const Events = require('../../../util/Events.js');
module.exports = (client, { d: data }) => {
const guild = client.guilds.cache.get(data.guild_id);
if (!guild) return;
const soundboardSound = guild.soundboardSounds._add(data);
/**
* Emitted whenever a guild soundboard sound is created.
* @event Client#guildSoundboardSoundCreate
* @param {SoundboardSound} soundboardSound The created guild soundboard sound
*/
client.emit(Events.GuildSoundboardSoundCreate, soundboardSound);
};

View File

@@ -0,0 +1,5 @@
'use strict';
module.exports = (client, { d: data }) => {
client.actions.GuildSoundboardSoundDelete.handle(data);
};

View File

@@ -0,0 +1,20 @@
'use strict';
const Events = require('../../../util/Events.js');
module.exports = (client, { d: data }) => {
const guild = client.guilds.cache.get(data.guild_id);
if (!guild) return;
const oldGuildSoundboardSound = guild.soundboardSounds.cache.get(data.sound_id)?._clone() ?? null;
const newGuildSoundboardSound = guild.soundboardSounds._add(data);
/**
* Emitted whenever a guild soundboard sound is updated.
* @event Client#guildSoundboardSoundUpdate
* @param {?SoundboardSound} oldGuildSoundboardSound The guild soundboard sound before the update
* @param {SoundboardSound} newGuildSoundboardSound The guild soundboard sound after the update
*/
client.emit(Events.GuildSoundboardSoundUpdate, oldGuildSoundboardSound, newGuildSoundboardSound);
};

View File

@@ -0,0 +1,24 @@
'use strict';
const { Collection } = require('@discordjs/collection');
const Events = require('../../../util/Events.js');
module.exports = (client, { d: data }) => {
const guild = client.guilds.cache.get(data.guild_id);
if (!guild) return;
const soundboardSounds = new Collection();
for (const soundboardSound of data.soundboard_sounds) {
soundboardSounds.set(soundboardSound.sound_id, guild.soundboardSounds._add(soundboardSound));
}
/**
* Emitted whenever soundboard sounds are received (all soundboard sounds come from the same guild).
* @event Client#soundboardSounds
* @param {Collection<Snowflake, SoundboardSound>} soundboardSounds The sounds received
* @param {Guild} guild The guild that the soundboard sounds are from
*/
client.emit(Events.SoundboardSounds, soundboardSounds, guild);
};

View File

@@ -32,6 +32,10 @@ const handlers = Object.fromEntries([
['GUILD_SCHEDULED_EVENT_UPDATE', require('./GUILD_SCHEDULED_EVENT_UPDATE')],
['GUILD_SCHEDULED_EVENT_USER_ADD', require('./GUILD_SCHEDULED_EVENT_USER_ADD')],
['GUILD_SCHEDULED_EVENT_USER_REMOVE', require('./GUILD_SCHEDULED_EVENT_USER_REMOVE')],
['GUILD_SOUNDBOARD_SOUNDS_UPDATE', require('./GUILD_SOUNDBOARD_SOUNDS_UPDATE.js')],
['GUILD_SOUNDBOARD_SOUND_CREATE', require('./GUILD_SOUNDBOARD_SOUND_CREATE.js')],
['GUILD_SOUNDBOARD_SOUND_DELETE', require('./GUILD_SOUNDBOARD_SOUND_DELETE.js')],
['GUILD_SOUNDBOARD_SOUND_UPDATE', require('./GUILD_SOUNDBOARD_SOUND_UPDATE.js')],
['GUILD_STICKERS_UPDATE', require('./GUILD_STICKERS_UPDATE')],
['GUILD_UPDATE', require('./GUILD_UPDATE')],
['INTERACTION_CREATE', require('./INTERACTION_CREATE')],
@@ -50,6 +54,7 @@ const handlers = Object.fromEntries([
['PRESENCE_UPDATE', require('./PRESENCE_UPDATE')],
['READY', require('./READY')],
['RESUMED', require('./RESUMED')],
['SOUNDBOARD_SOUNDS', require('./SOUNDBOARD_SOUNDS.js')],
['STAGE_INSTANCE_CREATE', require('./STAGE_INSTANCE_CREATE')],
['STAGE_INSTANCE_DELETE', require('./STAGE_INSTANCE_DELETE')],
['STAGE_INSTANCE_UPDATE', require('./STAGE_INSTANCE_UPDATE')],

View File

@@ -106,6 +106,7 @@
* @property {'GuildChannelUnowned'} GuildChannelUnowned
* @property {'GuildOwned'} GuildOwned
* @property {'GuildMembersTimeout'} GuildMembersTimeout
* @property {'GuildSoundboardSoundsTimeout'} GuildSoundboardSoundsTimeout
* @property {'GuildUncachedMe'} GuildUncachedMe
* @property {'ChannelNotCached'} ChannelNotCached
* @property {'StageChannelResolve'} StageChannelResolve
@@ -131,6 +132,8 @@
* @property {'MissingManageEmojisAndStickersPermission'} MissingManageEmojisAndStickersPermission
* <warn>This property is deprecated. Use `MissingManageGuildExpressionsPermission` instead.</warn>
*
* @property {'NotGuildSoundboardSound'} NotGuildSoundboardSound
* @property {'NotGuildSticker'} NotGuildSticker
* @property {'ReactionResolveUser'} ReactionResolveUser
@@ -266,6 +269,7 @@ const keys = [
'GuildChannelUnowned',
'GuildOwned',
'GuildMembersTimeout',
'GuildSoundboardSoundsTimeout',
'GuildUncachedMe',
'ChannelNotCached',
'StageChannelResolve',
@@ -290,6 +294,7 @@ const keys = [
'MissingManageGuildExpressionsPermission',
'MissingManageEmojisAndStickersPermission',
'NotGuildSoundboardSound',
'NotGuildSticker',
'ReactionResolveUser',

View File

@@ -91,6 +91,7 @@ const Messages = {
[DjsErrorCodes.GuildChannelUnowned]: "The fetched channel does not belong to this manager's guild.",
[DjsErrorCodes.GuildOwned]: 'Guild is owned by the client.',
[DjsErrorCodes.GuildMembersTimeout]: "Members didn't arrive in time.",
[DjsErrorCodes.GuildSoundboardSoundsTimeout]: "Soundboard sounds didn't arrive in time.",
[DjsErrorCodes.GuildUncachedMe]: 'The client user as a member of this guild is uncached.',
[DjsErrorCodes.ChannelNotCached]: 'Could not find the channel where this message came from in the cache!',
[DjsErrorCodes.StageChannelResolve]: 'Could not resolve channel to a stage channel.',
@@ -118,6 +119,8 @@ const Messages = {
[DjsErrorCodes.MissingManageEmojisAndStickersPermission]: guild =>
`Client must have Manage Emojis and Stickers permission in guild ${guild} to see emoji authors.`,
[DjsErrorCodes.NotGuildSoundboardSound]: action =>
`Soundboard sound is a default (non-guild) soundboard sound and can't be ${action}.`,
[DjsErrorCodes.NotGuildSticker]: 'Sticker is a standard (non-guild) sticker and has no author.',
[DjsErrorCodes.ReactionResolveUser]: "Couldn't resolve the user id to remove from the reaction.",

View File

@@ -75,6 +75,7 @@ exports.GuildMemberManager = require('./managers/GuildMemberManager');
exports.GuildMemberRoleManager = require('./managers/GuildMemberRoleManager');
exports.GuildMessageManager = require('./managers/GuildMessageManager');
exports.GuildScheduledEventManager = require('./managers/GuildScheduledEventManager');
exports.GuildSoundboardSoundManager = require('./managers/GuildSoundboardSoundManager.js').GuildSoundboardSoundManager;
exports.GuildStickerManager = require('./managers/GuildStickerManager');
exports.GuildTextThreadManager = require('./managers/GuildTextThreadManager');
exports.MessageManager = require('./managers/MessageManager');
@@ -123,12 +124,14 @@ exports.CommandInteraction = require('./structures/CommandInteraction');
exports.Collector = require('./structures/interfaces/Collector');
exports.CommandInteractionOptionResolver = require('./structures/CommandInteractionOptionResolver');
exports.Component = require('./structures/Component');
exports.ContainerComponent = require('./structures/ContainerComponent');
exports.ContextMenuCommandInteraction = require('./structures/ContextMenuCommandInteraction');
exports.DMChannel = require('./structures/DMChannel');
exports.Embed = require('./structures/Embed');
exports.EmbedBuilder = require('./structures/EmbedBuilder');
exports.Emoji = require('./structures/Emoji').Emoji;
exports.Entitlement = require('./structures/Entitlement').Entitlement;
exports.FileComponent = require('./structures/FileComponent');
exports.ForumChannel = require('./structures/ForumChannel');
exports.Guild = require('./structures/Guild').Guild;
exports.GuildAuditLogs = require('./structures/GuildAuditLogs');
@@ -161,6 +164,8 @@ exports.Attachment = require('./structures/Attachment');
exports.AttachmentBuilder = require('./structures/AttachmentBuilder');
exports.ModalBuilder = require('./structures/ModalBuilder');
exports.MediaChannel = require('./structures/MediaChannel');
exports.MediaGalleryComponent = require('./structures/MediaGalleryComponent');
exports.MediaGalleryItem = require('./structures/MediaGalleryItem');
exports.MessageCollector = require('./structures/MessageCollector');
exports.MessageComponentInteraction = require('./structures/MessageComponentInteraction');
exports.MessageContextMenuCommandInteraction = require('./structures/MessageContextMenuCommandInteraction');
@@ -180,6 +185,7 @@ exports.ReactionCollector = require('./structures/ReactionCollector');
exports.ReactionEmoji = require('./structures/ReactionEmoji');
exports.RichPresenceAssets = require('./structures/Presence').RichPresenceAssets;
exports.Role = require('./structures/Role').Role;
exports.SectionComponent = require('./structures/SectionComponent');
exports.SelectMenuBuilder = require('./structures/SelectMenuBuilder');
exports.ChannelSelectMenuBuilder = require('./structures/ChannelSelectMenuBuilder');
exports.MentionableSelectMenuBuilder = require('./structures/MentionableSelectMenuBuilder');
@@ -201,7 +207,9 @@ exports.RoleSelectMenuInteraction = require('./structures/RoleSelectMenuInteract
exports.StringSelectMenuInteraction = require('./structures/StringSelectMenuInteraction');
exports.UserSelectMenuInteraction = require('./structures/UserSelectMenuInteraction');
exports.SelectMenuOptionBuilder = require('./structures/SelectMenuOptionBuilder');
exports.SeparatorComponent = require('./structures/SeparatorComponent');
exports.SKU = require('./structures/SKU').SKU;
exports.SoundboardSound = require('./structures/SoundboardSound.js').SoundboardSound;
exports.StringSelectMenuOptionBuilder = require('./structures/StringSelectMenuOptionBuilder');
exports.StageChannel = require('./structures/StageChannel');
exports.StageInstance = require('./structures/StageInstance').StageInstance;
@@ -211,12 +219,15 @@ exports.StickerPack = require('./structures/StickerPack');
exports.Team = require('./structures/Team');
exports.TeamMember = require('./structures/TeamMember');
exports.TextChannel = require('./structures/TextChannel');
exports.TextDisplayComponent = require('./structures/TextDisplayComponent');
exports.TextInputBuilder = require('./structures/TextInputBuilder');
exports.TextInputComponent = require('./structures/TextInputComponent');
exports.ThreadChannel = require('./structures/ThreadChannel');
exports.ThreadMember = require('./structures/ThreadMember');
exports.ThreadOnlyChannel = require('./structures/ThreadOnlyChannel');
exports.ThumbnailComponent = require('./structures/ThumbnailComponent');
exports.Typing = require('./structures/Typing');
exports.UnfurledMediaItem = require('./structures/UnfurledMediaItem');
exports.User = require('./structures/User');
exports.UserContextMenuCommandInteraction = require('./structures/UserContextMenuCommandInteraction');
exports.VoiceChannelEffect = require('./structures/VoiceChannelEffect');

View File

@@ -4,8 +4,9 @@ const process = require('node:process');
const { setTimeout, clearTimeout } = require('node:timers');
const { Collection } = require('@discordjs/collection');
const { makeURLSearchParams } = require('@discordjs/rest');
const { Routes, RouteBases } = require('discord-api-types/v10');
const { GatewayOpcodes, Routes, RouteBases } = require('discord-api-types/v10');
const CachedManager = require('./CachedManager');
const { ErrorCodes, DiscordjsError } = require('../errors/index.js');
const ShardClientUtil = require('../sharding/ShardClientUtil');
const { Guild } = require('../structures/Guild');
const GuildChannel = require('../structures/GuildChannel');
@@ -282,6 +283,79 @@ class GuildManager extends CachedManager {
return data.reduce((coll, guild) => coll.set(guild.id, new OAuth2Guild(this.client, guild)), new Collection());
}
/**
* @typedef {Object} FetchSoundboardSoundsOptions
* @param {Snowflake[]} guildIds The ids of the guilds to fetch soundboard sounds for
* @param {number} [time=10_000] The timeout for receipt of the soundboard sounds
*/
/**
* Fetches soundboard sounds for the specified guilds.
* @param {FetchSoundboardSoundsOptions} options The options for fetching soundboard sounds
* @returns {Promise<Collection<Snowflake, Collection<Snowflake, SoundboardSound>>>}
* @example
* // Fetch soundboard sounds for multiple guilds
* const soundboardSounds = await client.guilds.fetchSoundboardSounds({
* guildIds: ['123456789012345678', '987654321098765432'],
* })
*
* console.log(soundboardSounds.get('123456789012345678'));
*/
async fetchSoundboardSounds({ guildIds, time = 10_000 }) {
const shardCount = this.client.options.shardCount;
const shardIds = new Map();
for (const guildId of guildIds) {
const shardId = ShardClientUtil.shardIdForGuildId(guildId, shardCount);
const group = shardIds.get(shardId);
if (group) group.push(guildId);
else shardIds.set(shardId, [guildId]);
}
for (const [shardId, shardGuildIds] of shardIds) {
this.client.ws.shards.get(shardId).send({
op: GatewayOpcodes.RequestSoundboardSounds,
d: {
guild_ids: shardGuildIds,
},
});
}
return new Promise((resolve, reject) => {
const remainingGuildIds = new Set(guildIds);
const fetchedSoundboardSounds = new Collection();
const handler = (soundboardSounds, guild) => {
timeout.refresh();
if (!remainingGuildIds.has(guild.id)) return;
fetchedSoundboardSounds.set(guild.id, soundboardSounds);
remainingGuildIds.delete(guild.id);
if (remainingGuildIds.size === 0) {
clearTimeout(timeout);
this.client.removeListener(Events.SoundboardSounds, handler);
this.client.decrementMaxListeners();
resolve(fetchedSoundboardSounds);
}
};
const timeout = setTimeout(() => {
this.client.removeListener(Events.SoundboardSounds, handler);
this.client.decrementMaxListeners();
reject(new DiscordjsError(ErrorCodes.GuildSoundboardSoundsTimeout));
}, time).unref();
this.client.incrementMaxListeners();
this.client.on(Events.SoundboardSounds, handler);
});
}
/**
* Options used to set incident actions. Supplying `null` to any option will disable the action.
* @typedef {Object} IncidentActionsEditOptions

View File

@@ -0,0 +1,192 @@
'use strict';
const { Collection } = require('@discordjs/collection');
const { lazy } = require('@discordjs/util');
const { Routes } = require('discord-api-types/v10');
const CachedManager = require('./CachedManager.js');
const { DiscordjsTypeError, ErrorCodes } = require('../errors/index.js');
const { SoundboardSound } = require('../structures/SoundboardSound.js');
const { resolveBase64, resolveFile } = require('../util/DataResolver.js');
const fileTypeMime = lazy(() => require('magic-bytes.js').filetypemime);
/**
* Manages API methods for Soundboard Sounds and stores their cache.
* @extends {CachedManager}
*/
class GuildSoundboardSoundManager extends CachedManager {
constructor(guild, iterable) {
super(guild.client, SoundboardSound, iterable);
/**
* The guild this manager belongs to
* @type {Guild}
*/
this.guild = guild;
}
/**
* The cache of Soundboard Sounds
* @type {Collection<Snowflake, SoundboardSound>}
* @name GuildSoundboardSoundManager#cache
*/
_add(data, cache) {
return super._add(data, cache, { extras: [this.guild], id: data.sound_id });
}
/**
* Data that resolves to give a SoundboardSound object. This can be:
* * A SoundboardSound object
* * A Snowflake
* @typedef {SoundboardSound|Snowflake} SoundboardSoundResolvable
*/
/**
* Resolves a SoundboardSoundResolvable to a SoundboardSound object.
* @method resolve
* @memberof GuildSoundboardSoundManager
* @instance
* @param {SoundboardSoundResolvable} soundboardSound The SoundboardSound resolvable to identify
* @returns {?SoundboardSound}
*/
/**
* Resolves a {@link SoundboardSoundResolvable} to a {@link SoundboardSound} id.
* @param {SoundboardSoundResolvable} soundboardSound The soundboard sound resolvable to resolve
* @returns {?Snowflake}
*/
resolveId(soundboardSound) {
if (soundboardSound instanceof this.holds) return soundboardSound.soundId;
if (typeof soundboardSound === 'string') return soundboardSound;
return null;
}
/**
* Options used to create a soundboard sound in a guild.
* @typedef {Object} GuildSoundboardSoundCreateOptions
* @property {BufferResolvable|Stream} file The file for the soundboard sound
* @property {string} name The name for the soundboard sound
* @property {string} [contentType] The content type for the soundboard sound file
* @property {number} [volume] The volume (a double) for the soundboard sound, from 0 (inclusive) to 1. Defaults to 1
* @property {Snowflake} [emojiId] The emoji id for the soundboard sound
* @property {string} [emojiName] The emoji name for the soundboard sound
* @property {string} [reason] The reason for creating the soundboard sound
*/
/**
* Creates a new guild soundboard sound.
* @param {GuildSoundboardSoundCreateOptions} options Options for creating a guild soundboard sound
* @returns {Promise<SoundboardSound>} The created soundboard sound
* @example
* // Create a new soundboard sound from a file on your computer
* guild.soundboardSounds.create({ file: './sound.mp3', name: 'sound' })
* .then(sound => console.log(`Created new soundboard sound with name ${sound.name}!`))
* .catch(console.error);
*/
async create({ contentType, emojiId, emojiName, file, name, reason, volume }) {
const resolvedFile = await resolveFile(file);
const resolvedContentType = contentType ?? resolvedFile.contentType ?? fileTypeMime()(resolvedFile.data)[0];
const sound = resolveBase64(resolvedFile.data, resolvedContentType);
const body = { emoji_id: emojiId, emoji_name: emojiName, name, sound, volume };
const soundboardSound = await this.client.rest.post(Routes.guildSoundboardSounds(this.guild.id), {
body,
reason,
});
return this._add(soundboardSound);
}
/**
* Data for editing a soundboard sound.
* @typedef {Object} GuildSoundboardSoundEditOptions
* @property {string} [name] The name of the soundboard sound
* @property {?number} [volume] The volume of the soundboard sound, from 0 to 1
* @property {?Snowflake} [emojiId] The emoji id of the soundboard sound
* @property {?string} [emojiName] The emoji name of the soundboard sound
* @property {string} [reason] The reason for editing the soundboard sound
*/
/**
* Edits a soundboard sound.
* @param {SoundboardSoundResolvable} soundboardSound The soundboard sound to edit
* @param {GuildSoundboardSoundEditOptions} [options={}] The new data for the soundboard sound
* @returns {Promise<SoundboardSound>}
*/
async edit(soundboardSound, options = {}) {
const soundId = this.resolveId(soundboardSound);
if (!soundId) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'soundboardSound', 'SoundboardSoundResolvable');
const { emojiId, emojiName, name, reason, volume } = options;
const body = { emoji_id: emojiId, emoji_name: emojiName, name, volume };
const data = await this.client.rest.patch(Routes.guildSoundboardSound(this.guild.id, soundId), {
body,
reason,
});
const existing = this.cache.get(soundId);
if (existing) {
const clone = existing._clone();
clone._patch(data);
return clone;
}
return this._add(data);
}
/**
* Deletes a soundboard sound.
* @param {SoundboardSoundResolvable} soundboardSound The soundboard sound to delete
* @param {string} [reason] Reason for deleting this soundboard sound
* @returns {Promise<void>}
*/
async delete(soundboardSound, reason) {
const soundId = this.resolveId(soundboardSound);
if (!soundId) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'soundboardSound', 'SoundboardSoundResolvable');
await this.client.rest.delete(Routes.guildSoundboardSound(this.guild.id, soundId), { reason });
}
/**
* Obtains one or more soundboard sounds from Discord, or the soundboard sound cache if they're already available.
* @param {Snowflake} [id] The soundboard sound's id
* @param {BaseFetchOptions} [options] Additional options for this fetch
* @returns {Promise<SoundboardSound|Collection<Snowflake, SoundboardSound>>}
* @example
* // Fetch all soundboard sounds from the guild
* guild.soundboardSounds.fetch()
* .then(sounds => console.log(`There are ${sounds.size} soundboard sounds.`))
* .catch(console.error);
* @example
* // Fetch a single soundboard sound
* guild.soundboardSounds.fetch('222078108977594368')
* .then(sound => console.log(`The soundboard sound name is: ${sound.name}`))
* .catch(console.error);
*/
async fetch(id, { cache = true, force = false } = {}) {
if (id) {
if (!force) {
const existing = this.cache.get(id);
if (existing) return existing;
}
const sound = await this.client.rest.get(Routes.guildSoundboardSound(this.guild.id, id));
return this._add(sound, cache);
}
const data = await this.client.rest.get(Routes.guildSoundboardSounds(this.guild.id));
return new Collection(data.map(sound => [sound.sound_id, this._add(sound, cache)]));
}
}
exports.GuildSoundboardSoundManager = GuildSoundboardSoundManager;

View File

@@ -14,6 +14,15 @@ class Component {
this.data = data;
}
/**
* The id of this component
* @type {number}
* @readonly
*/
get id() {
return this.data.id;
}
/**
* The type of the component
* @type {ComponentType}

View File

@@ -0,0 +1,60 @@
'use strict';
const Component = require('./Component');
const { createComponent } = require('../util/Components');
/**
* Represents a container component
* @extends {Component}
*/
class ContainerComponent extends Component {
constructor({ components, ...data }) {
super(data);
/**
* The components in this container
* @type {Component[]}
* @readonly
*/
this.components = components.map(component => createComponent(component));
}
/**
* The accent color of this container
* @type {?number}
* @readonly
*/
get accentColor() {
return this.data.accent_color ?? null;
}
/**
* The hex accent color of this container
* @type {?string}
* @readonly
*/
get hexAccentColor() {
return typeof this.data.accent_color === 'number'
? `#${this.data.accent_color.toString(16).padStart(6, '0')}`
: (this.data.accent_color ?? null);
}
/**
* Whether this container is spoilered
* @type {boolean}
* @readonly
*/
get spoiler() {
return this.data.spoiler ?? false;
}
/**
* Returns the API-compatible JSON for this component
* @returns {APIContainerComponent}
*/
toJSON() {
return { ...this.data, components: this.components.map(component => component.toJSON()) };
}
}
module.exports = ContainerComponent;

View File

@@ -0,0 +1,40 @@
'use strict';
const Component = require('./Component');
const UnfurledMediaItem = require('./UnfurledMediaItem');
/**
* Represents a file component
* @extends {Component}
*/
class FileComponent extends Component {
constructor({ file, ...data }) {
super(data);
/**
* The media associated with this file
* @type {UnfurledMediaItem}
* @readonly
*/
this.file = new UnfurledMediaItem(file);
}
/**
* Whether this thumbnail is spoilered
* @type {boolean}
* @readonly
*/
get spoiler() {
return this.data.spoiler ?? false;
}
/**
* Returns the API-compatible JSON for this component
* @returns {APIFileComponent}
*/
toJSON() {
return { ...this.data, file: this.file.toJSON() };
}
}
module.exports = FileComponent;

View File

@@ -21,6 +21,7 @@ const GuildEmojiManager = require('../managers/GuildEmojiManager');
const GuildInviteManager = require('../managers/GuildInviteManager');
const GuildMemberManager = require('../managers/GuildMemberManager');
const GuildScheduledEventManager = require('../managers/GuildScheduledEventManager');
const { GuildSoundboardSoundManager } = require('../managers/GuildSoundboardSoundManager');
const GuildStickerManager = require('../managers/GuildStickerManager');
const PresenceManager = require('../managers/PresenceManager');
const RoleManager = require('../managers/RoleManager');
@@ -108,6 +109,12 @@ class Guild extends AnonymousGuild {
*/
this.autoModerationRules = new AutoModerationRuleManager(this);
/**
* A manager of the soundboard sounds of this guild.
* @type {GuildSoundboardSoundManager}
*/
this.soundboardSounds = new GuildSoundboardSoundManager(this);
if (!data) return;
if (data.unavailable) {
/**

View File

@@ -53,10 +53,11 @@ const Targets = {
* * An application command
* * An auto moderation rule
* * A guild onboarding prompt
* * A soundboard sound
* * An object with an id key if target was deleted or fake entity
* * An object where the keys represent either the new value or the old value
* @typedef {?(Object|Guild|BaseChannel|User|Role|Invite|Webhook|GuildEmoji|Message|Integration|StageInstance|Sticker|
* GuildScheduledEvent|ApplicationCommand|AutoModerationRule|GuildOnboardingPrompt)} AuditLogEntryTarget
* GuildScheduledEvent|ApplicationCommand|AutoModerationRule|GuildOnboardingPrompt|SoundboardSound)} AuditLogEntryTarget
*/
/**
@@ -367,6 +368,8 @@ class GuildAuditLogsEntry {
: changesReduce(this.changes, { id: data.target_id });
} else if (targetType === Targets.GuildOnboarding) {
this.target = changesReduce(this.changes, { id: data.target_id });
} else if (targetType === Targets.SoundboardSound) {
this.target = guild.soundboardSounds.cache.get(data.target_id) ?? { id: data.target_id };
} else if (data.target_id) {
this.target = guild[`${targetType.toLowerCase()}s`]?.cache.get(data.target_id) ?? { id: data.target_id };
}

View File

@@ -0,0 +1,31 @@
'use strict';
const Component = require('./Component');
const MediaGalleryItem = require('./MediaGalleryItem');
/**
* Represents a media gallery component
* @extends {Component}
*/
class MediaGalleryComponent extends Component {
constructor({ items, ...data }) {
super(data);
/**
* The items in this media gallery
* @type {MediaGalleryItem[]}
* @readonly
*/
this.items = items.map(item => new MediaGalleryItem(item));
}
/**
* Returns the API-compatible JSON for this component
* @returns {APIMediaGalleryComponent}
*/
toJSON() {
return { ...this.data, items: this.items.map(item => item.toJSON()) };
}
}
module.exports = MediaGalleryComponent;

View File

@@ -0,0 +1,51 @@
'use strict';
const UnfurledMediaItem = require('./UnfurledMediaItem');
/**
* Represents an item in a media gallery
*/
class MediaGalleryItem {
constructor({ media, ...data }) {
/**
* The API data associated with this component
* @type {APIMediaGalleryItem}
*/
this.data = data;
/**
* The media associated with this media gallery item
* @type {UnfurledMediaItem}
* @readonly
*/
this.media = new UnfurledMediaItem(media);
}
/**
* The description of this media gallery item
* @type {?string}
* @readonly
*/
get description() {
return this.data.description ?? null;
}
/**
* Whether this media gallery item is spoilered
* @type {boolean}
* @readonly
*/
get spoiler() {
return this.data.spoiler ?? false;
}
/**
* Returns the API-compatible JSON for this component
* @returns {APIMediaGalleryItem}
*/
toJSON() {
return { ...this.data, media: this.media.toJSON() };
}
}
module.exports = MediaGalleryItem;

View File

@@ -23,7 +23,7 @@ const ReactionCollector = require('./ReactionCollector');
const { Sticker } = require('./Sticker');
const { DiscordjsError, ErrorCodes } = require('../errors');
const ReactionManager = require('../managers/ReactionManager');
const { createComponent } = require('../util/Components');
const { createComponent, findComponentByCustomId } = require('../util/Components');
const { NonSystemMessageTypes, MaxBulkDeletableMessageAge, UndeletableMessageTypes } = require('../util/Constants');
const MessageFlagsBitField = require('../util/MessageFlagsBitField');
const PermissionsBitField = require('../util/PermissionsBitField');
@@ -151,10 +151,10 @@ class Message extends Base {
if ('components' in data) {
/**
* An array of action rows in the message.
* An array of components in the message.
* <info>This property requires the {@link GatewayIntentBits.MessageContent} privileged intent
* in a guild for messages that do not mention the client.</info>
* @type {ActionRow[]}
* @type {Component[]}
*/
this.components = data.components.map(component => createComponent(component));
} else {
@@ -1055,7 +1055,7 @@ class Message extends Base {
* @returns {?MessageActionRowComponent}
*/
resolveComponent(customId) {
return this.components.flatMap(row => row.components).find(component => component.customId === customId) ?? null;
return findComponentByCustomId(this.components, customId);
}
/**

View File

@@ -4,6 +4,7 @@ const { lazy } = require('@discordjs/util');
const BaseInteraction = require('./BaseInteraction');
const InteractionWebhook = require('./InteractionWebhook');
const InteractionResponses = require('./interfaces/InteractionResponses');
const { findComponentByCustomId } = require('../util/Components');
const getMessage = lazy(() => require('./Message').Message);
@@ -79,13 +80,11 @@ class MessageComponentInteraction extends BaseInteraction {
/**
* The component which was interacted with
* @type {MessageActionRowComponent|APIMessageActionRowComponent}
* @type {MessageActionRowComponent|APIComponentInMessageActionRow}
* @readonly
*/
get component() {
return this.message.components
.flatMap(row => row.components)
.find(component => (component.customId ?? component.custom_id) === this.customId);
return findComponentByCustomId(this.message.components, this.customId);
}
// These are here only for documentation purposes - they are implemented by InteractionResponses

View File

@@ -4,7 +4,6 @@ const { Buffer } = require('node:buffer');
const { lazy, isJSONEncodable } = require('@discordjs/util');
const { DiscordSnowflake } = require('@sapphire/snowflake');
const { MessageFlags, MessageReferenceType } = require('discord-api-types/v10');
const ActionRowBuilder = require('./ActionRowBuilder');
const { DiscordjsError, DiscordjsRangeError, ErrorCodes } = require('../errors');
const { resolveFile } = require('../util/DataResolver');
const MessageFlagsBitField = require('../util/MessageFlagsBitField');
@@ -149,7 +148,7 @@ class MessagePayload {
}
const components = this.options.components?.map(component =>
(isJSONEncodable(component) ? component : new ActionRowBuilder(component)).toJSON(),
isJSONEncodable(component) ? component.toJSON() : this.target.client.options.jsonTransformer(component),
);
let username;
@@ -166,9 +165,7 @@ class MessagePayload {
let flags;
if (
// eslint-disable-next-line eqeqeq
this.options.flags != null ||
(this.isMessage && this.options.reply === undefined) ||
this.isMessageManager
this.options.flags != null
) {
flags = new MessageFlagsBitField(this.options.flags).bitfield;
}

View File

@@ -0,0 +1,42 @@
'use strict';
const Component = require('./Component');
const { createComponent } = require('../util/Components');
/**
* Represents a section component
* @extends {Component}
*/
class SectionComponent extends Component {
constructor({ accessory, components, ...data }) {
super(data);
/**
* The components in this section
* @type {Component[]}
* @readonly
*/
this.components = components.map(component => createComponent(component));
/**
* The accessory component of this section
* @type {Component}
* @readonly
*/
this.accessory = createComponent(accessory);
}
/**
* Returns the API-compatible JSON for this component
* @returns {APISectionComponent}
*/
toJSON() {
return {
...this.data,
accessory: this.accessory.toJSON(),
components: this.components.map(component => component.toJSON()),
};
}
}
module.exports = SectionComponent;

View File

@@ -0,0 +1,30 @@
'use strict';
const { SeparatorSpacingSize } = require('discord-api-types/v10');
const Component = require('./Component');
/**
* Represents a separator component
* @extends {Component}
*/
class SeparatorComponent extends Component {
/**
* The spacing of this separator
* @type {SeparatorSpacingSize}
* @readonly
*/
get spacing() {
return this.data.spacing ?? SeparatorSpacingSize.Small;
}
/**
* Whether this separator is a divider
* @type {boolean}
* @readonly
*/
get divider() {
return this.data.divider ?? true;
}
}
module.exports = SeparatorComponent;

View File

@@ -0,0 +1,204 @@
'use strict';
const { DiscordSnowflake } = require('@sapphire/snowflake');
const Base = require('./Base.js');
const { Emoji } = require('./Emoji.js');
const { DiscordjsError, ErrorCodes } = require('../errors/index.js');
/**
* Represents a soundboard sound.
* @extends {Base}
*/
class SoundboardSound extends Base {
constructor(client, data) {
super(client);
/**
* The id of this soundboard sound
* @type {Snowflake|string}
*/
this.soundId = data.sound_id;
this._patch(data);
}
_patch(data) {
if ('available' in data) {
/**
* Whether this soundboard sound is available
* @type {?boolean}
*/
this.available = data.available;
} else {
this.available ??= null;
}
if ('name' in data) {
/**
* The name of this soundboard sound
* @type {?string}
*/
this.name = data.name;
} else {
this.name ??= null;
}
if ('volume' in data) {
/**
* The volume (a double) of this soundboard sound, from 0 to 1
* @type {?number}
*/
this.volume = data.volume;
} else {
this.volume ??= null;
}
if ('emoji_id' in data) {
/**
* The raw emoji data of this soundboard sound
* @type {?Object}
* @private
*/
this._emoji = {
id: data.emoji_id,
name: data.emoji_name,
};
} else {
this._emoji ??= null;
}
if ('guild_id' in data) {
/**
* The guild id of this soundboard sound
* @type {?Snowflake}
*/
this.guildId = data.guild_id;
} else {
this.guildId ??= null;
}
if ('user' in data) {
/**
* The user who created this soundboard sound
* @type {?User}
*/
this.user = this.client.users._add(data.user);
} else {
this.user ??= null;
}
}
/**
* The timestamp this soundboard sound was created at
* @type {number}
* @readonly
*/
get createdTimestamp() {
return DiscordSnowflake.timestampFrom(this.soundId);
}
/**
* The time this soundboard sound was created at
* @type {Date}
* @readonly
*/
get createdAt() {
return new Date(this.createdTimestamp);
}
/**
* The emoji of this soundboard sound
* @type {?Emoji}
* @readonly
*/
get emoji() {
if (!this._emoji) return null;
return this.guild?.emojis.cache.get(this._emoji.id) ?? new Emoji(this.client, this._emoji);
}
/**
* The guild this soundboard sound is part of
* @type {?Guild}
* @readonly
*/
get guild() {
return this.client.guilds.resolve(this.guildId);
}
/**
* A link to this soundboard sound
* @type {string}
* @readonly
*/
get url() {
return this.client.rest.cdn.soundboardSound(this.soundId);
}
/**
* Edits this soundboard sound.
* @param {GuildSoundboardSoundEditOptions} options The options to provide
* @returns {Promise<SoundboardSound>}
* @example
* // Update the name of a soundboard sound
* soundboardSound.edit({ name: 'new name' })
* .then(sound => console.log(`Updated the name of the soundboard sound to ${sound.name}`))
* .catch(console.error);
*/
async edit(options) {
if (!this.guildId) throw new DiscordjsError(ErrorCodes.NotGuildSoundboardSound, 'edited');
return this.guild.soundboardSounds.edit(this, options);
}
/**
* Deletes this soundboard sound.
* @param {string} [reason] Reason for deleting this soundboard sound
* @returns {Promise<SoundboardSound>}
* @example
* // Delete a soundboard sound
* soundboardSound.delete()
* .then(sound => console.log(`Deleted soundboard sound ${sound.name}`))
* .catch(console.error);
*/
async delete(reason) {
if (!this.guildId) throw new DiscordjsError(ErrorCodes.NotGuildSoundboardSound, 'deleted');
await this.guild.soundboardSounds.delete(this, reason);
return this;
}
/**
* Whether this soundboard sound is the same as another one.
* @param {SoundboardSound|APISoundboardSound} other The soundboard sound to compare it to
* @returns {boolean}
*/
equals(other) {
if (other instanceof SoundboardSound) {
return (
this.soundId === other.soundId &&
this.available === other.available &&
this.name === other.name &&
this.volume === other.volume &&
this.emojiId === other.emojiId &&
this.emojiName === other.emojiName &&
this.guildId === other.guildId &&
this.user?.id === other.user?.id
);
}
return (
this.soundId === other.sound_id &&
this.available === other.available &&
this.name === other.name &&
this.volume === other.volume &&
this.emojiId === other.emoji_id &&
this.emojiName === other.emoji_name &&
this.guildId === other.guild_id &&
this.user?.id === other.user?.id
);
}
}
exports.SoundboardSound = SoundboardSound;

View File

@@ -225,7 +225,7 @@ class Sticker extends Base {
* @returns {Promise<Sticker>}
* @param {string} [reason] Reason for deleting this sticker
* @example
* // Delete a message
* // Delete a sticker
* sticker.delete()
* .then(sticker => console.log(`Deleted sticker ${sticker.name}`))
* .catch(console.error);

View File

@@ -0,0 +1,20 @@
'use strict';
const Component = require('./Component');
/**
* Represents a text display component
* @extends {Component}
*/
class TextDisplayComponent extends Component {
/**
* The content of this text display
* @type {string}
* @readonly
*/
get content() {
return this.data.content;
}
}
module.exports = TextDisplayComponent;

View File

@@ -0,0 +1,49 @@
'use strict';
const Component = require('./Component');
const UnfurledMediaItem = require('./UnfurledMediaItem');
/**
* Represents a thumbnail component
* @extends {Component}
*/
class ThumbnailComponent extends Component {
constructor({ media, ...data }) {
super(data);
/**
* The media associated with this thumbnail
* @type {UnfurledMediaItem}
* @readonly
*/
this.media = new UnfurledMediaItem(media);
}
/**
* The description of this thumbnail
* @type {?string}
* @readonly
*/
get description() {
return this.data.description ?? null;
}
/**
* Whether this thumbnail is spoilered
* @type {boolean}
* @readonly
*/
get spoiler() {
return this.data.spoiler ?? false;
}
/**
* Returns the API-compatible JSON for this component
* @returns {APIThumbnailComponent}
*/
toJSON() {
return { ...this.data, media: this.media.toJSON() };
}
}
module.exports = ThumbnailComponent;

View File

@@ -0,0 +1,25 @@
'use strict';
/**
* Represents a media item in a component
*/
class UnfurledMediaItem {
constructor(data) {
/**
* The API data associated with this media item
* @type {APIUnfurledMediaItem}
*/
this.data = data;
}
/**
* The URL of this media gallery item
* @type {string}
* @readonly
*/
get url() {
return this.data.url;
}
}
module.exports = UnfurledMediaItem;

View File

@@ -1,6 +1,6 @@
'use strict';
const { PermissionFlagsBits } = require('discord-api-types/v10');
const { PermissionFlagsBits, Routes } = require('discord-api-types/v10');
const BaseGuildVoiceChannel = require('./BaseGuildVoiceChannel');
/**
@@ -35,6 +35,26 @@ class VoiceChannel extends BaseGuildVoiceChannel {
permissions.has(PermissionFlagsBits.Speak, false)
);
}
/**
* @typedef {Object} SendSoundboardSoundOptions
* @property {string} soundId The id of the soundboard sound to send
* @property {string} [guildId] The id of the guild the soundboard sound is a part of
*/
/**
* Send a soundboard sound to a voice channel the user is connected to.
* @param {SoundboardSound|SendSoundboardSoundOptions} sound The sound to send
* @returns {Promise<void>}
*/
async sendSoundboardSound(sound) {
await this.client.rest.post(Routes.sendSoundboardSound(this.id), {
body: {
sound_id: sound.soundId,
source_guild_id: sound.guildId ?? undefined,
},
});
}
}
/**

View File

@@ -64,6 +64,15 @@ class VoiceChannelEffect {
get channel() {
return this.guild.channels.cache.get(this.channelId) ?? null;
}
/**
* The soundboard sound for soundboard effects.
* @type {?SoundboardSound}
* @readonly
*/
get soundboardSound() {
return this.guild.soundboardSounds.cache.get(this.soundId) ?? null;
}
}
module.exports = VoiceChannelEffect;

View File

@@ -78,8 +78,11 @@ class TextBasedChannel {
* (see {@link https://discord.com/developers/docs/resources/message#allowed-mentions-object here} for more details)
* @property {Array<(AttachmentBuilder|Attachment|AttachmentPayload|BufferResolvable)>} [files]
* The files to send with the message.
* @property {Array<(ActionRowBuilder|ActionRow|APIActionRowComponent)>} [components]
* Action rows containing interactive components for the message (buttons, select menus)
* @property {Array<(ActionRowBuilder|MessageTopLevelComponent|APIMessageTopLevelComponent)>} [components]
* Action rows containing interactive components for the message (buttons, select menus) and other
* top-level components.
* <info>When using components v2, the flag {@link MessageFlags.IsComponentsV2} needs to be set
* and `content`, `embeds`, `stickers`, and `poll` cannot be used.</info>
*/
/**
@@ -107,7 +110,9 @@ class TextBasedChannel {
* that message will be returned and no new message will be created
* @property {StickerResolvable[]} [stickers=[]] The stickers to send in the message
* @property {MessageFlags} [flags] Which flags to set for the message.
* <info>Only `MessageFlags.SuppressEmbeds` and `MessageFlags.SuppressNotifications` can be set.</info>
* <info>Only {@link MessageFlags.SuppressEmbeds}, {@link MessageFlags.SuppressNotifications} and
* {@link MessageFlags.IsComponentsV2} can be set.</info>
* <info>{@link MessageFlags.IsComponentsV2} is required if passing components that aren't action rows</info>
*/
/**

View File

@@ -60,6 +60,11 @@
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10#APIChannelSelectComponent}
*/
/**
* @external APIContainerComponent
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIContainerComponent}
*/
/**
* @external APIEmbed
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIEmbed}
@@ -80,6 +85,11 @@
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIEmoji}
*/
/**
* @external APIFileComponent
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIFileComponent}
*/
/**
* @external APIGuild
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIGuild}
@@ -135,6 +145,16 @@
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIInteractionGuildMember}
*/
/**
* @external APIMediaGalleryComponent
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIMediaGalleryComponent}
*/
/**
* @external APIMediaGalleryItem
* @se {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIMediaGalleryItem}
*/
/**
* @external APIMentionableSelectComponent
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10#APIMentionableSelectComponent}
@@ -146,8 +166,8 @@
*/
/**
* @external APIMessageActionRowComponent
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10#APIMessageActionRowComponent}
* @external APIComponentInMessageActionRow
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10#APIComponentInMessageActionRow}
*/
/**
@@ -165,6 +185,11 @@
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIMessageInteractionMetadata}
*/
/**
* @external APIMessageTopLevelComponent
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10#APIMessageTopLevelComponent}
*/
/**
* @external APIModalInteractionResponse
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIModalInteractionResponse}
@@ -205,6 +230,16 @@
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10#APIRoleSelectComponent}
*/
/**
* @external APISectionComponent
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APISectionComponent}
*/
/**
* @external APISeparatorComponent
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APISeparatorComponent}
*/
/**
* @external APISelectMenuOption
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APISelectMenuOption}
@@ -225,6 +260,16 @@
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APITextInputComponent}
*/
/**
* @external APIThumbnailComponent
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIThumbnailComponent}
*/
/**
* @external APIUnfurledMediaItem
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIUnfurledMediaItem}
*/
/**
* @external APIUser
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIUser}

View File

@@ -5,6 +5,7 @@ const { ComponentType } = require('discord-api-types/v10');
/**
* @typedef {Object} BaseComponentData
* @property {number} [id] the id of this component
* @property {ComponentType} type The type of component
*/
@@ -16,30 +17,30 @@ const { ComponentType } = require('discord-api-types/v10');
/**
* @typedef {BaseComponentData} ButtonComponentData
* @property {ButtonStyle} style The style of the button
* @property {?boolean} disabled Whether this button is disabled
* @property {boolean} [disabled] Whether this button is disabled
* @property {string} label The label of this button
* @property {?APIMessageComponentEmoji} emoji The emoji on this button
* @property {?string} customId The custom id of the button
* @property {?string} url The URL of the button
* @property {APIMessageComponentEmoji} [emoji] The emoji on this button
* @property {string} [customId] The custom id of the button
* @property {string} [url] The URL of the button
*/
/**
* @typedef {object} SelectMenuComponentOptionData
* @property {string} label The label of the option
* @property {string} value The value of the option
* @property {?string} description The description of the option
* @property {?APIMessageComponentEmoji} emoji The emoji on the option
* @property {?boolean} default Whether this option is selected by default
* @property {string} [description] The description of the option
* @property {APIMessageComponentEmoji} [emoji] The emoji on the option
* @property {boolean} [default] Whether this option is selected by default
*/
/**
* @typedef {BaseComponentData} SelectMenuComponentData
* @property {string} customId The custom id of the select menu
* @property {?boolean} disabled Whether the select menu is disabled or not
* @property {?number} maxValues The maximum amount of options that can be selected
* @property {?number} minValues The minimum amount of options that can be selected
* @property {?SelectMenuComponentOptionData[]} options The options in this select menu
* @property {?string} placeholder The placeholder of the select menu
* @property {boolean} [disabled] Whether the select menu is disabled or not
* @property {number} [maxValues] The maximum amount of options that can be selected
* @property {number} [minValues] The minimum amount of options that can be selected
* @property {SelectMenuComponentOptionData[]} [options] The options in this select menu
* @property {string} [placeholder] The placeholder of the select menu
*/
/**
@@ -51,15 +52,76 @@ const { ComponentType } = require('discord-api-types/v10');
* @property {string} customId The custom id of the text input
* @property {TextInputStyle} style The style of the text input
* @property {string} label The text that appears on top of the text input field
* @property {?number} minLength The minimum number of characters that can be entered in the text input
* @property {?number} maxLength The maximum number of characters that can be entered in the text input
* @property {?boolean} required Whether or not the text input is required or not
* @property {?string} value The pre-filled text in the text input
* @property {?string} placeholder Placeholder for the text input
* @property {number} [minLength] The minimum number of characters that can be entered in the text input
* @property {number} [maxLength] The maximum number of characters that can be entered in the text input
* @property {boolean} [required] Whether or not the text input is required or not
* @property {string} [value] The pre-filled text in the text input
* @property {string} [placeholder] Placeholder for the text input
*/
/**
* @typedef {ActionRowData|ButtonComponentData|SelectMenuComponentData|TextInputComponentData} ComponentData
* @typedef {Object} UnfurledMediaItemData
* @property {string} url The url of this media item. Accepts either http:, https: or attachment: protocol
*/
/**
* @typedef {BaseComponentData} ThumbnailComponentData
* @property {UnfurledMediaItemData} media The media for the thumbnail
* @property {string} [description] The description of the thumbnail
* @property {boolean} [spoiler] Whether the thumbnail should be spoilered
*/
/**
* @typedef {BaseComponentData} FileComponentData
* @property {UnfurledMediaItemData} file The file media in this component
* @property {boolean} [spoiler] Whether the file should be spoilered
*/
/**
* @typedef {Object} MediaGalleryItemData
* @property {UnfurledMediaItemData} media The media for the media gallery item
* @property {string} [description] The description of the media gallery item
* @property {boolean} [spoiler] Whether the media gallery item should be spoilered
*/
/**
* @typedef {BaseComponentData} MediaGalleryComponentData
* @property {MediaGalleryItemData[]} items The media gallery items in this media gallery component
*/
/**
* @typedef {BaseComponentData} SeparatorComponentData
* @property {SeparatorSpacingSize} [spacing] The spacing size of this component
* @property {boolean} [divider] Whether the separator shows as a divider
*/
/**
* @typedef {BaseComponentData} SectionComponentData
* @property {Components[]} components The components in this section
* @property {ButtonComponentData|ThumbnailComponentData} accessory The accessory shown next to this section
*/
/**
* @typedef {BaseComponentData} TextDisplayComponentData
* @property {string} content The content displayed in this component
*/
/**
* @typedef {ActionRowData|FileComponentData|MediaGalleryComponentData|SectionComponentData|
* SeparatorComponentData|TextDisplayComponentData} ComponentInContainerData
*/
/**
* @typedef {BaseComponentData} ContainerComponentData
* @property {ComponentInContainerData} components The components in this container
* @property {?number} [accentColor] The accent color of this container
* @property {boolean} [spoiler] Whether the container should be spoilered
*/
/**
* @typedef {ActionRowData|ButtonComponentData|SelectMenuComponentData|TextInputComponentData|
* ThumbnailComponentData|FileComponentData|MediaGalleryComponentData|SeparatorComponentData|
* SectionComponentData|TextDisplayComponentData|ContainerComponentData} ComponentData
*/
/**
@@ -67,6 +129,11 @@ const { ComponentType } = require('discord-api-types/v10');
* @typedef {APIMessageComponentEmoji|string} ComponentEmojiResolvable
*/
/**
* @typedef {ActionRow|ContainerComponent|FileComponent|MediaGalleryComponent|
* SectionComponent|SeparatorComponent|TextDisplayComponent} MessageTopLevelComponent
*/
/**
* Transforms API data into a component
* @param {APIMessageComponent|Component} data The data to create the component from
@@ -95,6 +162,20 @@ function createComponent(data) {
return new MentionableSelectMenuComponent(data);
case ComponentType.ChannelSelect:
return new ChannelSelectMenuComponent(data);
case ComponentType.Container:
return new ContainerComponent(data);
case ComponentType.TextDisplay:
return new TextDisplayComponent(data);
case ComponentType.File:
return new FileComponent(data);
case ComponentType.MediaGallery:
return new MediaGalleryComponent(data);
case ComponentType.Section:
return new SectionComponent(data);
case ComponentType.Separator:
return new SeparatorComponent(data);
case ComponentType.Thumbnail:
return new ThumbnailComponent(data);
default:
return new Component(data);
}
@@ -133,7 +214,30 @@ function createComponentBuilder(data) {
}
}
module.exports = { createComponent, createComponentBuilder };
/**
* Finds a component by customId in nested components
* @param {Array<Component|APIMessageComponent>} components The components to search in
* @param {string} customId The customId to search for
* @returns {Component|APIMessageComponent}
*/
function findComponentByCustomId(components, customId) {
return (
components
.flatMap(component => {
switch (component.type) {
case ComponentType.ActionRow:
return component.components;
case ComponentType.Section:
return [component.accessory];
default:
return [component];
}
})
.find(component => (component.customId ?? component.custom_id) === customId) ?? null
);
}
module.exports = { createComponent, createComponentBuilder, findComponentByCustomId };
const ActionRow = require('../structures/ActionRow');
const ActionRowBuilder = require('../structures/ActionRowBuilder');
@@ -142,13 +246,20 @@ const ButtonComponent = require('../structures/ButtonComponent');
const ChannelSelectMenuBuilder = require('../structures/ChannelSelectMenuBuilder');
const ChannelSelectMenuComponent = require('../structures/ChannelSelectMenuComponent');
const Component = require('../structures/Component');
const ContainerComponent = require('../structures/ContainerComponent');
const FileComponent = require('../structures/FileComponent');
const MediaGalleryComponent = require('../structures/MediaGalleryComponent');
const MentionableSelectMenuBuilder = require('../structures/MentionableSelectMenuBuilder');
const MentionableSelectMenuComponent = require('../structures/MentionableSelectMenuComponent');
const RoleSelectMenuBuilder = require('../structures/RoleSelectMenuBuilder');
const RoleSelectMenuComponent = require('../structures/RoleSelectMenuComponent');
const SectionComponent = require('../structures/SectionComponent');
const SeparatorComponent = require('../structures/SeparatorComponent');
const StringSelectMenuBuilder = require('../structures/StringSelectMenuBuilder');
const StringSelectMenuComponent = require('../structures/StringSelectMenuComponent');
const TextDisplayComponent = require('../structures/TextDisplayComponent');
const TextInputBuilder = require('../structures/TextInputBuilder');
const TextInputComponent = require('../structures/TextInputComponent');
const ThumbnailComponent = require('../structures/ThumbnailComponent');
const UserSelectMenuBuilder = require('../structures/UserSelectMenuBuilder');
const UserSelectMenuComponent = require('../structures/UserSelectMenuComponent');

View File

@@ -113,13 +113,14 @@ async function resolveFile(resource) {
*/
/**
* Resolves a Base64Resolvable to a Base 64 image.
* Resolves a Base64Resolvable to a Base 64 string.
* @param {Base64Resolvable} data The base 64 resolvable you want to resolve
* @param {string} [contentType='image/jpg'] The content type of the data
* @returns {?string}
* @private
*/
function resolveBase64(data) {
if (Buffer.isBuffer(data)) return `data:image/jpg;base64,${data.toString('base64')}`;
function resolveBase64(data, contentType = 'image/jpg') {
if (Buffer.isBuffer(data)) return `data:${contentType};base64,${data.toString('base64')}`;
return data;
}

View File

@@ -41,6 +41,10 @@
* @property {string} GuildScheduledEventUpdate guildScheduledEventUpdate
* @property {string} GuildScheduledEventUserAdd guildScheduledEventUserAdd
* @property {string} GuildScheduledEventUserRemove guildScheduledEventUserRemove
* @property {string} GuildSoundboardSoundCreate guildSoundboardSoundCreate
* @property {string} GuildSoundboardSoundDelete guildSoundboardSoundDelete
* @property {string} GuildSoundboardSoundsUpdate guildSoundboardSoundsUpdate
* @property {string} GuildSoundboardSoundUpdate guildSoundboardSoundUpdate
* @property {string} GuildStickerCreate stickerCreate
* @property {string} GuildStickerDelete stickerDelete
* @property {string} GuildStickerUpdate stickerUpdate
@@ -61,6 +65,7 @@
* @property {string} MessageReactionRemoveEmoji messageReactionRemoveEmoji
* @property {string} MessageUpdate messageUpdate
* @property {string} PresenceUpdate presenceUpdate
* @property {string} SoundboardSounds soundboardSounds
* @property {string} ShardDisconnect shardDisconnect
* @property {string} ShardError shardError
* @property {string} ShardReady shardReady
@@ -132,6 +137,10 @@ module.exports = {
GuildScheduledEventUpdate: 'guildScheduledEventUpdate',
GuildScheduledEventUserAdd: 'guildScheduledEventUserAdd',
GuildScheduledEventUserRemove: 'guildScheduledEventUserRemove',
GuildSoundboardSoundCreate: 'guildSoundboardSoundCreate',
GuildSoundboardSoundDelete: 'guildSoundboardSoundDelete',
GuildSoundboardSoundsUpdate: 'guildSoundboardSoundsUpdate',
GuildSoundboardSoundUpdate: 'guildSoundboardSoundUpdate',
GuildStickerCreate: 'stickerCreate',
GuildStickerDelete: 'stickerDelete',
GuildStickerUpdate: 'stickerUpdate',
@@ -152,6 +161,7 @@ module.exports = {
MessageReactionRemoveEmoji: 'messageReactionRemoveEmoji',
MessageUpdate: 'messageUpdate',
PresenceUpdate: 'presenceUpdate',
SoundboardSounds: 'soundboardSounds',
Raw: 'raw',
ShardDisconnect: 'shardDisconnect',
ShardError: 'shardError',

View File

@@ -26,6 +26,7 @@ const { createEnum } = require('./Enums');
* @property {number} Reaction The partial to receive uncached reactions.
* @property {number} GuildScheduledEvent The partial to receive uncached guild scheduled events.
* @property {number} ThreadMember The partial to receive uncached thread members.
* @property {number} SoundboardSound The partial to receive uncached soundboard sounds.
*/
// JSDoc for IntelliSense purposes
@@ -41,4 +42,5 @@ module.exports = createEnum([
'Reaction',
'GuildScheduledEvent',
'ThreadMember',
'SoundboardSound',
]);

View File

@@ -110,13 +110,13 @@ import {
AuditLogEvent,
APIMessageComponentEmoji,
EmbedType,
APIActionRowComponentTypes,
APIComponentInActionRow,
APIModalInteractionResponseCallbackData,
APIModalSubmitInteraction,
APIMessageActionRowComponent,
APIComponentInMessageActionRow,
TextInputStyle,
APITextInputComponent,
APIModalActionRowComponent,
APIComponentInModalActionRow,
APIModalComponent,
APISelectMenuOption,
APIEmbedField,
@@ -191,8 +191,6 @@ import {
SubscriptionStatus,
ApplicationWebhookEventStatus,
ApplicationWebhookEventType,
GatewaySendPayload,
GatewayDispatchPayload,
RESTPostAPIInteractionCallbackWithResponseResult,
RESTAPIInteractionCallbackObject,
RESTAPIInteractionCallbackResourceObject,
@@ -202,6 +200,19 @@ import {
GatewayVoiceChannelEffectSendDispatchData,
APIChatInputApplicationCommandInteractionData,
APIContextMenuInteractionData,
APISoundboardSound,
APIComponentInContainer,
APIContainerComponent,
APIThumbnailComponent,
APISectionComponent,
APITextDisplayComponent,
APIUnfurledMediaItem,
APIMediaGalleryItem,
APIMediaGalleryComponent,
APISeparatorComponent,
SeparatorSpacingSize,
APIFileComponent,
APIMessageTopLevelComponent,
} from 'discord-api-types/v10';
import { ChildProcess } from 'node:child_process';
import { EventEmitter } from 'node:events';
@@ -298,11 +309,12 @@ export class Activity {
export type ActivityFlagsString = keyof typeof ActivityFlags;
export interface BaseComponentData {
id?: number;
type: ComponentType;
}
export type MessageActionRowComponentData =
| JSONEncodable<APIMessageActionRowComponent>
| JSONEncodable<APIComponentInMessageActionRow>
| ButtonComponentData
| StringSelectMenuComponentData
| UserSelectMenuComponentData
@@ -310,13 +322,13 @@ export type MessageActionRowComponentData =
| MentionableSelectMenuComponentData
| ChannelSelectMenuComponentData;
export type ModalActionRowComponentData = JSONEncodable<APIModalActionRowComponent> | TextInputComponentData;
export type ModalActionRowComponentData = JSONEncodable<APIComponentInModalActionRow> | TextInputComponentData;
export type ActionRowComponentData = MessageActionRowComponentData | ModalActionRowComponentData;
export type ActionRowComponent = MessageActionRowComponent | ModalActionRowComponent;
export interface ActionRowData<ComponentType extends JSONEncodable<APIActionRowComponentTypes> | ActionRowComponentData>
export interface ActionRowData<ComponentType extends JSONEncodable<APIComponentInActionRow> | ActionRowComponentData>
extends BaseComponentData {
components: readonly ComponentType[];
}
@@ -326,8 +338,8 @@ export class ActionRowBuilder<
> extends BuilderActionRow<ComponentType> {
public constructor(
data?: Partial<
| ActionRowData<ActionRowComponentData | JSONEncodable<APIActionRowComponentTypes>>
| APIActionRowComponent<APIMessageActionRowComponent | APIModalActionRowComponent>
| ActionRowData<ActionRowComponentData | JSONEncodable<APIComponentInActionRow>>
| APIActionRowComponent<APIComponentInMessageActionRow | APIComponentInModalActionRow>
>,
);
public static from<ComponentType extends AnyComponentBuilder = AnyComponentBuilder>(
@@ -347,9 +359,9 @@ export type MessageActionRowComponent =
export type ModalActionRowComponent = TextInputComponent;
export class ActionRow<ComponentType extends MessageActionRowComponent | ModalActionRowComponent> extends Component<
APIActionRowComponent<APIMessageActionRowComponent | APIModalActionRowComponent>
APIActionRowComponent<APIComponentInMessageActionRow | APIComponentInModalActionRow>
> {
private constructor(data: APIActionRowComponent<APIMessageActionRowComponent | APIModalActionRowComponent>);
private constructor(data: APIActionRowComponent<APIComponentInMessageActionRow | APIComponentInModalActionRow>);
public readonly components: ComponentType[];
public toJSON(): APIActionRowComponent<ReturnType<ComponentType['toJSON']>>;
}
@@ -783,15 +795,37 @@ export class ButtonInteraction<Cached extends CacheType = CacheType> extends Mes
export type AnyComponent =
| APIMessageComponent
| APIModalComponent
| APIActionRowComponent<APIMessageActionRowComponent | APIModalActionRowComponent>;
| APIActionRowComponent<APIComponentInMessageActionRow | APIComponentInModalActionRow>
| AnyComponentV2;
export class Component<RawComponentData extends AnyComponent = AnyComponent> {
public readonly data: Readonly<RawComponentData>;
public get id(): RawComponentData['id'];
public get type(): RawComponentData['type'];
public toJSON(): RawComponentData;
public equals(other: this | RawComponentData): boolean;
}
export type AnyComponentV2 = APIComponentInContainer | APIContainerComponent | APIThumbnailComponent;
export type TopLevelComponent =
| ActionRow<MessageActionRowComponent>
| ContainerComponent
| FileComponent
| MediaGalleryComponent
| SectionComponent
| SeparatorComponent
| TextDisplayComponent;
export type TopLevelComponentData =
| ActionRowData<MessageActionRowComponentData>
| ContainerComponentData
| FileComponentData
| MediaGalleryComponentData
| SectionComponentData
| SeparatorComponentData
| TextDisplayComponentData;
export class ButtonComponent extends Component<APIButtonComponent> {
private constructor(data: APIButtonComponent);
public get style(): ButtonStyle;
@@ -1029,6 +1063,16 @@ export type If<Value extends boolean, TrueResult, FalseResult = null> = Value ex
? FalseResult
: TrueResult | FalseResult;
/** @internal */
type AsyncEventIteratorDisposability =
ReturnType<typeof EventEmitter.on> extends AsyncDisposable ? AsyncDisposable : {};
/** @internal */
interface AsyncEventIterator<Params extends any[]>
extends AsyncIterableIterator<Params>,
AsyncEventIteratorDisposability {
[Symbol.asyncIterator](): AsyncEventIterator<Params>;
}
export class Client<Ready extends boolean = boolean> extends BaseClient {
public constructor(options: ClientOptions);
private actions: unknown;
@@ -1049,7 +1093,7 @@ export class Client<Ready extends boolean = boolean> extends BaseClient {
eventEmitter: Emitter,
eventName: Emitter extends Client ? Event : string | symbol,
options?: { signal?: AbortSignal | undefined },
): AsyncIterableIterator<Emitter extends Client ? ClientEvents[Event] : any[]>;
): AsyncEventIterator<Emitter extends Client ? ClientEvents[Event] : any[]>;
public application: If<Ready, ClientApplication>;
public channels: ChannelManager;
@@ -1185,6 +1229,40 @@ export class ClientVoiceManager {
public adapters: Map<Snowflake, InternalDiscordGatewayAdapterLibraryMethods>;
}
export type ComponentInContainer =
| ActionRow<MessageActionRowComponent>
| FileComponent
| MediaGalleryComponent
| SectionComponent
| SeparatorComponent
| TextDisplayComponent;
export type ComponentInContainerData =
| ActionRowData<ActionRowComponentData>
| FileComponentData
| MediaGalleryComponentData
| SectionComponentData
| SeparatorComponentData
| TextDisplayComponentData;
export interface ContainerComponentData<
ComponentType extends JSONEncodable<APIComponentInContainer> | ComponentInContainerData =
| JSONEncodable<APIComponentInContainer>
| ComponentInContainerData,
> extends BaseComponentData {
components: readonly ComponentType[];
accentColor?: number;
spoiler?: boolean;
}
export class ContainerComponent extends Component<APIContainerComponent> {
private constructor(data: APIContainerComponent);
public get accentColor(): number;
public get hexAccentColor(): HexColorString;
public get spoiler(): boolean;
public readonly components: ComponentInContainer[];
}
export { Collection, ReadonlyCollection } from '@discordjs/collection';
export interface CollectorEventTypes<Key, Value, Extras extends unknown[] = []> {
@@ -1508,6 +1586,7 @@ export class Guild extends AnonymousGuild {
public scheduledEvents: GuildScheduledEventManager;
public get shard(): WebSocketShard;
public shardId: number;
public soundboardSounds: GuildSoundboardSoundManager;
public stageInstances: StageInstanceManager;
public stickers: GuildStickerManager;
public incidentsData: IncidentActions | null;
@@ -1577,6 +1656,16 @@ export class Guild extends AnonymousGuild {
public toJSON(): unknown;
}
export interface FileComponentData extends BaseComponentData {
file: UnfurledMediaItemData;
spoiler?: boolean;
}
export class FileComponent extends Component<APIFileComponent> {
private constructor(data: APIFileComponent);
public readonly file: UnfurledMediaItem;
public get spoiler(): boolean;
}
export class GuildAuditLogs<Event extends GuildAuditLogsResolvable = AuditLogEvent> {
private constructor(guild: Guild, data: RawGuildAuditLogData);
private applicationCommands: Collection<Snowflake, ApplicationCommand>;
@@ -2175,6 +2264,27 @@ export class LimitedCollection<Key, Value> extends Collection<Key, Value> {
public keepOverLimit: ((value: Value, key: Key, collection: this) => boolean) | null;
}
export interface MediaGalleryComponentData extends BaseComponentData {
items: readonly MediaGalleryItemData[];
}
export class MediaGalleryComponent extends Component<APIMediaGalleryComponent> {
private constructor(data: APIMediaGalleryComponent);
public readonly items: MediaGalleryItem[];
}
export interface MediaGalleryItemData {
media: UnfurledMediaItemData;
description?: string;
spoiler?: boolean;
}
export class MediaGalleryItem {
private constructor(data: APIMediaGalleryItem);
public readonly data: APIMediaGalleryItem;
public readonly media: UnfurledMediaItem;
public get description(): string | null;
public get spoiler(): boolean;
}
export interface MessageCall {
get endedAt(): Date | null;
endedTimestamp: number | null;
@@ -2247,7 +2357,7 @@ export class Message<InGuild extends boolean = boolean> extends Base {
public get channel(): If<InGuild, GuildTextBasedChannel, TextBasedChannel>;
public channelId: Snowflake;
public get cleanContent(): string;
public components: ActionRow<MessageActionRowComponent>[];
public components: TopLevelComponent[];
public content: string;
public get createdAt(): Date;
public createdTimestamp: number;
@@ -2381,9 +2491,9 @@ export class MessageComponentInteraction<Cached extends CacheType = CacheType> e
public get component(): CacheTypeReducer<
Cached,
MessageActionRowComponent,
APIMessageActionRowComponent,
MessageActionRowComponent | APIMessageActionRowComponent,
MessageActionRowComponent | APIMessageActionRowComponent
APIComponentInMessageActionRow,
MessageActionRowComponent | APIComponentInMessageActionRow,
MessageActionRowComponent | APIComponentInMessageActionRow
>;
public componentType: MessageComponentType;
public customId: string;
@@ -2591,7 +2701,7 @@ export interface ModalComponentData {
customId: string;
title: string;
components: readonly (
| JSONEncodable<APIActionRowComponent<APIModalActionRowComponent>>
| JSONEncodable<APIActionRowComponent<APIComponentInModalActionRow>>
| ActionRowData<ModalActionRowComponentData>
)[];
}
@@ -2973,6 +3083,20 @@ export class RoleFlagsBitField extends BitField<RoleFlagsString> {
public static resolve(bit?: BitFieldResolvable<RoleFlagsString, number>): number;
}
export interface SectionComponentData extends BaseComponentData {
accessory: ButtonComponentData | ThumbnailComponentData;
components: readonly TextDisplayComponentData[];
}
export class SectionComponent<
AccessoryType extends ButtonComponent | ThumbnailComponent = ButtonComponent | ThumbnailComponent,
> extends Component<APISectionComponent> {
private constructor(data: APISectionComponent);
public readonly accessory: AccessoryType;
public readonly components: TextDisplayComponent[];
public toJSON(): APISectionComponent;
}
export class StringSelectMenuInteraction<
Cached extends CacheType = CacheType,
> extends MessageComponentInteraction<Cached> {
@@ -3096,6 +3220,16 @@ export type AnySelectMenuInteraction<Cached extends CacheType = CacheType> =
export type SelectMenuType = APISelectMenuComponent['type'];
export interface SeparatorComponentData extends BaseComponentData {
spacing?: SeparatorSpacingSize;
dividier?: boolean;
}
export class SeparatorComponent extends Component<APISeparatorComponent> {
private constructor(data: APISeparatorComponent);
public get spacing(): SeparatorSpacingSize;
public get divider(): boolean;
}
export interface ShardEventTypes {
death: [process: ChildProcess | Worker];
disconnect: [];
@@ -3458,6 +3592,15 @@ export class TextChannel extends BaseGuildTextChannel {
public type: ChannelType.GuildText;
}
export interface TextDisplayComponentData extends BaseComponentData {
content: string;
}
export class TextDisplayComponent extends Component<APITextDisplayComponent> {
private constructor(data: APITextDisplayComponent);
public readonly content: string;
}
export type ForumThreadChannel = PublicThreadChannel<true>;
export type TextThreadChannel = PublicThreadChannel<false> | PrivateThreadChannel;
export type AnyThreadChannel = TextThreadChannel | ForumThreadChannel;
@@ -3557,6 +3700,19 @@ export class ThreadMemberFlagsBitField extends BitField<ThreadMemberFlagsString>
public static resolve(bit?: BitFieldResolvable<ThreadMemberFlagsString, number>): number;
}
export interface ThumbnailComponentData extends BaseComponentData {
media: UnfurledMediaItemData;
description?: string;
spoiler?: boolean;
}
export class ThumbnailComponent extends Component<APIThumbnailComponent> {
private constructor(data: APIThumbnailComponent);
public readonly media: UnfurledMediaItem;
public get description(): string | null;
public get spoiler(): boolean;
}
export class Typing extends Base {
private constructor(channel: TextBasedChannel, user: PartialUser, data?: RawTypingData);
public channel: TextBasedChannel;
@@ -3576,6 +3732,16 @@ export interface AvatarDecorationData {
skuId: Snowflake;
}
export interface UnfurledMediaItemData {
url: string;
}
export class UnfurledMediaItem {
private constructor(data: APIUnfurledMediaItem);
public readonly data: APIUnfurledMediaItem;
public get url(): string;
}
// tslint:disable-next-line no-empty-interface
export interface User extends PartialTextBasedChannelFields<false> {}
export class User extends Base {
@@ -3752,11 +3918,19 @@ export class Formatters extends null {
export type ComponentData =
| MessageActionRowComponentData
| ModalActionRowComponentData
| ActionRowData<MessageActionRowComponentData | ModalActionRowComponentData>;
| ComponentInContainerData
| ContainerComponentData
| ThumbnailComponentData;
export interface SendSoundboardSoundOptions {
soundId: Snowflake;
guildId?: Snowflake;
}
export class VoiceChannel extends BaseGuildVoiceChannel {
public get speakable(): boolean;
public type: ChannelType.GuildVoice;
public sendSoundboardSound(sound: SoundboardSound | SendSoundboardSoundOptions): Promise<void>;
}
export class VoiceChannelEffect {
@@ -3770,6 +3944,7 @@ export class VoiceChannelEffect {
public soundId: Snowflake | number | null;
public soundVolume: number | null;
public get channel(): VoiceChannel | null;
public get soundboardSound(): GuildSoundboardSound | null;
}
export class VoiceRegion {
@@ -3956,6 +4131,30 @@ export class WidgetMember extends Base {
public activity: WidgetActivity | null;
}
export type SoundboardSoundResolvable = SoundboardSound | Snowflake | string;
export class SoundboardSound extends Base {
private constructor(client: Client<true>, data: APISoundboardSound);
public name: string;
public soundId: Snowflake | string;
public volume: number;
private _emoji: Omit<APIEmoji, 'animated'> | null;
public guildId: Snowflake | null;
public available: boolean;
public user: User | null;
public get createdAt(): Date;
public get createdTimestamp(): number;
public get emoji(): Emoji | null;
public get guild(): Guild | null;
public get url(): string;
public edit(options?: GuildSoundboardSoundEditOptions): Promise<GuildSoundboardSound>;
public delete(reason?: string): Promise<GuildSoundboardSound>;
public equals(other: SoundboardSound | APISoundboardSound): boolean;
}
export type DefaultSoundboardSound = SoundboardSound & { get guild(): null; guildId: null; soundId: string };
export type GuildSoundboardSound = SoundboardSound & { get guild(): Guild; guildId: Snowflake; soundId: Snowflake };
export class WelcomeChannel extends Base {
private constructor(guild: Guild, data: RawWelcomeChannelData);
private _emoji: Omit<APIEmoji, 'animated'>;
@@ -4141,6 +4340,7 @@ export enum DiscordjsErrorCodes {
GuildChannelUnowned = 'GuildChannelUnowned',
GuildOwned = 'GuildOwned',
GuildMembersTimeout = 'GuildMembersTimeout',
GuildSoundboardSoundsTimeout = 'GuildSoundboardSoundsTimeout',
GuildUncachedMe = 'GuildUncachedMe',
ChannelNotCached = 'ChannelNotCached',
StageChannelResolve = 'StageChannelResolve',
@@ -4166,6 +4366,7 @@ export enum DiscordjsErrorCodes {
/** @deprecated Use {@link DiscordjsErrorCodes.MissingManageGuildExpressionsPermission} instead. */
MissingManageEmojisAndStickersPermission = 'MissingManageEmojisAndStickersPermission',
NotGuildSoundboardSound = 'NotGuildSoundboardSound',
NotGuildSticker = 'NotGuildSticker',
ReactionResolveUser = 'ReactionResolveUser',
@@ -4540,11 +4741,19 @@ export class GuildEmojiRoleManager extends DataManager<Snowflake, Role, RoleReso
): Promise<GuildEmoji>;
}
export interface FetchSoundboardSoundsOptions {
guildIds: readonly Snowflake[];
time?: number;
}
export class GuildManager extends CachedManager<Snowflake, Guild, GuildResolvable> {
private constructor(client: Client<true>, iterable?: Iterable<RawGuildData>);
public create(options: GuildCreateOptions): Promise<Guild>;
public fetch(options: Snowflake | FetchGuildOptions): Promise<Guild>;
public fetch(options?: FetchGuildsOptions): Promise<Collection<Snowflake, OAuth2Guild>>;
public fetchSoundboardSounds(
options: FetchSoundboardSoundsOptions,
): Promise<Collection<Snowflake, Collection<Snowflake, GuildSoundboardSound>>>;
public setIncidentActions(
guild: GuildResolvable,
incidentActions: IncidentActionsEditOptions,
@@ -4636,6 +4845,36 @@ export class GuildScheduledEventManager extends CachedManager<
): Promise<GuildScheduledEventManagerFetchSubscribersResult<Options>>;
}
export interface GuildSoundboardSoundCreateOptions {
file: BufferResolvable | Stream;
name: string;
contentType?: string;
volume?: number;
emojiId?: Snowflake;
emojiName?: string;
reason?: string;
}
export interface GuildSoundboardSoundEditOptions {
name?: string;
volume?: number | null;
emojiId?: Snowflake | null;
emojiName?: string | null;
}
export class GuildSoundboardSoundManager extends CachedManager<Snowflake, SoundboardSound, SoundboardSoundResolvable> {
private constructor(guild: Guild, iterable?: Iterable<APISoundboardSound>);
public guild: Guild;
public create(options: GuildSoundboardSoundCreateOptions): Promise<GuildSoundboardSound>;
public edit(
soundboardSound: SoundboardSoundResolvable,
options: GuildSoundboardSoundEditOptions,
): Promise<GuildSoundboardSound>;
public delete(soundboardSound: SoundboardSoundResolvable): Promise<void>;
public fetch(id: Snowflake, options?: BaseFetchOptions): Promise<GuildSoundboardSound>;
public fetch(options?: BaseFetchOptions): Promise<Collection<Snowflake, GuildSoundboardSound>>;
}
export class GuildStickerManager extends CachedManager<Snowflake, Sticker, StickerResolvable> {
private constructor(guild: Guild, iterable?: Iterable<RawStickerData>);
public guild: Guild;
@@ -4960,7 +5199,8 @@ export type AllowedPartial =
| Message
| MessageReaction
| GuildScheduledEvent
| ThreadMember;
| ThreadMember
| SoundboardSound;
export type AllowedThreadTypeForNewsChannel = ChannelType.AnnouncementThread;
@@ -5512,6 +5752,9 @@ export interface ClientEvents {
guildMembersChunk: [members: ReadonlyCollection<Snowflake, GuildMember>, guild: Guild, data: GuildMembersChunk];
guildMemberUpdate: [oldMember: GuildMember | PartialGuildMember, newMember: GuildMember];
guildUpdate: [oldGuild: Guild, newGuild: Guild];
guildSoundboardSoundCreate: [soundboardSound: SoundboardSound];
guildSoundboardSoundDelete: [soundboardSound: SoundboardSound | PartialSoundboardSound];
guildSoundboardSoundUpdate: [oldSoundboardSound: SoundboardSound | null, newSoundboardSound: SoundboardSound];
inviteCreate: [invite: Invite];
inviteDelete: [invite: Invite];
messageCreate: [message: OmitPartialGroupDMChannel<Message>];
@@ -5587,6 +5830,7 @@ export interface ClientEvents {
guildScheduledEventDelete: [guildScheduledEvent: GuildScheduledEvent | PartialGuildScheduledEvent];
guildScheduledEventUserAdd: [guildScheduledEvent: GuildScheduledEvent | PartialGuildScheduledEvent, user: User];
guildScheduledEventUserRemove: [guildScheduledEvent: GuildScheduledEvent | PartialGuildScheduledEvent, user: User];
soundboardSounds: [soundboardSounds: ReadonlyCollection<Snowflake, SoundboardSound>, guild: Guild];
}
export interface ClientFetchInviteOptions {
@@ -5805,6 +6049,11 @@ export enum Events {
GuildScheduledEventDelete = 'guildScheduledEventDelete',
GuildScheduledEventUserAdd = 'guildScheduledEventUserAdd',
GuildScheduledEventUserRemove = 'guildScheduledEventUserRemove',
GuildSoundboardSoundCreate = 'guildSoundboardSoundCreate',
GuildSoundboardSoundDelete = 'guildSoundboardSoundDelete',
GuildSoundboardSoundUpdate = 'guildSoundboardSoundUpdate',
GuildSoundboardSoundsUpdate = 'guildSoundboardSoundsUpdate',
SoundboardSounds = 'soundboardSounds',
}
export enum ShardEvents {
@@ -6563,8 +6812,11 @@ export interface InteractionReplyOptions extends BaseMessageOptionsWithPoll {
fetchReply?: boolean;
flags?:
| BitFieldResolvable<
Extract<MessageFlagsString, 'Ephemeral' | 'SuppressEmbeds' | 'SuppressNotifications'>,
MessageFlags.Ephemeral | MessageFlags.SuppressEmbeds | MessageFlags.SuppressNotifications
Extract<MessageFlagsString, 'Ephemeral' | 'SuppressEmbeds' | 'SuppressNotifications' | 'IsComponentsV2'>,
| MessageFlags.Ephemeral
| MessageFlags.SuppressEmbeds
| MessageFlags.SuppressNotifications
| MessageFlags.IsComponentsV2
>
| undefined;
}
@@ -6745,9 +6997,10 @@ export interface BaseMessageOptions {
| AttachmentPayload
)[];
components?: readonly (
| JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>>
| JSONEncodable<APIMessageTopLevelComponent>
| TopLevelComponentData
| ActionRowData<MessageActionRowComponentData | MessageActionRowComponentBuilder>
| APIActionRowComponent<APIMessageActionRowComponent>
| APIMessageTopLevelComponent
)[];
}
@@ -6764,8 +7017,8 @@ export interface MessageCreateOptions extends BaseMessageOptionsWithPoll {
stickers?: readonly StickerResolvable[];
flags?:
| BitFieldResolvable<
Extract<MessageFlagsString, 'SuppressEmbeds' | 'SuppressNotifications'>,
MessageFlags.SuppressEmbeds | MessageFlags.SuppressNotifications
Extract<MessageFlagsString, 'SuppressEmbeds' | 'SuppressNotifications' | 'IsComponentsV2'>,
MessageFlags.SuppressEmbeds | MessageFlags.SuppressNotifications | MessageFlags.IsComponentsV2
>
| undefined;
}
@@ -6975,6 +7228,8 @@ export interface PartialGuildScheduledEvent
export interface PartialThreadMember extends Partialize<ThreadMember, 'flags' | 'joinedAt' | 'joinedTimestamp'> {}
export interface PartialSoundboardSound extends Partialize<SoundboardSound, 'available' | 'name' | 'volume'> {}
export interface PartialOverwriteData {
id: Snowflake | number;
type?: OverwriteType;
@@ -6994,6 +7249,7 @@ export enum Partials {
Reaction,
GuildScheduledEvent,
ThreadMember,
SoundboardSound,
}
export interface PartialUser extends Partialize<User, 'username' | 'tag' | 'discriminator'> {}

View File

@@ -25,7 +25,7 @@ import {
ApplicationCommandType,
APIMessage,
APIActionRowComponent,
APIActionRowComponentTypes,
APIComponentInActionRow,
APIStringSelectComponent,
APIUserSelectComponent,
APIRoleSelectComponent,
@@ -36,6 +36,7 @@ import {
GuildScheduledEventRecurrenceRuleFrequency,
GuildScheduledEventRecurrenceRuleMonth,
GuildScheduledEventRecurrenceRuleWeekday,
MessageFlags,
} from 'discord-api-types/v10';
import {
ApplicationCommand,
@@ -219,6 +220,15 @@ import {
InteractionCallbackResponse,
GuildScheduledEventRecurrenceRuleOptions,
ThreadOnlyChannel,
SectionComponentData,
TextDisplayComponentData,
ThumbnailComponentData,
UnfurledMediaItemData,
MediaGalleryComponentData,
MediaGalleryItemData,
SeparatorComponentData,
FileComponentData,
ContainerComponentData,
} from '.';
import {
expectAssignable,
@@ -642,6 +652,57 @@ client.on('messageCreate', async message => {
components: [row, rawButtonsRow, buttonsRow, rawStringSelectMenuRow, stringSelectRow],
embeds: [embed, embedData],
});
const rawTextDisplay: TextDisplayComponentData = {
type: ComponentType.TextDisplay,
content: 'test',
};
const rawMedia: UnfurledMediaItemData = { url: 'https://discord.js.org' };
const rawThumbnail: ThumbnailComponentData = {
type: ComponentType.Thumbnail,
media: rawMedia,
spoiler: true,
description: 'test',
};
const rawSection: SectionComponentData = {
type: ComponentType.Section,
components: [rawTextDisplay],
accessory: rawThumbnail,
};
const rawMediaGalleryItem: MediaGalleryItemData = {
media: rawMedia,
description: 'test',
spoiler: false,
};
const rawMediaGallery: MediaGalleryComponentData = {
type: ComponentType.MediaGallery,
items: [rawMediaGalleryItem, rawMediaGalleryItem, rawMediaGalleryItem],
};
const rawSeparator: SeparatorComponentData = {
type: ComponentType.Separator,
spacing: 1,
dividier: false,
};
const rawFile: FileComponentData = {
type: ComponentType.File,
file: rawMedia,
};
const rawContainer: ContainerComponentData = {
type: ComponentType.Container,
components: [rawSection, rawSeparator, rawMediaGallery, rawFile],
accentColor: 0xff00ff,
spoiler: true,
};
channel.send({ flags: MessageFlags.IsComponentsV2, components: [rawContainer] });
});
client.on('messageDelete', ({ client }) => expectType<Client<true>>(client));
@@ -1322,7 +1383,7 @@ client.on('guildCreate', async g => {
// EventEmitter static method overrides
expectType<Promise<[Client<true>]>>(Client.once(client, 'ready'));
expectType<AsyncIterableIterator<[Client<true>]>>(Client.on(client, 'ready'));
expectAssignable<AsyncIterableIterator<[Client<true>]>>(Client.on(client, 'ready'));
client.login('absolutely-valid-token');
@@ -2412,7 +2473,7 @@ EmbedBuilder.from(embedData);
declare const embedComp: Embed;
EmbedBuilder.from(embedComp);
declare const actionRowData: APIActionRowComponent<APIActionRowComponentTypes>;
declare const actionRowData: APIActionRowComponent<APIComponentInActionRow>;
ActionRowBuilder.from(actionRowData);
declare const actionRowComp: ActionRow<ActionRowComponent>;
@@ -2424,7 +2485,7 @@ declare const buttonsActionRowComp: ActionRow<ButtonComponent>;
expectType<ActionRowBuilder<ButtonBuilder>>(ActionRowBuilder.from<ButtonBuilder>(buttonsActionRowData));
expectType<ActionRowBuilder<ButtonBuilder>>(ActionRowBuilder.from<ButtonBuilder>(buttonsActionRowComp));
declare const anyComponentsActionRowData: APIActionRowComponent<APIActionRowComponentTypes>;
declare const anyComponentsActionRowData: APIActionRowComponent<APIComponentInActionRow>;
declare const anyComponentsActionRowComp: ActionRow<ActionRowComponent>;
expectType<ActionRowBuilder>(ActionRowBuilder.from(anyComponentsActionRowData));

View File

@@ -2,6 +2,19 @@
All notable changes to this project will be documented in this file.
# [@discordjs/rest@2.5.0](https://github.com/discordjs/discord.js/compare/@discordjs/rest@2.4.3...@discordjs/rest@2.5.0) - (2025-04-25)
## Features
- Components v2 in v14 (#10781) ([edace17](https://github.com/discordjs/discord.js/commit/edace17a131f857547163a3acf4bb6fec0c1e415))
- Add soundboard in v14 (#10843) ([d3154cf](https://github.com/discordjs/discord.js/commit/d3154cf8f1eb027b5b4921d4048a32f464a3cd85))
# [@discordjs/rest@2.4.2](https://github.com/discordjs/discord.js/compare/@discordjs/rest@2.4.1...@discordjs/rest@2.4.2) - (2025-01-01)
## Bug Fixes
- Correct guild member banner URL ([8d69b24](https://github.com/discordjs/discord.js/commit/8d69b24b5c83249dffa5899a417a9dcbc6f3f30c))
# [@discordjs/rest@2.4.2](https://github.com/discordjs/discord.js/compare/@discordjs/rest@2.4.1...@discordjs/rest@2.4.2) - (2025-01-01)
## Bug Fixes

View File

@@ -130,6 +130,10 @@ test('teamIcon default', () => {
expect(cdn.teamIcon(id, hash)).toEqual(`${baseCDN}/team-icons/${id}/${hash}.webp`);
});
test('soundboardSound', () => {
expect(cdn.soundboardSound(id)).toEqual(`${baseCDN}/soundboard-sounds/${id}`);
});
test('makeURL throws on invalid size', () => {
// @ts-expect-error: Invalid size
expect(() => cdn.avatar(id, animatedHash, { size: 5 })).toThrow(RangeError);

View File

@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@discordjs/rest",
"version": "2.4.3",
"version": "2.5.0",
"description": "The REST API for discord.js",
"scripts": {
"test": "vitest run",
@@ -88,7 +88,7 @@
"@sapphire/async-queue": "^1.5.3",
"@sapphire/snowflake": "^3.5.3",
"@vladfrangu/async_event_emitter": "^2.4.6",
"discord-api-types": "^0.37.119",
"discord-api-types": "^0.38.1",
"magic-bytes.js": "^1.10.0",
"tslib": "^2.6.3",
"undici": "6.21.1"

View File

@@ -1,4 +1,5 @@
/* eslint-disable jsdoc/check-param-names */
import { CDNRoutes } from 'discord-api-types/v10';
import {
ALLOWED_EXTENSIONS,
ALLOWED_SIZES,
@@ -343,6 +344,15 @@ export class CDN {
return this.makeURL(`/guild-events/${scheduledEventId}/${coverHash}`, options);
}
/**
* Generates a URL for a soundboard sound.
*
* @param soundId - The soundboard sound id
*/
public soundboardSound(soundId: string): string {
return `${this.cdn}${CDNRoutes.soundboardSound(soundId)}`;
}
/**
* Constructs the URL for the resource, checking whether or not `hash` starts with `a_` if `dynamic` is set to `true`.
*

View File

@@ -1,8 +1,11 @@
import { getUserAgentAppendix } from '@discordjs/util';
import type { ImageSize } from 'discord-api-types/v10';
import { APIVersion } from 'discord-api-types/v10';
import { getDefaultStrategy } from '../../environment.js';
import type { RESTOptions, ResponseLike } from './types.js';
export type { ImageSize } from 'discord-api-types/v10';
export const DefaultUserAgent =
`DiscordBot (https://discord.js.org, [VI]{{inject}}[/VI])` as `DiscordBot (https://discord.js.org, ${string})`;
@@ -48,11 +51,12 @@ export enum RESTEvents {
export const ALLOWED_EXTENSIONS = ['webp', 'png', 'jpg', 'jpeg', 'gif'] as const satisfies readonly string[];
export const ALLOWED_STICKER_EXTENSIONS = ['png', 'json', 'gif'] as const satisfies readonly string[];
export const ALLOWED_SIZES = [16, 32, 64, 128, 256, 512, 1_024, 2_048, 4_096] as const satisfies readonly number[];
export const ALLOWED_SIZES: readonly number[] = [
16, 32, 64, 128, 256, 512, 1_024, 2_048, 4_096,
] satisfies readonly ImageSize[];
export type ImageExtension = (typeof ALLOWED_EXTENSIONS)[number];
export type StickerExtension = (typeof ALLOWED_STICKER_EXTENSIONS)[number];
export type ImageSize = (typeof ALLOWED_SIZES)[number];
export const OverwrittenMimeTypes = {
// https://github.com/discordjs/discord.js/issues/8557

View File

@@ -27,6 +27,31 @@ All notable changes to this project will be documented in this file.
---------
- Native zlib support (#10316) ([94cc02a](https://github.com/discordjs/discord.js/commit/94cc02a2580496774d75673abc0caabc765d9ee0)) by @sdanialraza
# [@discordjs/ws@2.0.0](https://github.com/discordjs/discord.js/compare/@discordjs/ws@1.1.1...@discordjs/ws@2.0.0) - (2024-09-02)
## Bug Fixes
- **WebSocketShard:** Buffer native zlib decompression payload (#10416) ([defb083](https://github.com/discordjs/discord.js/commit/defb083528ef31383778187a04ced8b00d886242)) by @didinele
- **WebSocketManager:** Heartbeat event had outdated types (#10417) ([5eabec1](https://github.com/discordjs/discord.js/commit/5eabec14d45ef7bdd7f610e84234eb63e726eacd)) by @didinele
- Retry for EAI_AGAIN I/O error (#10383) ([be04acd](https://github.com/discordjs/discord.js/commit/be04acd534d7d0c3fb7f6bd174e4a6482aae0d73)) by @didinele
- Consistent debug log spacing (#10349) ([38c699b](https://github.com/discordjs/discord.js/commit/38c699bc8a2ca40f37f70c93e08067e00f12ee81)) by @Jiralite
## Features
- **WebsocketManager:** Retroactive token setting (#10418) ([de94eaf](https://github.com/discordjs/discord.js/commit/de94eaf351a69fab57ec766bd9e90e8c05e8c3d1)) by @didinele
- **WebSocketShard:** Explicit time out network error handling (#10375) ([093ac92](https://github.com/discordjs/discord.js/commit/093ac924aef1bf328feadb49876bfbe26052fe1a)) by @didinele
## Refactor
- **WebSocketShard:** Error event handling (#10436) ([a6de270](https://github.com/discordjs/discord.js/commit/a6de2707fc1107262b12491f73b5b6887df91c67)) by @didinele
- **ws:** Event layout (#10376) ([bf6761a](https://github.com/discordjs/discord.js/commit/bf6761a44adec1fe5017f6bf5d8bc0734916961f)) by @didinele
- **BREAKING CHANGE:** All events now emit shard id as its own param
* fix: worker event forwarding
---------
- Native zlib support (#10316) ([94cc02a](https://github.com/discordjs/discord.js/commit/94cc02a2580496774d75673abc0caabc765d9ee0)) by @sdanialraza
# [@discordjs/ws@2.0.0](https://github.com/discordjs/discord.js/compare/@discordjs/ws@1.1.0...@discordjs/ws@2.0.0) - (2024-09-01)
## Bug Fixes

View File

@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@discordjs/ws",
"version": "2.0.1",
"version": "2.0.2",
"description": "Wrapper around Discord's gateway",
"scripts": {
"test": "vitest run",
@@ -79,7 +79,7 @@
"@sapphire/async-queue": "^1.5.3",
"@types/ws": "^8.5.12",
"@vladfrangu/async_event_emitter": "^2.4.6",
"discord-api-types": "^0.37.119",
"discord-api-types": "^0.38.1",
"tslib": "^2.6.3",
"ws": "^8.18.0"
},

197
pnpm-lock.yaml generated
View File

@@ -804,8 +804,8 @@ importers:
specifier: ^2.4.6
version: 2.4.6
discord-api-types:
specifier: ^0.37.119
version: 0.37.119
specifier: ^0.38.1
version: 0.38.1
devDependencies:
'@discordjs/api-extractor':
specifier: workspace:^
@@ -920,14 +920,14 @@ importers:
packages/discord.js:
dependencies:
'@discordjs/builders':
specifier: ^1.10.0
version: 1.10.0
specifier: ^1.11.1
version: 1.11.1
'@discordjs/collection':
specifier: 1.5.3
version: 1.5.3
'@discordjs/formatters':
specifier: ^0.6.0
version: 0.6.0
specifier: ^0.6.1
version: 0.6.1
'@discordjs/rest':
specifier: workspace:^
version: link:../rest
@@ -935,20 +935,23 @@ importers:
specifier: workspace:^
version: link:../util
'@discordjs/ws':
specifier: ^1.2.0
version: 1.2.0(bufferutil@4.0.8)(utf-8-validate@6.0.4)
specifier: ^1.2.2
version: 1.2.2(bufferutil@4.0.8)(utf-8-validate@6.0.4)
'@sapphire/snowflake':
specifier: 3.5.3
version: 3.5.3
discord-api-types:
specifier: ^0.37.119
version: 0.37.119
specifier: ^0.38.1
version: 0.38.1
fast-deep-equal:
specifier: 3.1.3
version: 3.1.3
lodash.snakecase:
specifier: 4.1.1
version: 4.1.1
magic-bytes.js:
specifier: ^1.10.0
version: 1.10.0
tslib:
specifier: ^2.6.3
version: 2.6.3
@@ -1307,8 +1310,8 @@ importers:
specifier: ^2.4.6
version: 2.4.6
discord-api-types:
specifier: ^0.37.119
version: 0.37.119
specifier: ^0.38.1
version: 0.38.1
magic-bytes.js:
specifier: ^1.10.0
version: 1.10.0
@@ -1701,8 +1704,8 @@ importers:
specifier: ^2.4.6
version: 2.4.6
discord-api-types:
specifier: ^0.37.119
version: 0.37.119
specifier: ^0.38.1
version: 0.38.1
tslib:
specifier: ^2.6.3
version: 2.6.3
@@ -2601,48 +2604,44 @@ packages:
resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==}
engines: {node: '>=12'}
'@definitelytyped/header-parser@0.2.16':
resolution: {integrity: sha512-UFsgPft5bhZn07UNGz/9ck4AhdKgLFEOmi2DNr7gXcGL89zbe3u5oVafKUT8j1HOtSBjT8ZEQsXHKlbq+wwF/Q==}
'@definitelytyped/header-parser@0.2.19':
resolution: {integrity: sha512-zu+RxQpUCgorYUQZoyyrRIn9CljL1CeM4qak3NDeMO1r7tjAkodfpAGnVzx/6JR2OUk0tAgwmZxNMSwd9LVgxw==}
engines: {node: '>=18.18.0'}
'@definitelytyped/typescript-versions@0.1.6':
resolution: {integrity: sha512-gQpXFteIKrOw4ldmBZQfBrD3WobaIG1SwOr/3alXWkcYbkOWa2NRxQbiaYQ2IvYTGaZK26miJw0UOAFiuIs4gA==}
'@definitelytyped/typescript-versions@0.1.8':
resolution: {integrity: sha512-iz6q9aTwWW7CzN2g8jFQfZ955D63LA+wdIAKz4+2pCc/7kokmEHie1/jVWSczqLFOlmH+69bWQxIurryBP/sig==}
engines: {node: '>=18.18.0'}
'@definitelytyped/utils@0.1.8':
resolution: {integrity: sha512-4JINx4Rttha29f50PBsJo48xZXx/He5yaIWJRwVarhYAN947+S84YciHl+AIhQNRPAFkg8+5qFngEGtKxQDWXA==}
engines: {node: '>=18.18.0'}
'@discordjs/builders@1.10.0':
resolution: {integrity: sha512-ikVZsZP+3shmVJ5S1oM+7SveUCK3L9fTyfA8aJ7uD9cNQlTqF+3Irbk2Y22KXTb3C3RNUahRkSInClJMkHrINg==}
'@discordjs/builders@1.11.1':
resolution: {integrity: sha512-2zDAVuoeAkdv0YQzYKO8vZfaDfB+1KZ60ymBKtD7QDpsh6lzAnQSUBLqeRkhlons6BT9+yRctOh9fPy94w6kDA==}
engines: {node: '>=16.11.0'}
'@discordjs/collection@1.5.3':
resolution: {integrity: sha512-SVb428OMd3WO1paV3rm6tSjM4wC+Kecaa1EUGX7vc6/fddvw/6lg90z4QtCqm21zvVe92vMMDt9+DkIvjXImQQ==}
engines: {node: '>=16.11.0'}
'@discordjs/collection@2.1.0':
resolution: {integrity: sha512-mLcTACtXUuVgutoznkh6hS3UFqYirDYAg5Dc1m8xn6OvPjetnUlf/xjtqnnc47OwWdaoCQnHmHh9KofhD6uRqw==}
engines: {node: '>=18'}
'@discordjs/collection@2.1.1':
resolution: {integrity: sha512-LiSusze9Tc7qF03sLCujF5iZp7K+vRNEDBZ86FT9aQAv3vxMLihUvKvpsCWiQ2DJq1tVckopKm1rxomgNUc9hg==}
engines: {node: '>=18'}
'@discordjs/formatters@0.6.0':
resolution: {integrity: sha512-YIruKw4UILt/ivO4uISmrGq2GdMY6EkoTtD0oS0GvkJFRZbTSdPhzYiUILbJ/QslsvC9H9nTgGgnarnIl4jMfw==}
'@discordjs/formatters@0.6.1':
resolution: {integrity: sha512-5cnX+tASiPCqCWtFcFslxBVUaCetB0thvM/JyavhbXInP1HJIEU+Qv/zMrnuwSsX3yWH2lVXNJZeDK3EiP4HHg==}
engines: {node: '>=16.11.0'}
'@discordjs/rest@2.4.1':
resolution: {integrity: sha512-a4Vv69usWY4ypwcENzH6QWYNrPwu+es3tRQMLKgaUFs0Mx2Yn7xfDW62++kcgckG8XbHWO7ej1x7raS7LuYgvA==}
'@discordjs/rest@2.5.0':
resolution: {integrity: sha512-PWhchxTzpn9EV3vvPRpwS0EE2rNYB9pvzDU/eLLW3mByJl0ZHZjHI2/wA8EbH2gRMQV7nu+0FoDF84oiPl8VAQ==}
engines: {node: '>=18'}
'@discordjs/util@1.1.1':
resolution: {integrity: sha512-eddz6UnOBEB1oITPinyrB2Pttej49M9FZQY8NxgEvc3tq6ZICZ19m70RsmzRdDHk80O9NoYN/25AqJl8vPVf/g==}
engines: {node: '>=18'}
'@discordjs/ws@1.2.0':
resolution: {integrity: sha512-QH5CAFe3wHDiedbO+EI3OOiyipwWd+Q6BdoFZUw/Wf2fw5Cv2fgU/9UEtJRmJa9RecI+TAhdGPadMaEIur5yJg==}
'@discordjs/ws@1.2.2':
resolution: {integrity: sha512-dyfq7yn0wO0IYeYOs3z79I6/HumhmKISzFL0Z+007zQJMtAFGtt3AEoq1nuLXtcunUE5YYYQqgKvybXukAK8/w==}
engines: {node: '>=16.11.0'}
'@edge-runtime/format@2.2.1':
@@ -7647,6 +7646,9 @@ packages:
discord-api-types@0.37.119:
resolution: {integrity: sha512-WasbGFXEB+VQWXlo6IpW3oUv73Yuau1Ig4AZF/m13tXcTKnMpc/mHjpztIlz4+BM9FG9BHQkEXiPto3bKduQUg==}
discord-api-types@0.38.1:
resolution: {integrity: sha512-vsjsqjAuxsPhiwbPjTBeGQaDPlizFmSkU0mTzFGMgRxqCDIRBR7iTY74HacpzrDV0QtERHRKQEk1tq7drZUtHg==}
dlv@1.1.3:
resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==}
@@ -8111,6 +8113,7 @@ packages:
eslint-plugin-i@2.29.1:
resolution: {integrity: sha512-ORizX37MelIWLbMyqI7hi8VJMf7A0CskMmYkB+lkCX3aF4pkGV7kwx5bSEb4qx7Yce2rAf9s34HqDRPjGRZPNQ==}
engines: {node: '>=12'}
deprecated: Please migrate to the brand new `eslint-plugin-import-x` instead
peerDependencies:
eslint: ^7.2.0 || ^8
@@ -8235,6 +8238,7 @@ packages:
eslint@8.57.0:
resolution: {integrity: sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
deprecated: This version is no longer supported. Please see https://eslint.org/version-support for other options.
hasBin: true
espree@10.1.0:
@@ -12322,6 +12326,7 @@ packages:
stream-connect@1.0.2:
resolution: {integrity: sha512-68Kl+79cE0RGKemKkhxTSg8+6AGrqBt+cbZAXevg2iJ6Y3zX4JhA/sZeGzLpxW9cXhmqAcE7KnJCisUmIUfnFQ==}
engines: {node: '>=0.10.0'}
deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
stream-to-array@2.3.0:
resolution: {integrity: sha512-UsZtOYEn4tWU2RGLOXr/o/xjRBftZRlG3dEWoaHr8j4GuypJ3isitGbVyjQKAuMu+xbiop8q224TjiZWc4XTZA==}
@@ -13075,10 +13080,6 @@ packages:
resolution: {integrity: sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==}
engines: {node: '>=14.0'}
undici@6.19.8:
resolution: {integrity: sha512-U8uCCl2x9TK3WANvmBavymRzxbfFYG+tAu+fgx3zxQy3qdagQqBLwJVrdyO1TBfUXvfKveMKJZhpvUYoOjM+4g==}
engines: {node: '>=18.17'}
undici@6.21.1:
resolution: {integrity: sha512-q/1rj5D0/zayJB2FraXdaWxbhWiNKDvu8naDT2dl1yTlvJp4BLtOcp2a5BvgGNQpYYJzau7tf1WgKv3b+7mqpQ==}
engines: {node: '>=18.17'}
@@ -14855,13 +14856,13 @@ snapshots:
dependencies:
'@jridgewell/trace-mapping': 0.3.9
'@definitelytyped/header-parser@0.2.16':
'@definitelytyped/header-parser@0.2.19':
dependencies:
'@definitelytyped/typescript-versions': 0.1.6
'@definitelytyped/typescript-versions': 0.1.8
'@definitelytyped/utils': 0.1.8
semver: 7.6.3
'@definitelytyped/typescript-versions@0.1.6': {}
'@definitelytyped/typescript-versions@0.1.8': {}
'@definitelytyped/utils@0.1.8':
dependencies:
@@ -14874,49 +14875,47 @@ snapshots:
tar-stream: 3.1.7
which: 4.0.0
'@discordjs/builders@1.10.0':
'@discordjs/builders@1.11.1':
dependencies:
'@discordjs/formatters': 0.6.0
'@discordjs/formatters': 0.6.1
'@discordjs/util': 1.1.1
'@sapphire/shapeshift': 4.0.0
discord-api-types: 0.37.119
discord-api-types: 0.38.1
fast-deep-equal: 3.1.3
ts-mixer: 6.0.4
tslib: 2.6.3
'@discordjs/collection@1.5.3': {}
'@discordjs/collection@2.1.0': {}
'@discordjs/collection@2.1.1': {}
'@discordjs/formatters@0.6.0':
'@discordjs/formatters@0.6.1':
dependencies:
discord-api-types: 0.37.119
discord-api-types: 0.38.1
'@discordjs/rest@2.4.1':
'@discordjs/rest@2.5.0':
dependencies:
'@discordjs/collection': 2.1.1
'@discordjs/util': 1.1.1
'@sapphire/async-queue': 1.5.3
'@sapphire/snowflake': 3.5.3
'@vladfrangu/async_event_emitter': 2.4.6
discord-api-types: 0.37.119
discord-api-types: 0.38.1
magic-bytes.js: 1.10.0
tslib: 2.6.3
undici: 6.19.8
undici: 6.21.1
'@discordjs/util@1.1.1': {}
'@discordjs/ws@1.2.0(bufferutil@4.0.8)(utf-8-validate@6.0.4)':
'@discordjs/ws@1.2.2(bufferutil@4.0.8)(utf-8-validate@6.0.4)':
dependencies:
'@discordjs/collection': 2.1.0
'@discordjs/rest': 2.4.1
'@discordjs/collection': 2.1.1
'@discordjs/rest': 2.5.0
'@discordjs/util': 1.1.1
'@sapphire/async-queue': 1.5.3
'@types/ws': 8.5.12
'@vladfrangu/async_event_emitter': 2.4.6
discord-api-types: 0.37.119
discord-api-types: 0.38.1
tslib: 2.6.3
ws: 8.18.0(bufferutil@4.0.8)(utf-8-validate@6.0.4)
transitivePeerDependencies:
@@ -15457,7 +15456,7 @@ snapshots:
'@jest/console@29.7.0':
dependencies:
'@jest/types': 29.6.3
'@types/node': 18.19.45
'@types/node': 18.19.74
chalk: 4.1.2
jest-message-util: 29.7.0
jest-util: 29.7.0
@@ -15537,7 +15536,7 @@ snapshots:
dependencies:
'@jest/fake-timers': 29.7.0
'@jest/types': 29.6.3
'@types/node': 18.19.45
'@types/node': 18.19.74
jest-mock: 29.7.0
'@jest/expect-utils@29.7.0':
@@ -15555,7 +15554,7 @@ snapshots:
dependencies:
'@jest/types': 29.6.3
'@sinonjs/fake-timers': 10.3.0
'@types/node': 18.19.45
'@types/node': 18.19.74
jest-message-util: 29.7.0
jest-mock: 29.7.0
jest-util: 29.7.0
@@ -15577,7 +15576,7 @@ snapshots:
'@jest/transform': 29.7.0
'@jest/types': 29.6.3
'@jridgewell/trace-mapping': 0.3.25
'@types/node': 18.19.45
'@types/node': 18.19.74
chalk: 4.1.2
collect-v8-coverage: 1.0.2
exit: 0.1.2
@@ -15839,7 +15838,7 @@ snapshots:
'@rushstack/ts-command-line': 4.19.1(@types/node@16.18.105)
lodash: 4.17.21
minimatch: 3.0.8
resolve: 1.22.8
resolve: 1.22.10
semver: 7.5.4
source-map: 0.6.1
typescript: 5.4.2
@@ -15858,7 +15857,7 @@ snapshots:
'@rushstack/ts-command-line': 4.19.1(@types/node@18.17.9)
lodash: 4.17.21
minimatch: 3.0.8
resolve: 1.22.8
resolve: 1.22.10
semver: 7.5.4
source-map: 0.6.1
typescript: 5.4.2
@@ -15877,7 +15876,7 @@ snapshots:
'@rushstack/ts-command-line': 4.19.1(@types/node@18.19.45)
lodash: 4.17.21
minimatch: 3.0.8
resolve: 1.22.8
resolve: 1.22.10
semver: 7.5.4
source-map: 0.6.1
typescript: 5.4.2
@@ -15895,7 +15894,7 @@ snapshots:
'@rushstack/ts-command-line': 4.19.1(@types/node@20.16.1)
lodash: 4.17.21
minimatch: 3.0.8
resolve: 1.22.8
resolve: 1.22.10
semver: 7.5.4
source-map: 0.6.1
typescript: 5.4.2
@@ -16206,7 +16205,7 @@ snapshots:
'@opentelemetry/propagator-b3': 1.25.1(@opentelemetry/api@1.9.0)
'@opentelemetry/propagator-jaeger': 1.25.1(@opentelemetry/api@1.9.0)
'@opentelemetry/sdk-trace-base': 1.25.1(@opentelemetry/api@1.9.0)
semver: 7.6.3
semver: 7.5.4
'@opentelemetry/semantic-conventions@1.15.2': {}
@@ -18020,7 +18019,7 @@ snapshots:
fs-extra: 7.0.1
import-lazy: 4.0.0
jju: 1.4.0
resolve: 1.22.8
resolve: 1.22.10
semver: 7.5.4
z-schema: 5.0.5
optionalDependencies:
@@ -18032,7 +18031,7 @@ snapshots:
fs-extra: 7.0.1
import-lazy: 4.0.0
jju: 1.4.0
resolve: 1.22.8
resolve: 1.22.10
semver: 7.5.4
z-schema: 5.0.5
optionalDependencies:
@@ -18044,7 +18043,7 @@ snapshots:
fs-extra: 7.0.1
import-lazy: 4.0.0
jju: 1.4.0
resolve: 1.22.8
resolve: 1.22.10
semver: 7.5.4
z-schema: 5.0.5
optionalDependencies:
@@ -18055,7 +18054,7 @@ snapshots:
fs-extra: 7.0.1
import-lazy: 4.0.0
jju: 1.4.0
resolve: 1.22.8
resolve: 1.22.10
semver: 7.5.4
z-schema: 5.0.5
optionalDependencies:
@@ -18080,7 +18079,7 @@ snapshots:
'@rushstack/rig-package@0.5.2':
dependencies:
resolve: 1.22.8
resolve: 1.22.10
strip-json-comments: 3.1.1
'@rushstack/terminal@0.10.0(@types/node@16.18.105)':
@@ -18944,25 +18943,25 @@ snapshots:
'@types/body-parser@1.19.5':
dependencies:
'@types/connect': 3.4.38
'@types/node': 18.19.45
'@types/node': 18.19.74
'@types/concat-stream@2.0.3':
dependencies:
'@types/node': 18.19.45
'@types/node': 18.19.74
'@types/connect@3.4.38':
dependencies:
'@types/node': 18.19.45
'@types/node': 18.19.74
'@types/conventional-commits-parser@5.0.0':
dependencies:
'@types/node': 18.19.45
'@types/node': 18.19.74
'@types/cookiejar@2.1.5': {}
'@types/cross-spawn@6.0.6':
dependencies:
'@types/node': 18.19.45
'@types/node': 18.19.74
'@types/debug@4.1.12':
dependencies:
@@ -18994,7 +18993,7 @@ snapshots:
'@types/express-serve-static-core@4.19.5':
dependencies:
'@types/node': 18.19.45
'@types/node': 18.19.74
'@types/qs': 6.9.15
'@types/range-parser': 1.2.7
'@types/send': 0.17.4
@@ -19011,11 +19010,11 @@ snapshots:
'@types/glob@7.2.0':
dependencies:
'@types/minimatch': 5.1.2
'@types/node': 18.19.45
'@types/node': 18.19.74
'@types/graceful-fs@4.1.9':
dependencies:
'@types/node': 18.19.45
'@types/node': 18.19.74
'@types/hast@2.3.10':
dependencies:
@@ -19097,7 +19096,7 @@ snapshots:
'@types/node-fetch@2.6.11':
dependencies:
'@types/node': 18.19.45
'@types/node': 18.19.74
form-data: 4.0.0
'@types/node@16.18.105': {}
@@ -19124,7 +19123,7 @@ snapshots:
'@types/pg@8.11.6':
dependencies:
'@types/node': 18.19.45
'@types/node': 18.19.74
pg-protocol: 1.6.1
pg-types: 4.0.2
@@ -19157,12 +19156,12 @@ snapshots:
'@types/send@0.17.4':
dependencies:
'@types/mime': 1.3.5
'@types/node': 18.19.45
'@types/node': 18.19.74
'@types/serve-static@1.15.7':
dependencies:
'@types/http-errors': 2.0.4
'@types/node': 18.19.45
'@types/node': 18.19.74
'@types/send': 0.17.4
'@types/stack-utils@2.0.3': {}
@@ -19183,7 +19182,7 @@ snapshots:
'@types/through@0.0.33':
dependencies:
'@types/node': 18.19.45
'@types/node': 18.19.74
'@types/tinycolor2@1.4.6': {}
@@ -19327,7 +19326,7 @@ snapshots:
dependencies:
'@typescript-eslint/typescript-estree': 8.2.0(typescript@5.5.4)
'@typescript-eslint/utils': 8.2.0(eslint@8.57.0)(typescript@5.5.4)
debug: 4.3.6
debug: 4.4.0
ts-api-utils: 1.3.0(typescript@5.5.4)
optionalDependencies:
typescript: 5.5.4
@@ -19391,7 +19390,7 @@ snapshots:
dependencies:
'@typescript-eslint/types': 8.2.0
'@typescript-eslint/visitor-keys': 8.2.0
debug: 4.3.6
debug: 4.4.0
globby: 11.1.0
is-glob: 4.0.3
minimatch: 9.0.5
@@ -21532,6 +21531,8 @@ snapshots:
discord-api-types@0.37.119: {}
discord-api-types@0.38.1: {}
dlv@1.1.3: {}
dmd@6.2.3:
@@ -21581,7 +21582,7 @@ snapshots:
dts-critic@3.3.11(typescript@5.5.4):
dependencies:
'@definitelytyped/header-parser': 0.2.16
'@definitelytyped/header-parser': 0.2.19
command-exists: 1.2.9
rimraf: 3.0.2
semver: 6.3.1
@@ -21591,8 +21592,8 @@ snapshots:
dtslint@4.2.1(typescript@5.5.4):
dependencies:
'@definitelytyped/header-parser': 0.2.16
'@definitelytyped/typescript-versions': 0.1.6
'@definitelytyped/header-parser': 0.2.19
'@definitelytyped/typescript-versions': 0.1.8
'@definitelytyped/utils': 0.1.8
dts-critic: 3.3.11(typescript@5.5.4)
fs-extra: 6.0.1
@@ -23936,7 +23937,7 @@ snapshots:
'@jest/expect': 29.7.0
'@jest/test-result': 29.7.0
'@jest/types': 29.6.3
'@types/node': 18.19.45
'@types/node': 18.19.74
chalk: 4.1.2
co: 4.6.0
dedent: 1.5.3
@@ -24111,7 +24112,7 @@ snapshots:
'@jest/environment': 29.7.0
'@jest/fake-timers': 29.7.0
'@jest/types': 29.6.3
'@types/node': 18.19.45
'@types/node': 18.19.74
jest-mock: 29.7.0
jest-util: 29.7.0
@@ -24121,7 +24122,7 @@ snapshots:
dependencies:
'@jest/types': 29.6.3
'@types/graceful-fs': 4.1.9
'@types/node': 18.19.45
'@types/node': 18.19.74
anymatch: 3.1.3
fb-watchman: 2.0.2
graceful-fs: 4.2.11
@@ -24160,7 +24161,7 @@ snapshots:
jest-mock@29.7.0:
dependencies:
'@jest/types': 29.6.3
'@types/node': 18.19.45
'@types/node': 18.19.74
jest-util: 29.7.0
jest-pnp-resolver@1.2.3(jest-resolve@29.7.0):
@@ -24195,7 +24196,7 @@ snapshots:
'@jest/test-result': 29.7.0
'@jest/transform': 29.7.0
'@jest/types': 29.6.3
'@types/node': 18.19.45
'@types/node': 18.19.74
chalk: 4.1.2
emittery: 0.13.1
graceful-fs: 4.2.11
@@ -24223,7 +24224,7 @@ snapshots:
'@jest/test-result': 29.7.0
'@jest/transform': 29.7.0
'@jest/types': 29.6.3
'@types/node': 18.19.45
'@types/node': 18.19.74
chalk: 4.1.2
cjs-module-lexer: 1.3.1
collect-v8-coverage: 1.0.2
@@ -24269,7 +24270,7 @@ snapshots:
jest-util@29.7.0:
dependencies:
'@jest/types': 29.6.3
'@types/node': 18.19.45
'@types/node': 18.19.74
chalk: 4.1.2
ci-info: 3.9.0
graceful-fs: 4.2.11
@@ -24288,7 +24289,7 @@ snapshots:
dependencies:
'@jest/test-result': 29.7.0
'@jest/types': 29.6.3
'@types/node': 18.19.45
'@types/node': 18.19.74
ansi-escapes: 4.3.2
chalk: 4.1.2
emittery: 0.13.1
@@ -24302,7 +24303,7 @@ snapshots:
jest-worker@29.7.0:
dependencies:
'@types/node': 18.19.45
'@types/node': 18.19.74
jest-util: 29.7.0
merge-stream: 2.0.0
supports-color: 8.1.1
@@ -26066,7 +26067,7 @@ snapshots:
isbinaryfile: 4.0.10
lodash.get: 4.4.2
mkdirp: 0.5.6
resolve: 1.22.8
resolve: 1.22.10
node-releases@2.0.18: {}
@@ -26776,7 +26777,7 @@ snapshots:
'@protobufjs/path': 1.1.2
'@protobufjs/pool': 1.1.0
'@protobufjs/utf8': 1.1.0
'@types/node': 18.19.45
'@types/node': 18.19.74
long: 5.2.3
proxy-addr@2.0.7:
@@ -26787,7 +26788,7 @@ snapshots:
proxy-agent@6.4.0:
dependencies:
agent-base: 7.1.1
debug: 4.3.6
debug: 4.4.0
http-proxy-agent: 7.0.2
https-proxy-agent: 7.0.5
lru-cache: 7.18.3
@@ -26959,7 +26960,7 @@ snapshots:
'@types/doctrine': 0.0.9
'@types/resolve': 1.20.6
doctrine: 3.0.0
resolve: 1.22.8
resolve: 1.22.10
strip-indent: 4.0.0
transitivePeerDependencies:
- supports-color
@@ -28111,7 +28112,7 @@ snapshots:
dependencies:
component-emitter: 1.3.1
cookiejar: 2.1.4
debug: 4.3.6
debug: 4.4.0
fast-safe-stringify: 2.1.1
form-data: 4.0.0
formidable: 3.5.1
@@ -28825,8 +28826,6 @@ snapshots:
dependencies:
'@fastify/busboy': 2.1.1
undici@6.19.8: {}
undici@6.21.1: {}
unicode-canonical-property-names-ecmascript@2.0.0: {}