Compare commits

...

23 Commits

Author SHA1 Message Date
iCrawl
9d8966fe24 chore(discord.js): release discord.js@14.2.0 2022-08-10 20:50:57 +02:00
iCrawl
4d128acac5 chore: deps 2022-08-10 20:37:25 +02:00
iCrawl
831d6506cb chore: update changelog 2022-08-10 20:26:45 +02:00
RedGuy12
c5b96a185c types(Message): correct bulkDelete return type (#8465)
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Noel <buechler.noel@outlook.com>
2022-08-10 20:25:12 +02:00
Jiralite
afa27b15c5 fix(ThreadChannel): Handle possibly null parent (#8466) 2022-08-10 20:16:57 +02:00
iCrawl
4d7283933d chore: update changelog 2022-08-10 19:44:23 +02:00
Jan Parisek
452e94fd3e types: fix missing types for mentionable options (#8443)
Co-authored-by: A. Román <kyradiscord@gmail.com>
Co-authored-by: Noel <buechler.noel@outlook.com>
2022-08-10 18:33:52 +02:00
Jiralite
6c6fe74dd8 fix: Remove DM channels from Client#messageDeleteBulk's types (#8460) 2022-08-10 18:29:46 +02:00
A. Román
0e2a09571c fix(Transformers): do not transform Date objects (#8463) 2022-08-10 18:28:35 +02:00
Ryan Munro
0fab869e51 fix(ModalSubmitInteraction): allow deferUpdate (#8455) 2022-08-10 18:25:56 +02:00
advaith
64a4041a05 docs: change registration example to use global commands (#8454) 2022-08-10 18:25:31 +02:00
Jan Parisek
38275fc53d types(ApplicationCommandOption): add ApplicationCommandBooleanOption (#8434) 2022-08-10 18:24:50 +02:00
n1ck_pro
aac8acc22b fix(Guild): unable to fetch templates (#8420) 2022-08-08 11:11:10 +02:00
Ryan Munro
6ef4754d40 docs(Colors): provide enum descriptions (#8437) 2022-08-08 11:10:43 +02:00
Almeida
b8a31360a2 fix(MessageMentions): infinite loop in parsedUsers getter (#8430) 2022-08-08 11:10:32 +02:00
RedGuy12
5b053cf82e docs(AttachmentBuilder): fix #8407 (#8421)
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
2022-08-08 11:06:11 +02:00
Synbulat Biishev
e72b986939 fix(DataResolver): make Buffer from string (#8416) 2022-08-08 11:05:56 +02:00
Jiralite
3a96ce7970 feat(Guild): Add max_video_channel_users (#8423) 2022-08-08 11:05:40 +02:00
SpaceEEC
359f688555 fix(WebSocketShard): always reconnect on disconnected with 1000 (#8405) 2022-08-01 13:24:25 +02:00
SpaceEEC
3161e1a1ac fix(WebSocketShard): emit errors directly instead of objects (#8406) 2022-08-01 13:24:09 +02:00
iCrawl
4d8361c711 build: fix building actions 2022-07-30 22:02:02 +02:00
iCrawl
d6e4d149fd chore(discord.js): release discord.js@14.1.2 2022-07-30 21:00:09 +02:00
DD
480c85c9c3 fix(errors): error codes (#8398) 2022-07-30 20:49:59 +02:00
34 changed files with 1695 additions and 1261 deletions

View File

@@ -72,7 +72,7 @@ const rest = new REST({ version: '10' }).setToken('token');
try {
console.log('Started refreshing application (/) commands.');
await rest.put(Routes.applicationGuildCommands(CLIENT_ID, GUILD_ID), { body: commands });
await rest.put(Routes.applicationCommands(CLIENT_ID), { body: commands });
console.log('Successfully reloaded application (/) commands.');
} catch (error) {

View File

@@ -39,15 +39,15 @@
"devDependencies": {
"@commitlint/cli": "^17.0.3",
"@commitlint/config-angular": "^17.0.3",
"@favware/cliff-jumper": "^1.8.5",
"@favware/npm-deprecate": "^1.0.4",
"@typescript-eslint/eslint-plugin": "^5.31.0",
"@typescript-eslint/parser": "^5.31.0",
"@favware/cliff-jumper": "^1.8.6",
"@favware/npm-deprecate": "^1.0.5",
"@typescript-eslint/eslint-plugin": "^5.33.0",
"@typescript-eslint/parser": "^5.33.0",
"conventional-changelog-cli": "^2.2.2",
"eslint": "^8.20.0",
"eslint": "^8.21.0",
"eslint-config-marine": "^9.4.1",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-typescript": "^3.3.0",
"eslint-import-resolver-typescript": "^3.4.0",
"eslint-plugin-import": "^2.26.0",
"fast-glob": "^3.2.11",
"husky": "^8.0.1",

View File

@@ -1,3 +1,11 @@
import { createUnbuildConfig } from '../../build.config';
export default createUnbuildConfig({ minify: true, emitCJS: false });
export default createUnbuildConfig({
entries: [
{ builder: 'rollup', input: 'src/index' },
{ builder: 'rollup', input: 'src/formatTag/index' },
],
preserveModules: false,
minify: true,
emitCJS: false,
});

View File

@@ -39,18 +39,18 @@
},
"homepage": "https://discord.js.org",
"dependencies": {
"@actions/core": "^1.9.0",
"@actions/core": "^1.9.1",
"tslib": "^2.4.0"
},
"devDependencies": {
"@types/node": "^16.11.46",
"@types/node": "^16.11.47",
"c8": "^7.12.0",
"eslint": "^8.20.0",
"eslint": "^8.21.0",
"prettier": "^2.7.1",
"rollup-plugin-typescript2": "0.32.1",
"typescript": "^4.7.4",
"unbuild": "^0.7.6",
"vitest": "^0.19.1"
"unbuild": "^0.8.4",
"vitest": "^0.21.1"
},
"engines": {
"node": ">=16.9.0"

View File

@@ -11,4 +11,4 @@ outputs:
description: 'The semver string that was extracted from this tag'
runs:
using: node16
main: ../../dist/formatTag/index.mjs
main: ../../dist/index.mjs

View File

@@ -62,17 +62,17 @@
},
"devDependencies": {
"@discordjs/docgen": "workspace:^",
"@favware/cliff-jumper": "^1.8.5",
"@microsoft/api-extractor": "^7.28.6",
"@types/node": "^16.11.46",
"@favware/cliff-jumper": "^1.8.6",
"@microsoft/api-extractor": "^7.29.2",
"@types/node": "^16.11.47",
"c8": "^7.12.0",
"downlevel-dts": "^0.10.0",
"eslint": "^8.20.0",
"eslint": "^8.21.0",
"prettier": "^2.7.1",
"rollup-plugin-typescript2": "0.32.1",
"typescript": "^4.7.4",
"unbuild": "^0.7.6",
"vitest": "^0.19.1"
"unbuild": "^0.8.4",
"vitest": "^0.21.1"
},
"engines": {
"node": ">=16.9.0"

View File

@@ -51,17 +51,17 @@
"homepage": "https://discord.js.org",
"devDependencies": {
"@discordjs/docgen": "workspace:^",
"@favware/cliff-jumper": "^1.8.5",
"@microsoft/api-extractor": "^7.28.6",
"@types/node": "^16.11.46",
"@favware/cliff-jumper": "^1.8.6",
"@microsoft/api-extractor": "^7.29.2",
"@types/node": "^16.11.47",
"c8": "^7.12.0",
"downlevel-dts": "^0.10.0",
"eslint": "^8.20.0",
"eslint": "^8.21.0",
"prettier": "^2.7.1",
"rollup-plugin-typescript2": "0.32.1",
"typescript": "^4.7.4",
"unbuild": "^0.7.6",
"vitest": "^0.19.1"
"unbuild": "^0.8.4",
"vitest": "^0.21.1"
},
"engines": {
"node": ">=16.9.0"

View File

@@ -2,6 +2,44 @@
All notable changes to this project will be documented in this file.
# [14.2.0](https://github.com/discordjs/discord.js/compare/14.1.2...14.2.0) - (2022-08-10)
## Bug Fixes
- **ThreadChannel:** Handle possibly `null` parent (#8466) ([afa27b1](https://github.com/discordjs/discord.js/commit/afa27b15c5b92bc8d55b8285834d8e03f6692d06))
- Remove DM channels from `Client#messageDeleteBulk`'s types (#8460) ([6c6fe74](https://github.com/discordjs/discord.js/commit/6c6fe74dd84859c5319efa999404e8168f189710))
- **Transformers:** Do not transform `Date` objects (#8463) ([0e2a095](https://github.com/discordjs/discord.js/commit/0e2a09571c8e5ee61153b04e45334a226a1b4534))
- **ModalSubmitInteraction:** Allow deferUpdate (#8455) ([0fab869](https://github.com/discordjs/discord.js/commit/0fab869e5179dca7ddec75b5519615278e51ad82))
- **Guild:** Unable to fetch templates (#8420) ([aac8acc](https://github.com/discordjs/discord.js/commit/aac8acc22be7d7af99933ef099eca7deda43cb40))
- **MessageMentions:** Infinite loop in `parsedUsers` getter (#8430) ([b8a3136](https://github.com/discordjs/discord.js/commit/b8a31360a220e3d796f5381bd215d30a379ecb7c))
- **DataResolver:** Make `Buffer` from string (#8416) ([e72b986](https://github.com/discordjs/discord.js/commit/e72b986939e2958547c0e54d6d27472c8d111609))
## Documentation
- Change registration example to use global commands (#8454) ([64a4041](https://github.com/discordjs/discord.js/commit/64a4041a05e9514334a9f9e1f38a1ea18bb676d5))
- **Colors:** Provide enum descriptions (#8437) ([6ef4754](https://github.com/discordjs/discord.js/commit/6ef4754d40c5ec65715fc1e00e643c52fe0a6209))
- **AttachmentBuilder:** Fix #8407 (#8421) ([5b053cf](https://github.com/discordjs/discord.js/commit/5b053cf82ec2f2b717a490485af052dc956fe3c9))
## Features
- **Guild:** Add `max_video_channel_users` (#8423) ([3a96ce7](https://github.com/discordjs/discord.js/commit/3a96ce7970947f6268c21a1323d986aac8cb736d))
## Typings
- **Message:** Correct `bulkDelete` return type (#8465) ([c5b96a1](https://github.com/discordjs/discord.js/commit/c5b96a185cb8ba836b7cd10526c14059866f218f))
- Fix missing types for mentionable options (#8443) ([452e94f](https://github.com/discordjs/discord.js/commit/452e94fd3ecc12de9e3408982c5c7fd931bae634))
- **ApplicationCommandOption:** Add `ApplicationCommandBooleanOption` (#8434) ([38275fc](https://github.com/discordjs/discord.js/commit/38275fc53d633ce77ed2b142aff788dcbd4fad8c))
# [14.1.2](https://github.com/discordjs/discord.js/compare/14.1.1...14.1.2) - (2022-07-30)
## Bug Fixes
- **errors:** Error codes (#8398) ([480c85c](https://github.com/discordjs/discord.js/commit/480c85c9c3d129204b3399ed726a4e570e0b2852))
## Documentation
- **Embed:** Ensure height and width are numbers (#8396) ([fca3dad](https://github.com/discordjs/discord.js/commit/fca3dada2a565eecfc7e5275cc9317df1d261871))
# [14.1.0](https://github.com/discordjs/discord.js/compare/14.0.3...14.1.0) - (2022-07-29)
## Bug Fixes
@@ -57,7 +95,7 @@ All notable changes to this project will be documented in this file.
- 14.0.1 release bump, no new features.
# [14.0.0](https://github.com/discordjs/discord.js/compare/13.9.2...14.0.0) - (2022-07-17)
# [14.0.0](https://github.com/discordjs/discord.js/compare/13.10.1...14.0.0) - (2022-07-17)
## Bug Fixes
@@ -463,6 +501,18 @@ All notable changes to this project will be documented in this file.
- AssertType -> expectType ([3f36746](https://github.com/discordjs/discord.js/commit/3f36746561a40cd61a7cd2e054b7ef80d58fc707))
- Fix cache types resolving to `never` (#7164) ([c978dbb](https://github.com/discordjs/discord.js/commit/c978dbb6233bcd85408caf0bca7619c9c5d508f0))
# [13.10.1](https://github.com/discordjs/discord.js/compare/13.10.0...13.10.1) - (2022-08-10)
## Bug Fixes
- **ThreadChannel:** Handle possibly `null` parent (v13) (#8467) ([2a46d9f](https://github.com/discordjs/discord.js/commit/2a46d9f58e4714c8580218a3459992bbfec2bcf7))
# [13.10.0](https://github.com/discordjs/discord.js/compare/13.9.2...13.10.0) - (2022-08-08)
## Features
- **Guild:** Add `max_video_channel_users` (v13) (#8424) ([ae43bca](https://github.com/discordjs/discord.js/commit/ae43bca8b0afd8b90db7a1d99f67205b29338c2d))
# [13.9.2](https://github.com/discordjs/discord.js/compare/13.9.1...13.9.2) - (2022-07-29)
## Bug Fixes

View File

@@ -71,7 +71,7 @@ const rest = new REST({ version: '10' }).setToken('token');
try {
console.log('Started refreshing application (/) commands.');
await rest.put(Routes.applicationGuildCommands(CLIENT_ID, GUILD_ID), { body: commands });
await rest.put(Routes.applicationCommands(CLIENT_ID), { body: commands });
console.log('Successfully reloaded application (/) commands.');
} catch (error) {

View File

@@ -1,6 +1,6 @@
{
"name": "discord.js",
"version": "14.1.1",
"version": "14.2.0",
"description": "A powerful library for interacting with the Discord API",
"scripts": {
"test": "yarn docs:test && yarn test:typescript",
@@ -58,15 +58,15 @@
"fast-deep-equal": "^3.1.3",
"lodash.snakecase": "^4.1.1",
"tslib": "^2.4.0",
"undici": "^5.8.0",
"undici": "^5.8.2",
"ws": "^8.8.1"
},
"devDependencies": {
"@discordjs/docgen": "workspace:^",
"@favware/cliff-jumper": "^1.8.5",
"@types/node": "^16.11.46",
"@favware/cliff-jumper": "^1.8.6",
"@types/node": "^16.11.47",
"dtslint": "^4.2.1",
"eslint": "^8.20.0",
"eslint": "^8.21.0",
"jest": "^28.1.3",
"prettier": "^2.7.1",
"tsd": "^0.22.0",

View File

@@ -33,7 +33,7 @@ class MessageDeleteBulkAction extends Action {
* Emitted whenever messages are deleted in bulk.
* @event Client#messageDeleteBulk
* @param {Collection<Snowflake, Message>} messages The deleted messages, mapped by their id
* @param {TextBasedChannels} channel The channel that the messages were deleted in
* @param {GuildTextBasedChannel} channel The channel that the messages were deleted in
*/
if (messages.size > 0) client.emit(Events.MessageBulkDelete, messages, channel);
return { messages };

View File

@@ -3,7 +3,6 @@
// Heavily inspired by node's `internal/errors` module
const ErrorCodes = require('./ErrorCodes');
const Messages = require('./Messages');
const kCode = Symbol('code');
/**
* Extend an error of some sort into a DiscordjsError.
@@ -15,17 +14,13 @@ function makeDiscordjsError(Base) {
return class DiscordjsError extends Base {
constructor(code, ...args) {
super(message(code, args));
this[kCode] = code;
this.code = code;
Error.captureStackTrace?.(this, DiscordjsError);
}
get name() {
return `${super.name} [${this.code}]`;
}
get code() {
return ErrorCodes[this[kCode]];
}
};
}
@@ -37,9 +32,9 @@ function makeDiscordjsError(Base) {
* @ignore
*/
function message(code, args) {
if (typeof code !== 'number') throw new Error('Error code must be a valid DiscordjsErrorCodes');
if (!(code in ErrorCodes)) throw new Error('Error code must be a valid DiscordjsErrorCodes');
const msg = Messages[code];
if (!msg) throw new Error(`An invalid error code was used: ${code}.`);
if (!msg) throw new Error(`No message associated with error code: ${code}.`);
if (typeof msg === 'function') return msg(...args);
if (!args?.length) return msg;
args.unshift(msg);

View File

@@ -1,159 +1,152 @@
'use strict';
const { createEnum } = require('../util/Enums');
/**
* @typedef {Object} DiscordjsErrorCodes
* @property {number} ClientInvalidOption
* @property {number} ClientInvalidProvidedShards
* @property {number} ClientMissingIntents
* @property {number} ClientNotReady
* @property {'ClientInvalidOption'} ClientInvalidOption
* @property {'ClientInvalidProvidedShards'} ClientInvalidProvidedShards
* @property {'ClientMissingIntents'} ClientMissingIntents
* @property {'ClientNotReady'} ClientNotReady
* @property {number} TokenInvalid
* @property {number} TokenMissing
* @property {number} ApplicationCommandPermissionsTokenMissing
* @property {'TokenInvalid'} TokenInvalid
* @property {'TokenMissing'} TokenMissing
* @property {'ApplicationCommandPermissionsTokenMissing'} ApplicationCommandPermissionsTokenMissing
* @property {number} WSCloseRequested
* @property {number} WSConnectionExists
* @property {number} WSNotOpen
* @property {number} ManagerDestroyed
* @property {'WSCloseRequested'} WSCloseRequested
* @property {'WSConnectionExists'} WSConnectionExists
* @property {'WSNotOpen'} WSNotOpen
* @property {'ManagerDestroyed'} ManagerDestroyed
* @property {number} BitFieldInvalid
* @property {'BitFieldInvalid'} BitFieldInvalid
* @property {number} ShardingInvalid
* @property {number} ShardingRequired
* @property {number} InvalidIntents
* @property {number} DisallowedIntents
* @property {number} ShardingNoShards
* @property {number} ShardingInProcess
* @property {number} ShardingInvalidEvalBroadcast
* @property {number} ShardingShardNotFound
* @property {number} ShardingAlreadySpawned
* @property {number} ShardingProcessExists
* @property {number} ShardingWorkerExists
* @property {number} ShardingReadyTimeout
* @property {number} ShardingReadyDisconnected
* @property {number} ShardingReadyDied
* @property {number} ShardingNoChildExists
* @property {number} ShardingShardMiscalculation
* @property {'ShardingInvalid'} ShardingInvalid
* @property {'ShardingRequired'} ShardingRequired
* @property {'InvalidIntents'} InvalidIntents
* @property {'DisallowedIntents'} DisallowedIntents
* @property {'ShardingNoShards'} ShardingNoShards
* @property {'ShardingInProcess'} ShardingInProcess
* @property {'ShardingInvalidEvalBroadcast'} ShardingInvalidEvalBroadcast
* @property {'ShardingShardNotFound'} ShardingShardNotFound
* @property {'ShardingAlreadySpawned'} ShardingAlreadySpawned
* @property {'ShardingProcessExists'} ShardingProcessExists
* @property {'ShardingWorkerExists'} ShardingWorkerExists
* @property {'ShardingReadyTimeout'} ShardingReadyTimeout
* @property {'ShardingReadyDisconnected'} ShardingReadyDisconnected
* @property {'ShardingReadyDied'} ShardingReadyDied
* @property {'ShardingNoChildExists'} ShardingNoChildExists
* @property {'ShardingShardMiscalculation'} ShardingShardMiscalculation
* @property {number} ColorRange
* @property {number} ColorConvert
* @property {'ColorRange'} ColorRange
* @property {'ColorConvert'} ColorConvert
* @property {number} InviteOptionsMissingChannel
* @property {'InviteOptionsMissingChannel'} InviteOptionsMissingChannel
* @property {number} ButtonLabel
* @property {number} ButtonURL
* @property {number} ButtonCustomId
* @property {'ButtonLabel'} ButtonLabel
* @property {'ButtonURL'} ButtonURL
* @property {'ButtonCustomId'} ButtonCustomId
* @property {number} SelectMenuCustomId
* @property {number} SelectMenuPlaceholder
* @property {number} SelectOptionLabel
* @property {number} SelectOptionValue
* @property {number} SelectOptionDescription
* @property {'SelectMenuCustomId'} SelectMenuCustomId
* @property {'SelectMenuPlaceholder'} SelectMenuPlaceholder
* @property {'SelectOptionLabel'} SelectOptionLabel
* @property {'SelectOptionValue'} SelectOptionValue
* @property {'SelectOptionDescription'} SelectOptionDescription
* @property {number} InteractionCollectorError
* @property {'InteractionCollectorError'} InteractionCollectorError
* @property {number} FileNotFound
* @property {'FileNotFound'} FileNotFound
* @property {number} UserBannerNotFetched
* @property {number} UserNoDMChannel
* @property {'UserBannerNotFetched'} UserBannerNotFetched
* @property {'UserNoDMChannel'} UserNoDMChannel
* @property {number} VoiceNotStageChannel
* @property {'VoiceNotStageChannel'} VoiceNotStageChannel
* @property {number} VoiceStateNotOwn
* @property {number} VoiceStateInvalidType
* @property {'VoiceStateNotOwn'} VoiceStateNotOwn
* @property {'VoiceStateInvalidType'} VoiceStateInvalidType
* @property {number} ReqResourceType
* @property {'ReqResourceType'} ReqResourceType
* @property {number} ImageFormat
* @property {number} ImageSize
* @property {'ImageFormat'} ImageFormat
* @property {'ImageSize'} ImageSize
* @property {number} MessageBulkDeleteType
* @property {number} MessageNonceType
* @property {number} MessageContentType
* @property {'MessageBulkDeleteType'} MessageBulkDeleteType
* @property {'MessageNonceType'} MessageNonceType
* @property {'MessageContentType'} MessageContentType
* @property {number} SplitMaxLen
* @property {'SplitMaxLen'} SplitMaxLen
* @property {number} BanResolveId
* @property {number} FetchBanResolveId
* @property {'BanResolveId'} BanResolveId
* @property {'FetchBanResolveId'} FetchBanResolveId
* @property {number} PruneDaysType
* @property {'PruneDaysType'} PruneDaysType
* @property {number} GuildChannelResolve
* @property {number} GuildVoiceChannelResolve
* @property {number} GuildChannelOrphan
* @property {number} GuildChannelUnowned
* @property {number} GuildOwned
* @property {number} GuildMembersTimeout
* @property {number} GuildUncachedMe
* @property {number} ChannelNotCached
* @property {number} StageChannelResolve
* @property {number} GuildScheduledEventResolve
* @property {number} FetchOwnerId
* @property {'GuildChannelResolve'} GuildChannelResolve
* @property {'GuildVoiceChannelResolve'} GuildVoiceChannelResolve
* @property {'GuildChannelOrphan'} GuildChannelOrphan
* @property {'GuildChannelUnowned'} GuildChannelUnowned
* @property {'GuildOwned'} GuildOwned
* @property {'GuildMembersTimeout'} GuildMembersTimeout
* @property {'GuildUncachedMe'} GuildUncachedMe
* @property {'ChannelNotCached'} ChannelNotCached
* @property {'StageChannelResolve'} StageChannelResolve
* @property {'GuildScheduledEventResolve'} GuildScheduledEventResolve
* @property {'FetchOwnerId'} FetchOwnerId
* @property {number} InvalidType
* @property {number} InvalidElement
* @property {'InvalidType'} InvalidType
* @property {'InvalidElement'} InvalidElement
* @property {number} MessageThreadParent
* @property {number} MessageExistingThread
* @property {number} ThreadInvitableType
* @property {'MessageThreadParent'} MessageThreadParent
* @property {'MessageExistingThread'} MessageExistingThread
* @property {'ThreadInvitableType'} ThreadInvitableType
* @property {number} WebhookMessage
* @property {number} WebhookTokenUnavailable
* @property {number} WebhookURLInvalid
* @property {number} WebhookApplication
* @property {number} MessageReferenceMissing
* @property {'WebhookMessage'} WebhookMessage
* @property {'WebhookTokenUnavailable'} WebhookTokenUnavailable
* @property {'WebhookURLInvalid'} WebhookURLInvalid
* @property {'WebhookApplication'} WebhookApplication
* @property {'MessageReferenceMissing'} MessageReferenceMissing
* @property {number} EmojiType
* @property {number} EmojiManaged
* @property {number} MissingManageEmojisAndStickersPermission
* @property {number} NotGuildSticker
* @property {'EmojiType'} EmojiType
* @property {'EmojiManaged'} EmojiManaged
* @property {'MissingManageEmojisAndStickersPermission'} MissingManageEmojisAndStickersPermission
* @property {'NotGuildSticker'} NotGuildSticker
* @property {number} ReactionResolveUser
* @property {'ReactionResolveUser'} ReactionResolveUser
* @property {number} VanityURL
* @property {'VanityURL'} VanityURL
* @property {number} InviteResolveCode
* @property {'InviteResolveCode'} InviteResolveCode
* @property {number} InviteNotFound
* @property {'InviteNotFound'} InviteNotFound
* @property {number} DeleteGroupDMChannel
* @property {number} FetchGroupDMChannel
* @property {'DeleteGroupDMChannel'} DeleteGroupDMChannel
* @property {'FetchGroupDMChannel'} FetchGroupDMChannel
* @property {number} MemberFetchNonceLength
* @property {'MemberFetchNonceLength'} MemberFetchNonceLength
* @property {number} GlobalCommandPermissions
* @property {number} GuildUncachedEntityResolve
* @property {'GlobalCommandPermissions'} GlobalCommandPermissions
* @property {'GuildUncachedEntityResolve'} GuildUncachedEntityResolve
* @property {number} InteractionAlreadyReplied
* @property {number} InteractionNotReplied
* @property {number} InteractionEphemeralReplied
* @property {'InteractionAlreadyReplied'} InteractionAlreadyReplied
* @property {'InteractionNotReplied'} InteractionNotReplied
* @property {'InteractionEphemeralReplied'} InteractionEphemeralReplied
* @property {number} CommandInteractionOptionNotFound
* @property {number} CommandInteractionOptionType
* @property {number} CommandInteractionOptionEmpty
* @property {number} CommandInteractionOptionNoSubcommand
* @property {number} CommandInteractionOptionNoSubcommandGroup
* @property {number} AutocompleteInteractionOptionNoFocusedOption
* @property {'CommandInteractionOptionNotFound'} CommandInteractionOptionNotFound
* @property {'CommandInteractionOptionType'} CommandInteractionOptionType
* @property {'CommandInteractionOptionEmpty'} CommandInteractionOptionEmpty
* @property {'CommandInteractionOptionNoSubcommand'} CommandInteractionOptionNoSubcommand
* @property {'CommandInteractionOptionNoSubcommandGroup'} CommandInteractionOptionNoSubcommandGroup
* @property {'AutocompleteInteractionOptionNoFocusedOption'} AutocompleteInteractionOptionNoFocusedOption
* @property {number} ModalSubmitInteractionFieldNotFound
* @property {number} ModalSubmitInteractionFieldType
* @property {'ModalSubmitInteractionFieldNotFound'} ModalSubmitInteractionFieldNotFound
* @property {'ModalSubmitInteractionFieldType'} ModalSubmitInteractionFieldType
* @property {number} InvalidMissingScopes
* @property {'InvalidMissingScopes'} InvalidMissingScopes
* @property {number} NotImplemented
* @property {'NotImplemented'} NotImplemented
* @property {number} SweepFilterReturn
* @property {'SweepFilterReturn'} SweepFilterReturn
*/
// JSDoc for IntelliSense purposes
/**
* @type {DiscordjsErrorCodes}
* @ignore
*/
module.exports = createEnum([
const keys = [
'ClientInvalidOption',
'ClientInvalidProvidedShards',
'ClientMissingIntents',
@@ -295,4 +288,11 @@ module.exports = createEnum([
'NotImplemented',
'SweepFilterReturn',
]);
];
// JSDoc for IntelliSense purposes
/**
* @type {DiscordjsErrorCodes}
* @ignore
*/
module.exports = Object.fromEntries(keys.map(key => [key, key]));

View File

@@ -8,7 +8,7 @@ const { basename, flatten } = require('../util/Util');
class AttachmentBuilder {
/**
* @param {BufferResolvable|Stream} attachment The file
* @param {APIAttachment} [data] Extra data
* @param {AttachmentData} [data] Extra data
*/
constructor(attachment, data = {}) {
/**
@@ -108,3 +108,9 @@ module.exports = AttachmentBuilder;
* @external APIAttachment
* @see {@link https://discord.com/developers/docs/resources/channel#attachment-object}
*/
/**
* @typedef {Object} AttachmentData
* @property {string} [name] The name of the attachment
* @property {string} [description] The description of the attachment
*/

View File

@@ -287,6 +287,16 @@ class Guild extends AnonymousGuild {
this.maximumPresences ??= null;
}
if ('max_video_channel_users' in data) {
/**
* The maximum amount of users allowed in a video channel.
* @type {?number}
*/
this.maxVideoChannelUsers = data.max_video_channel_users;
} else {
this.maxVideoChannelUsers ??= null;
}
if ('approximate_member_count' in data) {
/**
* The approximate amount of members the guild has
@@ -550,7 +560,7 @@ class Guild extends AnonymousGuild {
* @returns {Promise<Collection<string, GuildTemplate>>}
*/
async fetchTemplates() {
const templates = await this.client.rest.get(Routes.guildTemplate(this.id));
const templates = await this.client.rest.get(Routes.guildTemplates(this.id));
return templates.reduce((col, data) => col.set(data.code, new GuildTemplate(this.client, data)), new Collection());
}

View File

@@ -48,6 +48,14 @@ class MessageMentions {
*/
static GlobalChannelsPattern = new RegExp(this.ChannelsPattern.source, 'g');
/**
* A global regular expression variant of {@link MessageMentions.UsersPattern}.
* @type {RegExp}
* @memberof MessageMentions
* @private
*/
static GlobalUsersPattern = new RegExp(this.UsersPattern.source, 'g');
constructor(message, users, roles, everyone, crosspostedChannels, repliedUser) {
/**
* The client the message is from
@@ -225,7 +233,7 @@ class MessageMentions {
if (this._parsedUsers) return this._parsedUsers;
this._parsedUsers = new Collection();
let matches;
while ((matches = this.constructor.UsersPattern.exec(this._content)) !== null) {
while ((matches = this.constructor.GlobalUsersPattern.exec(this._content)) !== null) {
const user = this.client.users.cache.get(matches[1]);
if (user) this._parsedUsers.set(user.id, user);
}

View File

@@ -283,10 +283,11 @@ class ThreadChannel extends BaseChannel {
* <info>This only works when the thread started from a message in the parent channel, otherwise the promise will
* reject. If you just need the id of that message, use {@link ThreadChannel#id} instead.</info>
* @param {BaseFetchOptions} [options] Additional options for this fetch
* @returns {Promise<Message>}
* @returns {Promise<Message|null>}
*/
fetchStarterMessage(options) {
return this.parent.messages.fetch({ message: this.id, ...options });
// eslint-disable-next-line require-await
async fetchStarterMessage(options) {
return this.parent?.messages.fetch({ message: this.id, ...options }) ?? null;
}
/**

View File

@@ -197,7 +197,7 @@ class InteractionResponses {
});
this.deferred = true;
return options.fetchReply ? this.fetchReply() : new InteractionResponse(this, this.message.interaction?.id);
return options.fetchReply ? this.fetchReply() : new InteractionResponse(this, this.message?.interaction?.id);
}
/**

View File

@@ -283,7 +283,7 @@ class TextBasedChannel {
* @param {Collection<Snowflake, Message>|MessageResolvable[]|number} messages
* Messages or number of messages to delete
* @param {boolean} [filterOld=false] Filter messages to remove those which are older than two weeks automatically
* @returns {Promise<Collection<Snowflake, Message>>} Returns the deleted messages
* @returns {Promise<Collection<Snowflake, Message|undefined>>} Returns the deleted messages
* @example
* // Bulk delete messages
* channel.bulkDelete(5)

View File

@@ -2,36 +2,36 @@
/**
* @typedef {Object} Colors
* @property {number} Default
* @property {number} White
* @property {number} Aqua
* @property {number} Green
* @property {number} Blue
* @property {number} Yellow
* @property {number} Purple
* @property {number} LuminousVividPink
* @property {number} Fuchsia
* @property {number} Gold
* @property {number} Orange
* @property {number} Red
* @property {number} Grey
* @property {number} Navy
* @property {number} DarkAqua
* @property {number} DarkGreen
* @property {number} DarkBlue
* @property {number} DarkPurple
* @property {number} DarkVividPink
* @property {number} DarkGold
* @property {number} DarkOrange
* @property {number} DarkRed
* @property {number} DarkGrey
* @property {number} DarkerGrey
* @property {number} LightGrey
* @property {number} DarkNavy
* @property {number} Blurple
* @property {number} Greyple
* @property {number} DarkButNotBlack
* @property {number} NotQuiteBlack
* @property {number} Default 0x000000 | rgb(0,0,0)
* @property {number} White 0xFFFFFF | rgb(255,255,255)
* @property {number} Aqua 0x1ABC9C | rgb(26,188,156)
* @property {number} Green 0x57F287 | rgb(87,242,135)
* @property {number} Blue 0x3498DB | rgb(52,152,219)
* @property {number} Yellow 0xFEE75C | rgb(254,231,92)
* @property {number} Purple 0x9B59B6 | rgb(155,89,182)
* @property {number} LuminousVividPink 0xE91E63 | rgb(233,30,99)
* @property {number} Fuchsia 0xEB459E | rgb(235,69,158)
* @property {number} Gold 0xF1C40F | rgb(241,196,15)
* @property {number} Orange 0xE67E22 | rgb(230,126,34)
* @property {number} Red 0xED4245 | rgb(237,66,69)
* @property {number} Grey 0x95A5A6 | rgb(149,165,166)
* @property {number} Navy 0x34495E | rgb(52,73,94)
* @property {number} DarkAqua 0x11806A | rgb(17,128,106)
* @property {number} DarkGreen 0x1F8B4C | rgb(31,139,76)
* @property {number} DarkBlue 0x206694 | rgb(32,102,148)
* @property {number} DarkPurple 0x71368A | rgb(113,54,138)
* @property {number} DarkVividPink 0xAD1457 | rgb(173,20,87)
* @property {number} DarkGold 0xC27C0E | rgb(194,124,14)
* @property {number} DarkOrange 0xA84300 | rgb(168,67,0)
* @property {number} DarkRed 0x992D22 | rgb(153,45,34)
* @property {number} DarkGrey 0x979C9F | rgb(151,156,159)
* @property {number} DarkerGrey 0x7F8C8D | rgb(127,140,141)
* @property {number} LightGrey 0xBCC0C0 | rgb(188,192,192)
* @property {number} DarkNavy 0x2C3E50 | rgb(44,62,80)
* @property {number} Blurple 0x5865F2 | rgb(88,101,242)
* @property {number} Greyple 0x99AAb5 | rgb(153,170,181)
* @property {number} DarkButNotBlack 0x2C2F33 | rgb(44,47,51)
* @property {number} NotQuiteBlack 0x23272A | rgb(35,39,42)
*/
// JSDoc for IntelliSense purposes

View File

@@ -53,13 +53,19 @@ exports.NonSystemMessageTypes = [
];
/**
* The channels that are text-based.
* * DMChannel
* The guild channels that are text-based.
* * TextChannel
* * NewsChannel
* * ThreadChannel
* * VoiceChannel
* @typedef {DMChannel|TextChannel|NewsChannel|ThreadChannel|VoiceChannel} TextBasedChannels
* @typedef {TextChannel|NewsChannel|ThreadChannel|VoiceChannel} GuildTextBasedChannel
*/
/**
* The channels that are text-based.
* * DMChannel
* * GuildTextBasedChannel
* @typedef {DMChannel|GuildTextBasedChannel} TextBasedChannels
*/
/**

View File

@@ -116,7 +116,7 @@ class DataResolver extends null {
if (typeof resource[Symbol.asyncIterator] === 'function') {
const buffers = [];
for await (const data of resource) buffers.push(data);
for await (const data of resource) buffers.push(Buffer.from(data));
return { data: Buffer.concat(buffers) };
}

View File

@@ -9,6 +9,7 @@ const snakeCase = require('lodash.snakecase');
*/
function toSnakeCase(obj) {
if (typeof obj !== 'object' || !obj) return obj;
if (obj instanceof Date) return obj;
if (Array.isArray(obj)) return obj.map(toSnakeCase);
return Object.fromEntries(Object.entries(obj).map(([key, value]) => [snakeCase(key), toSnakeCase(value)]));
}

View File

@@ -1083,6 +1083,7 @@ export class Guild extends AnonymousGuild {
public afkChannelId: Snowflake | null;
public afkTimeout: number;
public applicationId: Snowflake | null;
public maxVideoChannelUsers: number | null;
public approximateMemberCount: number | null;
public approximatePresenceCount: number | null;
public available: boolean;
@@ -1880,8 +1881,9 @@ export class MessageMentions {
public crosspostedChannels: Collection<Snowflake, CrosspostedChannel>;
public toJSON(): unknown;
public static ChannelsPattern: typeof FormattingPatterns.Channel;
private static GlobalChannelsPattern: RegExp;
private static GlobalUsersPattern: RegExp;
public static ChannelsPattern: typeof FormattingPatterns.Channel;
public static EveryonePattern: RegExp;
public static RolesPattern: typeof FormattingPatterns.Role;
public static UsersPattern: typeof FormattingPatterns.User;
@@ -1972,8 +1974,6 @@ export interface ModalMessageModalSubmitInteraction<Cached extends CacheType = C
update(
options: string | MessagePayload | InteractionUpdateOptions,
): Promise<InteractionResponse<BooleanCache<Cached>>>;
deferUpdate(options: InteractionDeferUpdateOptions & { fetchReply: true }): Promise<Message>;
deferUpdate(options?: InteractionDeferUpdateOptions): Promise<InteractionResponse<BooleanCache<Cached>>>;
inGuild(): this is ModalMessageModalSubmitInteraction<'raw' | 'cached'>;
inCachedGuild(): this is ModalMessageModalSubmitInteraction<'cached'>;
inRawGuild(): this is ModalMessageModalSubmitInteraction<'raw'>;
@@ -2004,6 +2004,8 @@ export class ModalSubmitInteraction<Cached extends CacheType = CacheType> extend
public deferReply(options?: InteractionDeferReplyOptions): Promise<InteractionResponse<BooleanCache<Cached>>>;
public fetchReply(): Promise<Message<BooleanCache<Cached>>>;
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<Message<BooleanCache<Cached>>>;
public deferUpdate(options: InteractionDeferUpdateOptions & { fetchReply: true }): Promise<Message>;
public deferUpdate(options?: InteractionDeferUpdateOptions): Promise<InteractionResponse<BooleanCache<Cached>>>;
public inGuild(): this is ModalSubmitInteraction<'raw' | 'cached'>;
public inCachedGuild(): this is ModalSubmitInteraction<'cached'>;
public inRawGuild(): this is ModalSubmitInteraction<'raw'>;
@@ -2538,7 +2540,7 @@ export class ThreadChannel extends TextBasedChannelMixin(BaseChannel, ['fetchWeb
checkAdmin?: boolean,
): Readonly<PermissionsBitField> | null;
public fetchOwner(options?: BaseFetchOptions): Promise<ThreadMember | null>;
public fetchStarterMessage(options?: BaseFetchOptions): Promise<Message>;
public fetchStarterMessage(options?: BaseFetchOptions): Promise<Message | null>;
public setArchived(archived?: boolean, reason?: string): Promise<AnyThreadChannel>;
public setAutoArchiveDuration(
autoArchiveDuration: ThreadAutoArchiveDuration,
@@ -3021,152 +3023,152 @@ export const version: string;
//#region Errors
export enum DiscordjsErrorCodes {
ClientInvalidOption,
ClientInvalidProvidedShards,
ClientMissingIntents,
ClientNotReady,
ClientInvalidOption = 'ClientInvalidOption',
ClientInvalidProvidedShards = 'ClientInvalidProvidedShards',
ClientMissingIntents = 'ClientMissingIntents',
ClientNotReady = 'ClientNotReady',
TokenInvalid,
TokenMissing,
ApplicationCommandPermissionsTokenMissing,
TokenInvalid = 'TokenInvalid',
TokenMissing = 'TokenMissing',
ApplicationCommandPermissionsTokenMissing = 'ApplicationCommandPermissionsTokenMissing',
WSCloseRequested,
WSConnectionExists,
WSNotOpen,
ManagerDestroyed,
WSCloseRequested = 'WSCloseRequested',
WSConnectionExists = 'WSConnectionExists',
WSNotOpen = 'WSNotOpen',
ManagerDestroyed = 'ManagerDestroyed',
BitFieldInvalid,
BitFieldInvalid = 'BitFieldInvalid',
ShardingInvalid,
ShardingRequired,
InvalidIntents,
DisallowedIntents,
ShardingNoShards,
ShardingInProcess,
ShardingInvalidEvalBroadcast,
ShardingShardNotFound,
ShardingAlreadySpawned,
ShardingProcessExists,
ShardingWorkerExists,
ShardingReadyTimeout,
ShardingReadyDisconnected,
ShardingReadyDied,
ShardingNoChildExists,
ShardingShardMiscalculation,
ShardingInvalid = 'ShardingInvalid',
ShardingRequired = 'ShardingRequired',
InvalidIntents = 'InvalidIntents',
DisallowedIntents = 'DisallowedIntents',
ShardingNoShards = 'ShardingNoShards',
ShardingInProcess = 'ShardingInProcess',
ShardingInvalidEvalBroadcast = 'ShardingInvalidEvalBroadcast',
ShardingShardNotFound = 'ShardingShardNotFound',
ShardingAlreadySpawned = 'ShardingAlreadySpawned',
ShardingProcessExists = 'ShardingProcessExists',
ShardingWorkerExists = 'ShardingWorkerExists',
ShardingReadyTimeout = 'ShardingReadyTimeout',
ShardingReadyDisconnected = 'ShardingReadyDisconnected',
ShardingReadyDied = 'ShardingReadyDied',
ShardingNoChildExists = 'ShardingNoChildExists',
ShardingShardMiscalculation = 'ShardingShardMiscalculation',
ColorRange,
ColorConvert,
ColorRange = 'ColorRange',
ColorConvert = 'ColorConvert',
InviteOptionsMissingChannel,
InviteOptionsMissingChannel = 'InviteOptionsMissingChannel',
ButtonLabel,
ButtonURL,
ButtonCustomId,
ButtonLabel = 'ButtonLabel',
ButtonURL = 'ButtonURL',
ButtonCustomId = 'ButtonCustomId',
SelectMenuCustomId,
SelectMenuPlaceholder,
SelectOptionLabel,
SelectOptionValue,
SelectOptionDescription,
SelectMenuCustomId = 'SelectMenuCustomId',
SelectMenuPlaceholder = 'SelectMenuPlaceholder',
SelectOptionLabel = 'SelectOptionLabel',
SelectOptionValue = 'SelectOptionValue',
SelectOptionDescription = 'SelectOptionDescription',
InteractionCollectorError,
InteractionCollectorError = 'InteractionCollectorError',
FileNotFound,
FileNotFound = 'FileNotFound',
UserBannerNotFetched,
UserNoDMChannel,
UserBannerNotFetched = 'UserBannerNotFetched',
UserNoDMChannel = 'UserNoDMChannel',
VoiceNotStageChannel,
VoiceNotStageChannel = 'VoiceNotStageChannel',
VoiceStateNotOwn,
VoiceStateInvalidType,
VoiceStateNotOwn = 'VoiceStateNotOwn',
VoiceStateInvalidType = 'VoiceStateInvalidType',
ReqResourceType,
ReqResourceType = 'ReqResourceType',
ImageFormat,
ImageSize,
ImageFormat = 'ImageFormat',
ImageSize = 'ImageSize',
MessageBulkDeleteType,
MessageNonceType,
MessageContentType,
MessageBulkDeleteType = 'MessageBulkDeleteType',
MessageNonceType = 'MessageNonceType',
MessageContentType = 'MessageContentType',
SplitMaxLen,
SplitMaxLen = 'SplitMaxLen',
BanResolveId,
FetchBanResolveId,
BanResolveId = 'BanResolveId',
FetchBanResolveId = 'FetchBanResolveId',
PruneDaysType,
PruneDaysType = 'PruneDaysType',
GuildChannelResolve,
GuildVoiceChannelResolve,
GuildChannelOrphan,
GuildChannelUnowned,
GuildOwned,
GuildMembersTimeout,
GuildUncachedMe,
ChannelNotCached,
StageChannelResolve,
GuildScheduledEventResolve,
FetchOwnerId,
GuildChannelResolve = 'GuildChannelResolve',
GuildVoiceChannelResolve = 'GuildVoiceChannelResolve',
GuildChannelOrphan = 'GuildChannelOrphan',
GuildChannelUnowned = 'GuildChannelUnowned',
GuildOwned = 'GuildOwned',
GuildMembersTimeout = 'GuildMembersTimeout',
GuildUncachedMe = 'GuildUncachedMe',
ChannelNotCached = 'ChannelNotCached',
StageChannelResolve = 'StageChannelResolve',
GuildScheduledEventResolve = 'GuildScheduledEventResolve',
FetchOwnerId = 'FetchOwnerId',
InvalidType,
InvalidElement,
InvalidType = 'InvalidType',
InvalidElement = 'InvalidElement',
MessageThreadParent,
MessageExistingThread,
ThreadInvitableType,
MessageThreadParent = 'MessageThreadParent',
MessageExistingThread = 'MessageExistingThread',
ThreadInvitableType = 'ThreadInvitableType',
WebhookMessage,
WebhookTokenUnavailable,
WebhookURLInvalid,
WebhookApplication,
MessageReferenceMissing,
WebhookMessage = 'WebhookMessage',
WebhookTokenUnavailable = 'WebhookTokenUnavailable',
WebhookURLInvalid = 'WebhookURLInvalid',
WebhookApplication = 'WebhookApplication',
MessageReferenceMissing = 'MessageReferenceMissing',
EmojiType,
EmojiManaged,
MissingManageEmojisAndStickersPermission,
NotGuildSticker,
EmojiType = 'EmojiType',
EmojiManaged = 'EmojiManaged',
MissingManageEmojisAndStickersPermission = 'MissingManageEmojisAndStickersPermission',
NotGuildSticker = 'NotGuildSticker',
ReactionResolveUser,
ReactionResolveUser = 'ReactionResolveUser',
VanityURL,
VanityURL = 'VanityURL',
InviteResolveCode,
InviteResolveCode = 'InviteResolveCode',
InviteNotFound,
InviteNotFound = 'InviteNotFound',
DeleteGroupDMChannel,
FetchGroupDMChannel,
DeleteGroupDMChannel = 'DeleteGroupDMChannel',
FetchGroupDMChannel = 'FetchGroupDMChannel',
MemberFetchNonceLength,
MemberFetchNonceLength = 'MemberFetchNonceLength',
GlobalCommandPermissions,
GuildUncachedEntityResolve,
GlobalCommandPermissions = 'GlobalCommandPermissions',
GuildUncachedEntityResolve = 'GuildUncachedEntityResolve',
InteractionAlreadyReplied,
InteractionNotReplied,
InteractionEphemeralReplied,
InteractionAlreadyReplied = 'InteractionAlreadyReplied',
InteractionNotReplied = 'InteractionNotReplied',
InteractionEphemeralReplied = 'InteractionEphemeralReplied',
CommandInteractionOptionNotFound,
CommandInteractionOptionType,
CommandInteractionOptionEmpty,
CommandInteractionOptionNoSubcommand,
CommandInteractionOptionNoSubcommandGroup,
AutocompleteInteractionOptionNoFocusedOption,
CommandInteractionOptionNotFound = 'CommandInteractionOptionNotFound',
CommandInteractionOptionType = 'CommandInteractionOptionType',
CommandInteractionOptionEmpty = 'CommandInteractionOptionEmpty',
CommandInteractionOptionNoSubcommand = 'CommandInteractionOptionNoSubcommand',
CommandInteractionOptionNoSubcommandGroup = 'CommandInteractionOptionNoSubcommandGroup',
AutocompleteInteractionOptionNoFocusedOption = 'AutocompleteInteractionOptionNoFocusedOption',
ModalSubmitInteractionFieldNotFound,
ModalSubmitInteractionFieldType,
ModalSubmitInteractionFieldNotFound = 'ModalSubmitInteractionFieldNotFound',
ModalSubmitInteractionFieldType = 'ModalSubmitInteractionFieldType',
InvalidMissingScopes,
InvalidMissingScopes = 'InvalidMissingScopes',
NotImplemented,
NotImplemented = 'NotImplemented',
SweepFilterReturn,
SweepFilterReturn = 'SweepFilterReturn',
}
export interface DiscordjsErrorFields<Name extends string> {
readonly name: `${Name} [${keyof typeof DiscordjsErrorCodes}]`;
get code(): keyof typeof DiscordjsErrorCodes;
readonly name: `${Name} [${DiscordjsErrorCodes}]`;
get code(): DiscordjsErrorCodes;
}
export function DiscordjsErrorMixin<T, N extends string>(
@@ -3656,7 +3658,7 @@ export interface TextBasedChannelFields extends PartialTextBasedChannelFields {
bulkDelete(
messages: Collection<Snowflake, Message> | readonly MessageResolvable[] | number,
filterOld?: boolean,
): Promise<Collection<Snowflake, Message>>;
): Promise<Collection<Snowflake, Message | PartialMessage | undefined>>;
createMessageComponentCollector<T extends MessageComponentType>(
options?: MessageChannelCollectorOptionsParams<T, true>,
): InteractionCollector<MappedInteractionTypes[T]>;
@@ -3793,6 +3795,30 @@ export interface ApplicationCommandChannelOption extends BaseApplicationCommandO
channelTypes?: ChannelType[];
}
export interface ApplicationCommandRoleOptionData extends BaseApplicationCommandOptionsData {
type: ApplicationCommandOptionType.Role;
}
export interface ApplicationCommandRoleOption extends BaseApplicationCommandOptionsData {
type: ApplicationCommandOptionType.Role;
}
export interface ApplicationCommandUserOptionData extends BaseApplicationCommandOptionsData {
type: ApplicationCommandOptionType.User;
}
export interface ApplicationCommandUserOption extends BaseApplicationCommandOptionsData {
type: ApplicationCommandOptionType.User;
}
export interface ApplicationCommandMentionableOptionData extends BaseApplicationCommandOptionsData {
type: ApplicationCommandOptionType.Mentionable;
}
export interface ApplicationCommandMentionableOption extends BaseApplicationCommandOptionsData {
type: ApplicationCommandOptionType.Mentionable;
}
export interface ApplicationCommandAttachmentOption extends BaseApplicationCommandOptionsData {
type: ApplicationCommandOptionType.Attachment;
}
@@ -3833,6 +3859,10 @@ export interface ApplicationCommandStringOptionData extends ApplicationCommandCh
max_length?: number;
}
export interface ApplicationCommandBooleanOptionData extends BaseApplicationCommandOptionsData {
type: ApplicationCommandOptionType.Boolean;
}
export interface ApplicationCommandNumericOption extends ApplicationCommandChoicesOption {
type: CommandOptionNumericResolvableType;
minValue?: number;
@@ -3845,6 +3875,10 @@ export interface ApplicationCommandStringOption extends ApplicationCommandChoice
maxLength?: number;
}
export interface ApplicationCommandBooleanOption extends BaseApplicationCommandOptionsData {
type: ApplicationCommandOptionType.Boolean;
}
export interface ApplicationCommandSubGroupData extends Omit<BaseApplicationCommandOptionsData, 'required'> {
type: ApplicationCommandOptionType.SubcommandGroup;
options?: ApplicationCommandSubCommandData[];
@@ -3863,7 +3897,11 @@ export interface ApplicationCommandSubCommandData extends Omit<BaseApplicationCo
| ApplicationCommandChannelOptionData
| ApplicationCommandAutocompleteOption
| ApplicationCommandNumericOptionData
| ApplicationCommandRoleOptionData
| ApplicationCommandUserOptionData
| ApplicationCommandMentionableOptionData
| ApplicationCommandStringOptionData
| ApplicationCommandBooleanOption
)[];
}
@@ -3888,6 +3926,10 @@ export type ApplicationCommandOptionData =
| ApplicationCommandAutocompleteOption
| ApplicationCommandNumericOptionData
| ApplicationCommandStringOptionData
| ApplicationCommandRoleOptionData
| ApplicationCommandUserOptionData
| ApplicationCommandMentionableOptionData
| ApplicationCommandBooleanOptionData
| ApplicationCommandSubCommandData;
export type ApplicationCommandOption =
@@ -3897,6 +3939,10 @@ export type ApplicationCommandOption =
| ApplicationCommandChoicesOption
| ApplicationCommandNumericOption
| ApplicationCommandStringOption
| ApplicationCommandRoleOption
| ApplicationCommandUserOption
| ApplicationCommandMentionableOption
| ApplicationCommandBooleanOption
| ApplicationCommandAttachmentOption
| ApplicationCommandSubCommand;
@@ -4121,7 +4167,7 @@ export interface ClientEvents {
reactions: Collection<string | Snowflake, MessageReaction>,
];
messageReactionRemoveEmoji: [reaction: MessageReaction | PartialMessageReaction];
messageDeleteBulk: [messages: Collection<Snowflake, Message | PartialMessage>, channel: TextBasedChannel];
messageDeleteBulk: [messages: Collection<Snowflake, Message | PartialMessage>, channel: GuildTextBasedChannel];
messageReactionAdd: [reaction: MessageReaction | PartialMessageReaction, user: User | PartialUser];
messageReactionRemove: [reaction: MessageReaction | PartialMessageReaction, user: User | PartialUser];
messageUpdate: [oldMessage: Message | PartialMessage, newMessage: Message | PartialMessage];

View File

@@ -46,17 +46,17 @@
"commander": "^9.4.0",
"jsdoc-to-markdown": "^7.1.1",
"tslib": "^2.4.0",
"typedoc": "^0.23.9"
"typedoc": "^0.23.10"
},
"devDependencies": {
"@favware/cliff-jumper": "^1.8.5",
"@favware/cliff-jumper": "^1.8.6",
"@types/jsdoc-to-markdown": "^7.0.3",
"@types/node": "^16.11.46",
"eslint": "^8.20.0",
"@types/node": "^16.11.47",
"eslint": "^8.21.0",
"prettier": "^2.7.1",
"rollup-plugin-typescript2": "0.32.1",
"typescript": "^4.7.4",
"unbuild": "^0.7.6"
"unbuild": "^0.8.4"
},
"engines": {
"node": ">=16.9.0"

View File

@@ -49,12 +49,12 @@
"tslib": "^2.4.0"
},
"devDependencies": {
"@types/node": "^16.11.46",
"eslint": "^8.20.0",
"@types/node": "^16.11.47",
"eslint": "^8.21.0",
"prettier": "^2.7.1",
"rollup-plugin-typescript2": "0.32.1",
"typescript": "^4.7.4",
"unbuild": "^0.7.6"
"unbuild": "^0.8.4"
},
"engines": {
"node": ">=16.9.0"

View File

@@ -56,23 +56,23 @@
"dependencies": {
"@discordjs/rest": "^1.0.0",
"tslib": "^2.4.0",
"undici": "^5.8.0"
"undici": "^5.8.2"
},
"devDependencies": {
"@discordjs/docgen": "workspace:^",
"@favware/cliff-jumper": "^1.8.5",
"@microsoft/api-extractor": "^7.28.6",
"@types/node": "^16.11.46",
"@favware/cliff-jumper": "^1.8.6",
"@microsoft/api-extractor": "^7.29.2",
"@types/node": "^16.11.47",
"@types/supertest": "^2.0.12",
"c8": "^7.12.0",
"downlevel-dts": "^0.10.0",
"eslint": "^8.20.0",
"eslint": "^8.21.0",
"prettier": "^2.7.1",
"rollup-plugin-typescript2": "0.32.1",
"supertest": "^6.2.4",
"typescript": "^4.7.4",
"unbuild": "^0.7.6",
"vitest": "^0.19.1"
"unbuild": "^0.8.4",
"vitest": "^0.21.1"
},
"engines": {
"node": ">=16.9.0"

View File

@@ -53,26 +53,26 @@
"homepage": "https://discord.js.org",
"dependencies": {
"@discordjs/collection": "workspace:^",
"@sapphire/async-queue": "^1.3.2",
"@sapphire/async-queue": "^1.4.0",
"@sapphire/snowflake": "^3.2.2",
"discord-api-types": "^0.36.3",
"file-type": "^17.1.4",
"file-type": "^17.1.6",
"tslib": "^2.4.0",
"undici": "^5.8.0"
"undici": "^5.8.2"
},
"devDependencies": {
"@discordjs/docgen": "workspace:^",
"@favware/cliff-jumper": "^1.8.5",
"@microsoft/api-extractor": "^7.28.6",
"@types/node": "^16.11.46",
"@favware/cliff-jumper": "^1.8.6",
"@microsoft/api-extractor": "^7.29.2",
"@types/node": "^16.11.47",
"c8": "^7.12.0",
"downlevel-dts": "^0.10.0",
"eslint": "^8.20.0",
"eslint": "^8.21.0",
"prettier": "^2.7.1",
"rollup-plugin-typescript2": "0.32.1",
"typescript": "^4.7.4",
"unbuild": "^0.7.6",
"vitest": "^0.19.1"
"unbuild": "^0.8.4",
"vitest": "^0.21.1"
},
"engines": {
"node": ">=16.9.0"

View File

@@ -48,14 +48,14 @@
"tslib": "^2.4.0"
},
"devDependencies": {
"@types/node": "^16.11.46",
"@types/node": "^16.11.47",
"c8": "^7.12.0",
"eslint": "^8.20.0",
"eslint": "^8.21.0",
"prettier": "^2.7.1",
"rollup-plugin-typescript2": "0.32.1",
"typescript": "^4.7.4",
"unbuild": "^0.7.6",
"vitest": "^0.19.1"
"unbuild": "^0.8.4",
"vitest": "^0.21.1"
},
"engines": {
"node": ">=16.9.0"

View File

@@ -59,25 +59,25 @@
"ws": "^8.8.1"
},
"devDependencies": {
"@babel/core": "^7.18.9",
"@babel/preset-env": "^7.18.9",
"@babel/core": "^7.18.10",
"@babel/preset-env": "^7.18.10",
"@babel/preset-typescript": "^7.18.6",
"@discordjs/docgen": "workspace:^",
"@discordjs/scripts": "workspace:^",
"@favware/cliff-jumper": "^1.8.5",
"@microsoft/api-extractor": "^7.28.6",
"@favware/cliff-jumper": "^1.8.6",
"@microsoft/api-extractor": "^7.29.2",
"@types/jest": "^28.1.6",
"@types/node": "^16.11.46",
"@types/node": "^16.11.47",
"downlevel-dts": "^0.10.0",
"eslint": "^8.20.0",
"eslint": "^8.21.0",
"jest": "^28.1.3",
"jest-websocket-mock": "^2.3.0",
"jest-websocket-mock": "^2.4.0",
"mock-socket": "^9.1.5",
"prettier": "^2.7.1",
"rollup-plugin-typescript2": "0.32.1",
"tweetnacl": "^1.0.3",
"typescript": "^4.7.4",
"unbuild": "^0.7.6"
"unbuild": "^0.8.4"
},
"engines": {
"node": ">=16.9.0"

View File

@@ -47,12 +47,12 @@
},
"homepage": "https://discord.js.org",
"dependencies": {
"@microsoft/api-extractor-model": "^7.22.1",
"@microsoft/api-extractor-model": "^7.23.0",
"@microsoft/tsdoc": "0.14.1",
"@microsoft/tsdoc-config": "0.16.1",
"@vscode/codicons": "^0.0.31",
"framer-motion": "^6.5.1",
"next": "^12.2.3",
"@vscode/codicons": "^0.0.32",
"framer-motion": "^7.0.1",
"next": "^12.2.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^4.4.0",
@@ -61,26 +61,26 @@
},
"devDependencies": {
"@testing-library/cypress": "^8.0.3",
"@testing-library/dom": "^8.16.0",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/dom": "^8.17.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^14.3.0",
"@types/node": "^16.11.46",
"@testing-library/user-event": "^14.4.3",
"@types/node": "^16.11.47",
"@types/react-dom": "^18.0.6",
"@types/react-syntax-highlighter": "^15.5.4",
"@typescript-eslint/eslint-plugin": "^5.31.0",
"@typescript-eslint/parser": "^5.31.0",
"@unocss/cli": "^0.44.7",
"@unocss/preset-web-fonts": "^0.44.7",
"@unocss/reset": "^0.44.7",
"@typescript-eslint/eslint-plugin": "^5.33.0",
"@typescript-eslint/parser": "^5.33.0",
"@unocss/cli": "^0.45.5",
"@unocss/preset-web-fonts": "^0.45.5",
"@unocss/reset": "^0.45.5",
"@vitejs/plugin-react": "^2.0.0",
"c8": "^7.12.0",
"concurrently": "^7.3.0",
"cypress": "^10.3.1",
"eslint": "^8.20.0",
"cypress": "^10.4.0",
"eslint": "^8.21.0",
"eslint-config-marine": "^9.4.1",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-typescript": "^3.3.0",
"eslint-import-resolver-typescript": "^3.4.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
@@ -88,9 +88,9 @@
"msw": "^0.44.2",
"prettier": "^2.7.1",
"typescript": "^4.7.4",
"unocss": "^0.44.7",
"vercel": "^27.3.1",
"vitest": "^0.19.1"
"unocss": "^0.45.5",
"vercel": "^27.4.0",
"vitest": "^0.21.1"
},
"engines": {
"node": ">=16.9.0"

View File

@@ -54,7 +54,7 @@
"dependencies": {
"@discordjs/collection": "workspace:^",
"@discordjs/rest": "workspace:^",
"@sapphire/async-queue": "^1.3.2",
"@sapphire/async-queue": "^1.4.0",
"@types/ws": "^8.5.3",
"@vladfrangu/async_event_emitter": "^2.0.1",
"discord-api-types": "^0.36.3",
@@ -63,18 +63,18 @@
},
"devDependencies": {
"@discordjs/docgen": "workspace:^",
"@favware/cliff-jumper": "^1.8.5",
"@microsoft/api-extractor": "^7.28.6",
"@types/node": "^16.11.46",
"@favware/cliff-jumper": "^1.8.6",
"@microsoft/api-extractor": "^7.29.2",
"@types/node": "^16.11.47",
"c8": "^7.12.0",
"eslint": "^8.20.0",
"eslint": "^8.21.0",
"mock-socket": "^9.1.5",
"prettier": "^2.7.1",
"rollup-plugin-typescript2": "0.32.1",
"typescript": "^4.7.4",
"unbuild": "^0.7.6",
"undici": "^5.8.0",
"vitest": "^0.19.1",
"unbuild": "^0.8.4",
"undici": "^5.8.2",
"vitest": "^0.21.1",
"zlib-sync": "^0.1.7"
},
"engines": {

View File

@@ -455,22 +455,18 @@ export class WebSocketShard extends AsyncEventEmitter<WebSocketShardEventsMap> {
}
private onError(err: Error) {
this.emit('error', { err });
this.emit('error', err);
}
private async onClose(code: number) {
switch (code) {
case CloseCodes.Normal: {
this.debug([`Disconnected normally from code ${code}`]);
if (this.status === WebSocketShardStatus.Ready) {
return this.destroy({
code,
reason: 'Got disconnected by Discord',
recover: WebSocketShardDestroyRecovery.Reconnect,
});
}
break;
return this.destroy({
code,
reason: 'Got disconnected by Discord',
recover: WebSocketShardDestroyRecovery.Reconnect,
});
}
case CloseCodes.Resuming: {

2065
yarn.lock

File diff suppressed because it is too large Load Diff