discord.js 15.0.0-dev.1761523318-4c0d66777 → 15.0.0-move-client-init.1761650119-a4c0a246f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -9
- package/src/client/Client.js +3 -10
- package/src/client/websocket/handlers/READY.js +4 -0
- package/src/managers/CachedManager.js +5 -5
- package/src/structures/ApplicationCommand.js +5 -4
- package/src/structures/CommandInteraction.js +1 -1
- package/src/structures/ModalComponentResolver.js +0 -11
- package/src/structures/ModalSubmitInteraction.js +6 -23
- package/src/util/Components.js +1 -9
- package/src/util/GuildMemberFlagsBitField.js +1 -1
- package/src/util/Options.js +5 -9
- package/typings/index.d.mts +10 -35
- package/typings/index.d.ts +10 -35
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "discord.js",
|
|
4
|
-
"version": "15.0.0-
|
|
4
|
+
"version": "15.0.0-move-client-init.1761650119-a4c0a246f",
|
|
5
5
|
"description": "A powerful library for interacting with the Discord API",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"types": "./typings/index.d.ts",
|
|
@@ -61,12 +61,12 @@
|
|
|
61
61
|
"magic-bytes.js": "^1.12.1",
|
|
62
62
|
"tslib": "^2.8.1",
|
|
63
63
|
"undici": "7.16.0",
|
|
64
|
-
"@discordjs/builders": "^2.0.0-
|
|
65
|
-
"@discordjs/collection": "^3.0.0-
|
|
66
|
-
"@discordjs/formatters": "^1.0.0-
|
|
67
|
-
"@discordjs/rest": "^3.0.0-
|
|
68
|
-
"@discordjs/
|
|
69
|
-
"@discordjs/
|
|
64
|
+
"@discordjs/builders": "^2.0.0-move-client-init.1761650119-a4c0a246f",
|
|
65
|
+
"@discordjs/collection": "^3.0.0-move-client-init.1761650119-a4c0a246f",
|
|
66
|
+
"@discordjs/formatters": "^1.0.0-move-client-init.1761650119-a4c0a246f",
|
|
67
|
+
"@discordjs/rest": "^3.0.0-move-client-init.1761650119-a4c0a246f",
|
|
68
|
+
"@discordjs/util": "^2.0.0-move-client-init.1761650119-a4c0a246f",
|
|
69
|
+
"@discordjs/ws": "^3.0.0-move-client-init.1761650119-a4c0a246f"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@favware/cliff-jumper": "^4.1.0",
|
|
@@ -82,9 +82,9 @@
|
|
|
82
82
|
"tsd": "^0.33.0",
|
|
83
83
|
"turbo": "^2.5.8",
|
|
84
84
|
"typescript": "~5.9.3",
|
|
85
|
-
"@discordjs/scripts": "^0.1.0",
|
|
86
85
|
"@discordjs/api-extractor": "^7.52.7",
|
|
87
|
-
"@discordjs/docgen": "^0.12.1"
|
|
86
|
+
"@discordjs/docgen": "^0.12.1",
|
|
87
|
+
"@discordjs/scripts": "^0.1.0"
|
|
88
88
|
},
|
|
89
89
|
"engines": {
|
|
90
90
|
"node": ">=22.12.0"
|
package/src/client/Client.js
CHANGED
|
@@ -346,15 +346,6 @@ class Client extends BaseClient {
|
|
|
346
346
|
);
|
|
347
347
|
this.ws.on(WebSocketShardEvents.Dispatch, this._handlePacket.bind(this));
|
|
348
348
|
|
|
349
|
-
this.ws.on(WebSocketShardEvents.Ready, async data => {
|
|
350
|
-
for (const guild of data.guilds) {
|
|
351
|
-
this.expectedGuilds.add(guild.id);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
this.status = Status.WaitingForGuilds;
|
|
355
|
-
await this._checkReady();
|
|
356
|
-
});
|
|
357
|
-
|
|
358
349
|
this.ws.on(WebSocketShardEvents.HeartbeatComplete, ({ heartbeatAt, latency }, shardId) => {
|
|
359
350
|
this.emit(Events.Debug, `[WS => Shard ${shardId}] Heartbeat acknowledged, latency of ${latency}ms.`);
|
|
360
351
|
this.lastPingTimestamps.set(shardId, heartbeatAt);
|
|
@@ -384,7 +375,9 @@ class Client extends BaseClient {
|
|
|
384
375
|
PacketHandlers[packet.t](this, packet, shardId);
|
|
385
376
|
}
|
|
386
377
|
|
|
387
|
-
if (
|
|
378
|
+
if (packet.t === GatewayDispatchEvents.Ready) {
|
|
379
|
+
await this._checkReady();
|
|
380
|
+
} else if (this.status === Status.WaitingForGuilds && WaitingForGuildEvents.includes(packet.t)) {
|
|
388
381
|
this.expectedGuilds.delete(packet.d.id);
|
|
389
382
|
await this._checkReady();
|
|
390
383
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const { ClientApplication } = require('../../../structures/ClientApplication.js');
|
|
4
|
+
const { Status } = require('../../../util/Status.js');
|
|
4
5
|
|
|
5
6
|
let ClientUser;
|
|
6
7
|
|
|
@@ -14,6 +15,7 @@ module.exports = (client, { d: data }, shardId) => {
|
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
for (const guild of data.guilds) {
|
|
18
|
+
client.expectedGuilds.add(guild.id);
|
|
17
19
|
guild.shardId = shardId;
|
|
18
20
|
client.guilds._add(guild);
|
|
19
21
|
}
|
|
@@ -23,4 +25,6 @@ module.exports = (client, { d: data }, shardId) => {
|
|
|
23
25
|
} else {
|
|
24
26
|
client.application = new ClientApplication(client, data.application);
|
|
25
27
|
}
|
|
28
|
+
|
|
29
|
+
client.status = Status.WaitingForGuilds;
|
|
26
30
|
};
|
|
@@ -22,11 +22,11 @@ class CachedManager extends DataManager {
|
|
|
22
22
|
* @name CachedManager#_cache
|
|
23
23
|
*/
|
|
24
24
|
Object.defineProperty(this, '_cache', {
|
|
25
|
-
value: this.client.options.makeCache(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
value: this.client.options.makeCache(
|
|
26
|
+
this.constructor[MakeCacheOverrideSymbol] ?? this.constructor,
|
|
27
|
+
this.holds,
|
|
28
|
+
this.constructor,
|
|
29
|
+
),
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
if (iterable) {
|
|
@@ -136,11 +136,11 @@ class ApplicationCommand extends Base {
|
|
|
136
136
|
/**
|
|
137
137
|
* The options of this command
|
|
138
138
|
*
|
|
139
|
-
* @type {
|
|
139
|
+
* @type {ApplicationCommandOption[]}
|
|
140
140
|
*/
|
|
141
141
|
this.options = data.options.map(option => this.constructor.transformOption(option, true));
|
|
142
142
|
} else {
|
|
143
|
-
this.options ??=
|
|
143
|
+
this.options ??= [];
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
if ('default_member_permissions' in data) {
|
|
@@ -436,7 +436,9 @@ class ApplicationCommand extends Base {
|
|
|
436
436
|
('version' in command && command.version !== this.version) ||
|
|
437
437
|
(command.type && command.type !== this.type) ||
|
|
438
438
|
('nsfw' in command && command.nsfw !== this.nsfw) ||
|
|
439
|
-
|
|
439
|
+
// Future proof for options being nullable
|
|
440
|
+
// TODO: remove ?? 0 on each when nullable
|
|
441
|
+
(command.options?.length ?? 0) !== (this.options?.length ?? 0) ||
|
|
440
442
|
defaultMemberPermissions !== (this.defaultMemberPermissions?.bitfield ?? null) ||
|
|
441
443
|
!isEqual(command.nameLocalizations ?? command.name_localizations ?? {}, this.nameLocalizations ?? {}) ||
|
|
442
444
|
!isEqual(
|
|
@@ -450,7 +452,6 @@ class ApplicationCommand extends Base {
|
|
|
450
452
|
return false;
|
|
451
453
|
}
|
|
452
454
|
|
|
453
|
-
// Don't need to check both because we already checked the lengths above
|
|
454
455
|
if (command.options) {
|
|
455
456
|
return this.constructor.optionsEqual(this.options, command.options, enforceOptionOrder);
|
|
456
457
|
}
|
|
@@ -96,7 +96,6 @@ class CommandInteraction extends BaseInteraction {
|
|
|
96
96
|
* @property {Collection<Snowflake, GuildMember|APIGuildMember>} [members] The resolved guild members
|
|
97
97
|
* @property {Collection<Snowflake, Role|APIRole>} [roles] The resolved roles
|
|
98
98
|
* @property {Collection<Snowflake, BaseChannel|APIChannel>} [channels] The resolved channels
|
|
99
|
-
* @property {Collection<Snowflake, Attachment>} [attachments] The resolved attachments
|
|
100
99
|
*/
|
|
101
100
|
|
|
102
101
|
/**
|
|
@@ -104,6 +103,7 @@ class CommandInteraction extends BaseInteraction {
|
|
|
104
103
|
*
|
|
105
104
|
* @typedef {BaseInteractionResolvedData} CommandInteractionResolvedData
|
|
106
105
|
* @property {Collection<Snowflake, Message|APIMessage>} [messages] The resolved messages
|
|
106
|
+
* @property {Collection<Snowflake, Attachment>} [attachments] The resolved attachments
|
|
107
107
|
*/
|
|
108
108
|
|
|
109
109
|
/**
|
|
@@ -222,17 +222,6 @@ class ModalComponentResolver {
|
|
|
222
222
|
|
|
223
223
|
return null;
|
|
224
224
|
}
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Gets file upload component
|
|
228
|
-
*
|
|
229
|
-
* @param {string} customId The custom id of the component
|
|
230
|
-
* @param {boolean} [required=false] Whether to throw an error if the component value is not found or empty
|
|
231
|
-
* @returns {?Collection<Snowflake, Attachment>} The uploaded files, or null if none were uploaded and not required
|
|
232
|
-
*/
|
|
233
|
-
getUploadedFiles(customId, required = false) {
|
|
234
|
-
return this._getTypedComponent(customId, [ComponentType.FileUpload], ['attachments'], required).attachments ?? null;
|
|
235
|
-
}
|
|
236
225
|
}
|
|
237
226
|
|
|
238
227
|
exports.ModalComponentResolver = ModalComponentResolver;
|
|
@@ -9,7 +9,6 @@ const { ModalComponentResolver } = require('./ModalComponentResolver.js');
|
|
|
9
9
|
const { InteractionResponses } = require('./interfaces/InteractionResponses.js');
|
|
10
10
|
|
|
11
11
|
const getMessage = lazy(() => require('./Message.js').Message);
|
|
12
|
-
const getAttachment = lazy(() => require('./Attachment.js').Attachment);
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* @typedef {Object} BaseModalData
|
|
@@ -21,17 +20,10 @@ const getAttachment = lazy(() => require('./Attachment.js').Attachment);
|
|
|
21
20
|
* @typedef {BaseModalData} SelectMenuModalData
|
|
22
21
|
* @property {string} customId The custom id of the component
|
|
23
22
|
* @property {string[]} values The values of the component
|
|
24
|
-
* @property {Collection<
|
|
25
|
-
* @property {Collection<
|
|
26
|
-
* @property {Collection<
|
|
27
|
-
* @property {Collection<
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @typedef {BaseModalData} FileUploadModalData
|
|
32
|
-
* @property {string} customId The custom id of the file upload
|
|
33
|
-
* @property {Snowflake[]} values The values of the file upload
|
|
34
|
-
* @property {Collection<Snowflake, Attachment>} [attachments] The resolved attachments
|
|
23
|
+
* @property {Collection<string, GuildMember|APIGuildMember>} [members] The resolved members
|
|
24
|
+
* @property {Collection<string, User|APIUser>} [users] The resolved users
|
|
25
|
+
* @property {Collection<string, Role|APIRole>} [roles] The resolved roles
|
|
26
|
+
* @property {Collection<string, BaseChannel|APIChannel>} [channels] The resolved channels
|
|
35
27
|
*/
|
|
36
28
|
|
|
37
29
|
/**
|
|
@@ -45,7 +37,7 @@ const getAttachment = lazy(() => require('./Attachment.js').Attachment);
|
|
|
45
37
|
*/
|
|
46
38
|
|
|
47
39
|
/**
|
|
48
|
-
* @typedef {SelectMenuModalData|TextInputModalData
|
|
40
|
+
* @typedef {SelectMenuModalData|TextInputModalData} ModalData
|
|
49
41
|
*/
|
|
50
42
|
|
|
51
43
|
/**
|
|
@@ -163,7 +155,7 @@ class ModalSubmitInteraction extends BaseInteraction {
|
|
|
163
155
|
if (rawComponent.values) {
|
|
164
156
|
data.values = rawComponent.values;
|
|
165
157
|
if (resolved) {
|
|
166
|
-
const { members, users, channels, roles
|
|
158
|
+
const { members, users, channels, roles } = resolved;
|
|
167
159
|
const valueSet = new Set(rawComponent.values);
|
|
168
160
|
|
|
169
161
|
if (users) {
|
|
@@ -206,15 +198,6 @@ class ModalSubmitInteraction extends BaseInteraction {
|
|
|
206
198
|
}
|
|
207
199
|
}
|
|
208
200
|
}
|
|
209
|
-
|
|
210
|
-
if (attachments) {
|
|
211
|
-
data.attachments = new Collection();
|
|
212
|
-
for (const [id, attachment] of Object.entries(attachments)) {
|
|
213
|
-
if (valueSet.has(id)) {
|
|
214
|
-
data.attachments.set(id, new (getAttachment())(attachment));
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
201
|
}
|
|
219
202
|
}
|
|
220
203
|
|
package/src/util/Components.js
CHANGED
|
@@ -24,7 +24,7 @@ const { ComponentType } = require('discord-api-types/v10');
|
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* @typedef {StringSelectMenuComponentData|TextInputComponentData|UserSelectMenuComponentData|
|
|
27
|
-
* RoleSelectMenuComponentData|MentionableSelectMenuComponentData|ChannelSelectMenuComponentData
|
|
27
|
+
* RoleSelectMenuComponentData|MentionableSelectMenuComponentData|ChannelSelectMenuComponentData} ComponentInLabelData
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
/**
|
|
@@ -44,14 +44,6 @@ const { ComponentType } = require('discord-api-types/v10');
|
|
|
44
44
|
* @property {string} [url] The URL of the button
|
|
45
45
|
*/
|
|
46
46
|
|
|
47
|
-
/**
|
|
48
|
-
* @typedef {BaseComponentData} FileUploadComponentData
|
|
49
|
-
* @property {string} customId The custom id of the file upload
|
|
50
|
-
* @property {number} [minValues] The minimum number of files that can be uploaded (0-10)
|
|
51
|
-
* @property {number} [maxValues] The maximum number of files that can be uploaded (1-10)
|
|
52
|
-
* @property {boolean} [required] Whether this component is required in modals
|
|
53
|
-
*/
|
|
54
|
-
|
|
55
47
|
/**
|
|
56
48
|
* @typedef {BaseComponentData} BaseSelectMenuComponentData
|
|
57
49
|
* @property {string} customId The custom id of the select menu
|
package/src/util/Options.js
CHANGED
|
@@ -5,16 +5,12 @@ const { DefaultWebSocketManagerOptions } = require('@discordjs/ws');
|
|
|
5
5
|
const { version } = require('../../package.json');
|
|
6
6
|
const { toSnakeCase } = require('./Transformers.js');
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
* @typedef {Object} CacheFactoryParams
|
|
10
|
-
* @property {Function} holds The class that the cache will hold.
|
|
11
|
-
* @property {Function} manager The fully extended manager class the cache is being requested from.
|
|
12
|
-
* @property {Function} managerType The base manager class the cache is being requested from.
|
|
13
|
-
*/
|
|
14
|
-
|
|
8
|
+
// TODO(ckohen): switch order of params so full manager is first and "type" is optional
|
|
15
9
|
/**
|
|
16
10
|
* @typedef {Function} CacheFactory
|
|
17
|
-
* @param {
|
|
11
|
+
* @param {Function} managerType The base manager class the cache is being requested from.
|
|
12
|
+
* @param {Function} holds The class that the cache will hold.
|
|
13
|
+
* @param {Function} manager The fully extended manager class the cache is being requested from.
|
|
18
14
|
* @returns {Collection} A Collection used to store the cache of the manager.
|
|
19
15
|
*/
|
|
20
16
|
|
|
@@ -125,7 +121,7 @@ class Options extends null {
|
|
|
125
121
|
const { Collection } = require('@discordjs/collection');
|
|
126
122
|
const { LimitedCollection } = require('./LimitedCollection.js');
|
|
127
123
|
|
|
128
|
-
return (
|
|
124
|
+
return (managerType, _, manager) => {
|
|
129
125
|
const setting = settings[manager.name] ?? settings[managerType.name];
|
|
130
126
|
/* eslint-disable-next-line eqeqeq */
|
|
131
127
|
if (setting == null) {
|
package/typings/index.d.mts
CHANGED
|
@@ -66,6 +66,7 @@ import {
|
|
|
66
66
|
APIMessageTopLevelComponent,
|
|
67
67
|
APIMessageUserSelectInteractionData,
|
|
68
68
|
APIModalComponent,
|
|
69
|
+
APIModalInteractionResponseCallbackComponent,
|
|
69
70
|
APIModalInteractionResponseCallbackData,
|
|
70
71
|
APIModalSubmitInteraction,
|
|
71
72
|
APIOverwrite,
|
|
@@ -273,13 +274,11 @@ export interface ActionRowData<ComponentType extends ActionRowComponentData | JS
|
|
|
273
274
|
|
|
274
275
|
export type ComponentInLabelData =
|
|
275
276
|
| ChannelSelectMenuComponentData
|
|
276
|
-
| FileUploadComponentData
|
|
277
277
|
| MentionableSelectMenuComponentData
|
|
278
278
|
| RoleSelectMenuComponentData
|
|
279
279
|
| StringSelectMenuComponentData
|
|
280
280
|
| TextInputComponentData
|
|
281
281
|
| UserSelectMenuComponentData;
|
|
282
|
-
|
|
283
282
|
export interface LabelData extends BaseComponentData {
|
|
284
283
|
component: ComponentInLabelData;
|
|
285
284
|
description?: string;
|
|
@@ -418,7 +417,7 @@ export class ApplicationCommand<PermissionsFetchType = {}> extends Base {
|
|
|
418
417
|
public name: string;
|
|
419
418
|
public nameLocalizations: LocalizationMap | null;
|
|
420
419
|
public nameLocalized: string | null;
|
|
421
|
-
public options: (ApplicationCommandOption & { descriptionLocalized?: string; nameLocalized?: string })[]
|
|
420
|
+
public options: (ApplicationCommandOption & { descriptionLocalized?: string; nameLocalized?: string })[];
|
|
422
421
|
public permissions: ApplicationCommandPermissionsManager<
|
|
423
422
|
PermissionsFetchType,
|
|
424
423
|
PermissionsFetchType,
|
|
@@ -2581,16 +2580,10 @@ export interface SelectMenuModalData<Cached extends CacheType = CacheType>
|
|
|
2581
2580
|
values: readonly string[];
|
|
2582
2581
|
}
|
|
2583
2582
|
|
|
2584
|
-
export
|
|
2585
|
-
attachments: ReadonlyCollection<Snowflake, Attachment>;
|
|
2586
|
-
customId: string;
|
|
2587
|
-
values: readonly Snowflake[];
|
|
2588
|
-
}
|
|
2589
|
-
|
|
2590
|
-
export type ModalData = FileUploadModalData | SelectMenuModalData | TextInputModalData;
|
|
2583
|
+
export type ModalData = SelectMenuModalData | TextInputModalData;
|
|
2591
2584
|
|
|
2592
2585
|
export interface LabelModalData extends BaseModalData<ComponentType.Label> {
|
|
2593
|
-
component: ModalData;
|
|
2586
|
+
component: readonly ModalData[];
|
|
2594
2587
|
}
|
|
2595
2588
|
export interface ActionRowModalData extends BaseModalData<ComponentType.ActionRow> {
|
|
2596
2589
|
components: readonly TextInputModalData[];
|
|
@@ -2660,8 +2653,6 @@ export class ModalComponentResolver<Cached extends CacheType = CacheType> {
|
|
|
2660
2653
|
|
|
2661
2654
|
public getSelectedMentionables(customId: string, required: true): ModalSelectedMentionables<Cached>;
|
|
2662
2655
|
public getSelectedMentionables(customId: string, required?: boolean): ModalSelectedMentionables<Cached> | null;
|
|
2663
|
-
public getUploadedFiles(customId: string, required: true): ReadonlyCollection<Snowflake, Attachment>;
|
|
2664
|
-
public getUploadedFiles(customId: string, required?: boolean): ReadonlyCollection<Snowflake, Attachment> | null;
|
|
2665
2656
|
}
|
|
2666
2657
|
|
|
2667
2658
|
export interface ModalMessageModalSubmitInteraction<Cached extends CacheType = CacheType>
|
|
@@ -5368,21 +5359,13 @@ export type OverriddenCaches =
|
|
|
5368
5359
|
| 'GuildMessageManager'
|
|
5369
5360
|
| 'GuildTextThreadManager';
|
|
5370
5361
|
|
|
5371
|
-
export interface CacheFactoryParams<Manager extends keyof Caches> {
|
|
5372
|
-
holds: Caches[Manager][1];
|
|
5373
|
-
manager: CacheConstructors[keyof Caches];
|
|
5374
|
-
managerType: CacheConstructors[Exclude<keyof Caches, OverriddenCaches>];
|
|
5375
|
-
}
|
|
5376
|
-
|
|
5377
5362
|
// This doesn't actually work the way it looks 😢.
|
|
5378
5363
|
// Narrowing the type of `manager.name` doesn't propagate type information to `holds` and the return type.
|
|
5379
|
-
export type CacheFactory = (
|
|
5380
|
-
|
|
5381
|
-
manager,
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
? Collection<Key, Value>
|
|
5385
|
-
: never;
|
|
5364
|
+
export type CacheFactory = (
|
|
5365
|
+
managerType: CacheConstructors[Exclude<keyof Caches, OverriddenCaches>],
|
|
5366
|
+
holds: Caches[(typeof manager)['name']][1],
|
|
5367
|
+
manager: CacheConstructors[keyof Caches],
|
|
5368
|
+
) => (typeof manager)['prototype'] extends DataManager<infer Key, infer Value, any> ? Collection<Key, Value> : never;
|
|
5386
5369
|
|
|
5387
5370
|
export type CacheWithLimitsOptions = {
|
|
5388
5371
|
[K in keyof Caches]?: Caches[K][0]['prototype'] extends DataManager<infer Key, infer Value, any>
|
|
@@ -5638,7 +5621,6 @@ export interface CommandInteractionOption<Cached extends CacheType = CacheType>
|
|
|
5638
5621
|
}
|
|
5639
5622
|
|
|
5640
5623
|
export interface BaseInteractionResolvedData<Cached extends CacheType = CacheType> {
|
|
5641
|
-
attachments?: ReadonlyCollection<Snowflake, Attachment>;
|
|
5642
5624
|
channels?: ReadonlyCollection<Snowflake, CacheTypeReducer<Cached, Channel, APIInteractionDataResolvedChannel>>;
|
|
5643
5625
|
members?: ReadonlyCollection<Snowflake, CacheTypeReducer<Cached, GuildMember, APIInteractionDataResolvedGuildMember>>;
|
|
5644
5626
|
roles?: ReadonlyCollection<Snowflake, CacheTypeReducer<Cached, Role, APIRole>>;
|
|
@@ -5647,6 +5629,7 @@ export interface BaseInteractionResolvedData<Cached extends CacheType = CacheTyp
|
|
|
5647
5629
|
|
|
5648
5630
|
export interface CommandInteractionResolvedData<Cached extends CacheType = CacheType>
|
|
5649
5631
|
extends BaseInteractionResolvedData<Cached> {
|
|
5632
|
+
attachments?: ReadonlyCollection<Snowflake, Attachment>;
|
|
5650
5633
|
messages?: ReadonlyCollection<Snowflake, CacheTypeReducer<Cached, Message, APIMessage>>;
|
|
5651
5634
|
}
|
|
5652
5635
|
|
|
@@ -6855,14 +6838,6 @@ export interface TextInputComponentData extends BaseComponentData {
|
|
|
6855
6838
|
value?: string;
|
|
6856
6839
|
}
|
|
6857
6840
|
|
|
6858
|
-
export interface FileUploadComponentData extends BaseComponentData {
|
|
6859
|
-
customId: string;
|
|
6860
|
-
maxValues?: number;
|
|
6861
|
-
minValues?: number;
|
|
6862
|
-
required?: boolean;
|
|
6863
|
-
type: ComponentType.FileUpload;
|
|
6864
|
-
}
|
|
6865
|
-
|
|
6866
6841
|
export type MessageTarget =
|
|
6867
6842
|
| ChannelManager
|
|
6868
6843
|
| Interaction
|
package/typings/index.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ import {
|
|
|
66
66
|
APIMessageTopLevelComponent,
|
|
67
67
|
APIMessageUserSelectInteractionData,
|
|
68
68
|
APIModalComponent,
|
|
69
|
+
APIModalInteractionResponseCallbackComponent,
|
|
69
70
|
APIModalInteractionResponseCallbackData,
|
|
70
71
|
APIModalSubmitInteraction,
|
|
71
72
|
APIOverwrite,
|
|
@@ -273,13 +274,11 @@ export interface ActionRowData<ComponentType extends ActionRowComponentData | JS
|
|
|
273
274
|
|
|
274
275
|
export type ComponentInLabelData =
|
|
275
276
|
| ChannelSelectMenuComponentData
|
|
276
|
-
| FileUploadComponentData
|
|
277
277
|
| MentionableSelectMenuComponentData
|
|
278
278
|
| RoleSelectMenuComponentData
|
|
279
279
|
| StringSelectMenuComponentData
|
|
280
280
|
| TextInputComponentData
|
|
281
281
|
| UserSelectMenuComponentData;
|
|
282
|
-
|
|
283
282
|
export interface LabelData extends BaseComponentData {
|
|
284
283
|
component: ComponentInLabelData;
|
|
285
284
|
description?: string;
|
|
@@ -418,7 +417,7 @@ export class ApplicationCommand<PermissionsFetchType = {}> extends Base {
|
|
|
418
417
|
public name: string;
|
|
419
418
|
public nameLocalizations: LocalizationMap | null;
|
|
420
419
|
public nameLocalized: string | null;
|
|
421
|
-
public options: (ApplicationCommandOption & { descriptionLocalized?: string; nameLocalized?: string })[]
|
|
420
|
+
public options: (ApplicationCommandOption & { descriptionLocalized?: string; nameLocalized?: string })[];
|
|
422
421
|
public permissions: ApplicationCommandPermissionsManager<
|
|
423
422
|
PermissionsFetchType,
|
|
424
423
|
PermissionsFetchType,
|
|
@@ -2581,16 +2580,10 @@ export interface SelectMenuModalData<Cached extends CacheType = CacheType>
|
|
|
2581
2580
|
values: readonly string[];
|
|
2582
2581
|
}
|
|
2583
2582
|
|
|
2584
|
-
export
|
|
2585
|
-
attachments: ReadonlyCollection<Snowflake, Attachment>;
|
|
2586
|
-
customId: string;
|
|
2587
|
-
values: readonly Snowflake[];
|
|
2588
|
-
}
|
|
2589
|
-
|
|
2590
|
-
export type ModalData = FileUploadModalData | SelectMenuModalData | TextInputModalData;
|
|
2583
|
+
export type ModalData = SelectMenuModalData | TextInputModalData;
|
|
2591
2584
|
|
|
2592
2585
|
export interface LabelModalData extends BaseModalData<ComponentType.Label> {
|
|
2593
|
-
component: ModalData;
|
|
2586
|
+
component: readonly ModalData[];
|
|
2594
2587
|
}
|
|
2595
2588
|
export interface ActionRowModalData extends BaseModalData<ComponentType.ActionRow> {
|
|
2596
2589
|
components: readonly TextInputModalData[];
|
|
@@ -2660,8 +2653,6 @@ export class ModalComponentResolver<Cached extends CacheType = CacheType> {
|
|
|
2660
2653
|
|
|
2661
2654
|
public getSelectedMentionables(customId: string, required: true): ModalSelectedMentionables<Cached>;
|
|
2662
2655
|
public getSelectedMentionables(customId: string, required?: boolean): ModalSelectedMentionables<Cached> | null;
|
|
2663
|
-
public getUploadedFiles(customId: string, required: true): ReadonlyCollection<Snowflake, Attachment>;
|
|
2664
|
-
public getUploadedFiles(customId: string, required?: boolean): ReadonlyCollection<Snowflake, Attachment> | null;
|
|
2665
2656
|
}
|
|
2666
2657
|
|
|
2667
2658
|
export interface ModalMessageModalSubmitInteraction<Cached extends CacheType = CacheType>
|
|
@@ -5368,21 +5359,13 @@ export type OverriddenCaches =
|
|
|
5368
5359
|
| 'GuildMessageManager'
|
|
5369
5360
|
| 'GuildTextThreadManager';
|
|
5370
5361
|
|
|
5371
|
-
export interface CacheFactoryParams<Manager extends keyof Caches> {
|
|
5372
|
-
holds: Caches[Manager][1];
|
|
5373
|
-
manager: CacheConstructors[keyof Caches];
|
|
5374
|
-
managerType: CacheConstructors[Exclude<keyof Caches, OverriddenCaches>];
|
|
5375
|
-
}
|
|
5376
|
-
|
|
5377
5362
|
// This doesn't actually work the way it looks 😢.
|
|
5378
5363
|
// Narrowing the type of `manager.name` doesn't propagate type information to `holds` and the return type.
|
|
5379
|
-
export type CacheFactory = (
|
|
5380
|
-
|
|
5381
|
-
manager,
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
? Collection<Key, Value>
|
|
5385
|
-
: never;
|
|
5364
|
+
export type CacheFactory = (
|
|
5365
|
+
managerType: CacheConstructors[Exclude<keyof Caches, OverriddenCaches>],
|
|
5366
|
+
holds: Caches[(typeof manager)['name']][1],
|
|
5367
|
+
manager: CacheConstructors[keyof Caches],
|
|
5368
|
+
) => (typeof manager)['prototype'] extends DataManager<infer Key, infer Value, any> ? Collection<Key, Value> : never;
|
|
5386
5369
|
|
|
5387
5370
|
export type CacheWithLimitsOptions = {
|
|
5388
5371
|
[K in keyof Caches]?: Caches[K][0]['prototype'] extends DataManager<infer Key, infer Value, any>
|
|
@@ -5638,7 +5621,6 @@ export interface CommandInteractionOption<Cached extends CacheType = CacheType>
|
|
|
5638
5621
|
}
|
|
5639
5622
|
|
|
5640
5623
|
export interface BaseInteractionResolvedData<Cached extends CacheType = CacheType> {
|
|
5641
|
-
attachments?: ReadonlyCollection<Snowflake, Attachment>;
|
|
5642
5624
|
channels?: ReadonlyCollection<Snowflake, CacheTypeReducer<Cached, Channel, APIInteractionDataResolvedChannel>>;
|
|
5643
5625
|
members?: ReadonlyCollection<Snowflake, CacheTypeReducer<Cached, GuildMember, APIInteractionDataResolvedGuildMember>>;
|
|
5644
5626
|
roles?: ReadonlyCollection<Snowflake, CacheTypeReducer<Cached, Role, APIRole>>;
|
|
@@ -5647,6 +5629,7 @@ export interface BaseInteractionResolvedData<Cached extends CacheType = CacheTyp
|
|
|
5647
5629
|
|
|
5648
5630
|
export interface CommandInteractionResolvedData<Cached extends CacheType = CacheType>
|
|
5649
5631
|
extends BaseInteractionResolvedData<Cached> {
|
|
5632
|
+
attachments?: ReadonlyCollection<Snowflake, Attachment>;
|
|
5650
5633
|
messages?: ReadonlyCollection<Snowflake, CacheTypeReducer<Cached, Message, APIMessage>>;
|
|
5651
5634
|
}
|
|
5652
5635
|
|
|
@@ -6855,14 +6838,6 @@ export interface TextInputComponentData extends BaseComponentData {
|
|
|
6855
6838
|
value?: string;
|
|
6856
6839
|
}
|
|
6857
6840
|
|
|
6858
|
-
export interface FileUploadComponentData extends BaseComponentData {
|
|
6859
|
-
customId: string;
|
|
6860
|
-
maxValues?: number;
|
|
6861
|
-
minValues?: number;
|
|
6862
|
-
required?: boolean;
|
|
6863
|
-
type: ComponentType.FileUpload;
|
|
6864
|
-
}
|
|
6865
|
-
|
|
6866
6841
|
export type MessageTarget =
|
|
6867
6842
|
| ChannelManager
|
|
6868
6843
|
| Interaction
|