seyfert 1.1.0 → 1.2.0
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/lib/api/Routes/applications.d.ts +2 -2
- package/lib/api/Routes/channels.d.ts +2 -2
- package/lib/api/Routes/gateway.d.ts +2 -2
- package/lib/api/Routes/guilds.d.ts +2 -1
- package/lib/api/Routes/interactions.d.ts +2 -2
- package/lib/api/Routes/invites.d.ts +2 -2
- package/lib/api/Routes/stage-instances.d.ts +2 -2
- package/lib/api/Routes/stickers.d.ts +2 -2
- package/lib/api/Routes/users.d.ts +2 -2
- package/lib/api/Routes/voice.d.ts +2 -2
- package/lib/api/Routes/webhooks.d.ts +2 -2
- package/lib/builders/ActionRow.d.ts +2 -1
- package/lib/builders/ActionRow.js +3 -3
- package/lib/builders/Base.d.ts +1 -1
- package/lib/builders/Button.d.ts +2 -1
- package/lib/builders/Button.js +2 -2
- package/lib/builders/Embed.d.ts +2 -1
- package/lib/builders/Modal.d.ts +9 -2
- package/lib/builders/Modal.js +12 -3
- package/lib/builders/SelectMenu.d.ts +18 -1
- package/lib/builders/SelectMenu.js +36 -12
- package/lib/builders/index.d.ts +1 -1
- package/lib/builders/index.js +9 -9
- package/lib/builders/types.d.ts +1 -1
- package/lib/cache/adapters/types.d.ts +23 -23
- package/lib/cache/index.d.ts +5 -5
- package/lib/cache/index.js +3 -3
- package/lib/cache/resources/default/base.d.ts +10 -10
- package/lib/cache/resources/default/guild-based.d.ts +7 -7
- package/lib/cache/resources/default/guild-based.js +2 -1
- package/lib/cache/resources/default/guild-related.d.ts +9 -9
- package/lib/cache/resources/default/guild-related.js +2 -1
- package/lib/cache/resources/presence.d.ts +1 -1
- package/lib/cache/resources/stage-instances.d.ts +1 -1
- package/lib/cache/resources/voice-states.d.ts +1 -1
- package/lib/client/base.d.ts +19 -12
- package/lib/client/base.js +45 -7
- package/lib/client/client.d.ts +7 -4
- package/lib/client/client.js +21 -9
- package/lib/client/httpclient.d.ts +2 -1
- package/lib/client/httpclient.js +3 -3
- package/lib/client/oninteractioncreate.js +18 -19
- package/lib/client/onmessagecreate.js +6 -4
- package/lib/client/workerclient.d.ts +11 -5
- package/lib/client/workerclient.js +18 -11
- package/lib/commands/applications/chat.d.ts +4 -4
- package/lib/commands/applications/chat.js +17 -9
- package/lib/commands/applications/chatcontext.d.ts +7 -10
- package/lib/commands/applications/chatcontext.js +6 -17
- package/lib/commands/applications/menu.d.ts +2 -1
- package/lib/commands/applications/menu.js +7 -5
- package/lib/commands/applications/menucontext.d.ts +5 -9
- package/lib/commands/applications/menucontext.js +8 -21
- package/lib/commands/applications/shared.d.ts +5 -4
- package/lib/commands/basecontex.d.ts +15 -0
- package/lib/commands/basecontex.js +34 -0
- package/lib/commands/decorators.d.ts +3 -2
- package/lib/commands/decorators.js +5 -5
- package/lib/commands/handler.d.ts +6 -0
- package/lib/commands/handler.js +10 -4
- package/lib/commands/optionresolver.d.ts +3 -3
- package/lib/commands/optionresolver.js +14 -14
- package/lib/common/index.d.ts +0 -1
- package/lib/common/index.js +0 -1
- package/lib/common/it/constants.d.ts +3 -1
- package/lib/common/it/constants.js +2 -0
- package/lib/common/it/utils.d.ts +1 -0
- package/lib/common/it/utils.js +2 -1
- package/lib/common/shorters/channels.d.ts +1 -1
- package/lib/common/shorters/channels.js +4 -4
- package/lib/common/shorters/guilds.d.ts +1 -1
- package/lib/common/shorters/guilds.js +6 -1
- package/lib/common/shorters/members.d.ts +6 -1
- package/lib/common/shorters/members.js +25 -2
- package/lib/common/shorters/messages.d.ts +1 -1
- package/lib/common/shorters/messages.js +1 -1
- package/lib/common/shorters/users.d.ts +0 -6
- package/lib/common/shorters/users.js +0 -34
- package/lib/common/shorters/webhook.d.ts +2 -2
- package/lib/common/types/resolvables.d.ts +2 -1
- package/lib/common/types/util.d.ts +4 -1
- package/lib/common/types/write.d.ts +1 -1
- package/lib/components/ActionRow.d.ts +4 -3
- package/lib/components/ActionRow.js +6 -3
- package/lib/components/BaseComponent.d.ts +18 -0
- package/lib/components/BaseComponent.js +21 -0
- package/lib/components/BaseSelectMenuComponent.d.ts +10 -0
- package/lib/components/BaseSelectMenuComponent.js +22 -0
- package/lib/components/ButtonComponent.d.ts +14 -14
- package/lib/components/ButtonComponent.js +36 -25
- package/lib/components/ChannelSelectMenuComponent.d.ts +4 -4
- package/lib/components/ChannelSelectMenuComponent.js +6 -5
- package/lib/components/MentionableSelectMenuComponent.d.ts +3 -2
- package/lib/components/MentionableSelectMenuComponent.js +4 -1
- package/lib/components/RoleSelectMenuComponent.d.ts +3 -2
- package/lib/components/RoleSelectMenuComponent.js +4 -1
- package/lib/components/StringSelectMenuComponent.d.ts +3 -4
- package/lib/components/StringSelectMenuComponent.js +3 -5
- package/lib/components/TextInputComponent.d.ts +10 -5
- package/lib/components/TextInputComponent.js +24 -7
- package/lib/components/UserSelectMenuComponent.d.ts +3 -2
- package/lib/components/UserSelectMenuComponent.js +4 -1
- package/lib/components/command.d.ts +6 -5
- package/lib/components/command.js +4 -0
- package/lib/components/componentcontext.d.ts +42 -0
- package/lib/components/componentcontext.js +79 -0
- package/lib/components/handler.d.ts +22 -6
- package/lib/components/handler.js +19 -12
- package/lib/components/index.d.ts +2 -2
- package/lib/components/index.js +9 -9
- package/lib/events/handler.d.ts +12 -3
- package/lib/events/handler.js +6 -8
- package/lib/events/hooks/application_command.d.ts +2 -2
- package/lib/events/hooks/auto_moderation.d.ts +4 -4
- package/lib/events/hooks/channel.d.ts +1 -1
- package/lib/events/hooks/dispatch.d.ts +1 -1
- package/lib/events/hooks/entitlement.d.ts +4 -4
- package/lib/events/hooks/guild.d.ts +42 -42
- package/lib/events/hooks/integration.d.ts +19 -19
- package/lib/events/hooks/interactions.d.ts +2 -2
- package/lib/events/hooks/invite.d.ts +5 -5
- package/lib/events/hooks/message.d.ts +6 -5
- package/lib/events/hooks/presence.d.ts +7 -7
- package/lib/events/hooks/stage.d.ts +4 -4
- package/lib/events/hooks/thread.d.ts +49 -49
- package/lib/events/hooks/typing.d.ts +2 -2
- package/lib/events/hooks/user.d.ts +1 -1
- package/lib/events/hooks/voice.d.ts +2 -2
- package/lib/events/hooks/webhook.d.ts +1 -1
- package/lib/index.d.ts +3 -6
- package/lib/index.js +6 -7
- package/lib/langs/handler.d.ts +10 -1
- package/lib/langs/handler.js +1 -0
- package/lib/structures/AutoModerationRule.d.ts +3 -2
- package/lib/structures/ClientUser.d.ts +1 -1
- package/lib/structures/Guild.d.ts +27 -27
- package/lib/structures/GuildEmoji.d.ts +2 -1
- package/lib/structures/GuildMember.d.ts +16 -6
- package/lib/structures/GuildMember.js +35 -6
- package/lib/structures/GuildPreview.d.ts +1 -1
- package/lib/structures/GuildRole.d.ts +2 -1
- package/lib/structures/GuildTemplate.d.ts +3 -2
- package/lib/structures/Interaction.d.ts +5 -5
- package/lib/structures/Interaction.js +34 -34
- package/lib/structures/Message.d.ts +6 -5
- package/lib/structures/Sticker.d.ts +2 -1
- package/lib/structures/User.d.ts +7 -3
- package/lib/structures/User.js +5 -0
- package/lib/structures/Webhook.d.ts +63 -4
- package/lib/structures/Webhook.js +53 -0
- package/lib/structures/channels.d.ts +4 -4
- package/lib/structures/extra/BaseGuild.d.ts +2 -1
- package/lib/structures/extra/BaseGuild.js +3 -3
- package/lib/structures/extra/BitField.d.ts +2 -2
- package/lib/structures/extra/BitField.js +2 -2
- package/lib/structures/extra/Permissions.d.ts +1 -1
- package/lib/structures/extra/functions.d.ts +2 -1
- package/lib/structures/extra/functions.js +2 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +17 -0
- package/lib/websocket/SharedTypes.d.ts +2 -1
- package/lib/websocket/SharedTypes.js +1 -0
- package/lib/websocket/discord/shard.d.ts +2 -1
- package/lib/websocket/discord/shard.js +30 -41
- package/lib/websocket/discord/sharder.d.ts +3 -2
- package/lib/websocket/discord/sharder.js +7 -6
- package/lib/websocket/discord/shared.d.ts +2 -1
- package/lib/websocket/discord/worker.d.ts +1 -1
- package/lib/websocket/discord/workermanager.d.ts +3 -2
- package/lib/websocket/discord/workermanager.js +1 -1
- package/package.json +2 -2
|
@@ -3,21 +3,22 @@
|
|
|
3
3
|
/// <reference types="node" />
|
|
4
4
|
/// <reference types="node" />
|
|
5
5
|
/// <reference types="node" />
|
|
6
|
+
import { type GatewayDispatchPayload } from 'discord-api-types/v10';
|
|
7
|
+
import { Logger } from '..';
|
|
6
8
|
import type { Cache } from '../cache';
|
|
7
|
-
import type
|
|
8
|
-
import {
|
|
9
|
-
import { EventHandler } from '../events';
|
|
9
|
+
import { type DeepPartial, type When } from '../common';
|
|
10
|
+
import { type EventHandlerLike } from '../events';
|
|
10
11
|
import { ClientUser } from '../structures';
|
|
11
12
|
import { Shard, type ShardManagerOptions } from '../websocket';
|
|
12
13
|
import type { WorkerShardInfo } from '../websocket/discord/worker';
|
|
13
14
|
import type { ManagerMessages } from '../websocket/discord/workermanager';
|
|
14
|
-
import type { BaseClientOptions, StartOptions } from './base';
|
|
15
|
+
import type { BaseClientOptions, ServicesOptions, StartOptions } from './base';
|
|
15
16
|
import { BaseClient } from './base';
|
|
16
17
|
import type { Client } from './client';
|
|
17
18
|
export declare class WorkerClient<Ready extends boolean = boolean> extends BaseClient {
|
|
18
19
|
private __handleGuilds?;
|
|
19
20
|
logger: Logger;
|
|
20
|
-
events
|
|
21
|
+
events?: EventHandlerLike;
|
|
21
22
|
me: When<Ready, ClientUser>;
|
|
22
23
|
promises: Map<string, {
|
|
23
24
|
resolve: (value: any) => void;
|
|
@@ -28,6 +29,11 @@ export declare class WorkerClient<Ready extends boolean = boolean> extends BaseC
|
|
|
28
29
|
constructor(options?: WorkerClientOptions);
|
|
29
30
|
get workerId(): number;
|
|
30
31
|
get latency(): number;
|
|
32
|
+
setServices({ ...rest }: ServicesOptions & {
|
|
33
|
+
handlers?: ServicesOptions['handlers'] & {
|
|
34
|
+
events?: EventHandlerLike;
|
|
35
|
+
};
|
|
36
|
+
}): void;
|
|
31
37
|
start(options?: Omit<DeepPartial<StartOptions>, 'httpConnection' | 'token' | 'connection'>): Promise<void>;
|
|
32
38
|
loadEvents(dir?: string): Promise<void>;
|
|
33
39
|
postMessage(body: any): boolean | void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateShardInfo = exports.WorkerClient = void 0;
|
|
4
|
+
const v10_1 = require("discord-api-types/v10");
|
|
4
5
|
const node_crypto_1 = require("node:crypto");
|
|
5
6
|
const node_worker_threads_1 = require("node:worker_threads");
|
|
6
7
|
const __1 = require("..");
|
|
@@ -27,7 +28,7 @@ try {
|
|
|
27
28
|
catch { }
|
|
28
29
|
class WorkerClient extends base_1.BaseClient {
|
|
29
30
|
__handleGuilds = new Set();
|
|
30
|
-
logger = new
|
|
31
|
+
logger = new __1.Logger({
|
|
31
32
|
name: `[Worker #${workerData.workerId}]`,
|
|
32
33
|
});
|
|
33
34
|
events = new events_1.EventHandler(this.logger);
|
|
@@ -51,7 +52,7 @@ class WorkerClient extends base_1.BaseClient {
|
|
|
51
52
|
},
|
|
52
53
|
});
|
|
53
54
|
if (workerData.debug) {
|
|
54
|
-
this.debugger = new
|
|
55
|
+
this.debugger = new __1.Logger({
|
|
55
56
|
name: `[Worker #${workerData.workerId}]`,
|
|
56
57
|
logLevel: common_1.LogLevels.Debug,
|
|
57
58
|
});
|
|
@@ -74,6 +75,12 @@ class WorkerClient extends base_1.BaseClient {
|
|
|
74
75
|
this.shards.forEach(s => (acc += s.latency));
|
|
75
76
|
return acc / this.shards.size;
|
|
76
77
|
}
|
|
78
|
+
setServices({ ...rest }) {
|
|
79
|
+
super.setServices(rest);
|
|
80
|
+
if (rest.handlers && 'events' in rest.handlers) {
|
|
81
|
+
this.events = rest.handlers.events;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
77
84
|
async start(options = {}) {
|
|
78
85
|
await super.start(options);
|
|
79
86
|
await this.loadEvents(options.eventsDir);
|
|
@@ -81,7 +88,7 @@ class WorkerClient extends base_1.BaseClient {
|
|
|
81
88
|
}
|
|
82
89
|
async loadEvents(dir) {
|
|
83
90
|
dir ??= await this.getRC().then(x => x.events);
|
|
84
|
-
if (dir) {
|
|
91
|
+
if (dir && this.events) {
|
|
85
92
|
await this.events.load(dir);
|
|
86
93
|
this.logger.info('EventHandler loaded');
|
|
87
94
|
}
|
|
@@ -191,7 +198,7 @@ class WorkerClient extends base_1.BaseClient {
|
|
|
191
198
|
}
|
|
192
199
|
break;
|
|
193
200
|
case 'BOT_READY':
|
|
194
|
-
await this.events
|
|
201
|
+
await this.events?.runEvent('BOT_READY', this, this.me, -1);
|
|
195
202
|
break;
|
|
196
203
|
case 'API_RESPONSE':
|
|
197
204
|
{
|
|
@@ -270,14 +277,14 @@ class WorkerClient extends base_1.BaseClient {
|
|
|
270
277
|
return this.generateSendPromise(nonce);
|
|
271
278
|
}
|
|
272
279
|
async onPacket(packet, shardId) {
|
|
273
|
-
await this.events
|
|
280
|
+
await this.events?.execute('RAW', packet, this, shardId);
|
|
274
281
|
switch (packet.t) {
|
|
275
282
|
case 'GUILD_MEMBER_UPDATE':
|
|
276
|
-
await this.events
|
|
283
|
+
await this.events?.execute(packet.t, packet, this, shardId);
|
|
277
284
|
await this.cache.onPacket(packet);
|
|
278
285
|
break;
|
|
279
286
|
case 'PRESENCE_UPDATE':
|
|
280
|
-
await this.events
|
|
287
|
+
await this.events?.execute(packet.t, packet, this, shardId);
|
|
281
288
|
await this.cache.onPacket(packet);
|
|
282
289
|
break;
|
|
283
290
|
//rest of the events
|
|
@@ -292,13 +299,13 @@ class WorkerClient extends base_1.BaseClient {
|
|
|
292
299
|
this.applicationId = packet.d.application.id;
|
|
293
300
|
this.me = new structures_1.ClientUser(this, packet.d.user, packet.d.application);
|
|
294
301
|
if (!this.__handleGuilds?.size ||
|
|
295
|
-
!((workerData.intents &
|
|
302
|
+
!((workerData.intents & v10_1.GatewayIntentBits.Guilds) === v10_1.GatewayIntentBits.Guilds)) {
|
|
296
303
|
if ([...this.shards.values()].every(shard => shard.data.session_id)) {
|
|
297
304
|
this.postMessage({
|
|
298
305
|
type: 'WORKER_READY',
|
|
299
306
|
workerId: this.workerId,
|
|
300
307
|
});
|
|
301
|
-
await this.events
|
|
308
|
+
await this.events?.runEvent('WORKER_READY', this, this.me, -1);
|
|
302
309
|
}
|
|
303
310
|
delete this.__handleGuilds;
|
|
304
311
|
}
|
|
@@ -318,7 +325,7 @@ class WorkerClient extends base_1.BaseClient {
|
|
|
318
325
|
type: 'WORKER_READY',
|
|
319
326
|
workerId: this.workerId,
|
|
320
327
|
});
|
|
321
|
-
await this.events
|
|
328
|
+
await this.events?.runEvent('WORKER_READY', this, this.me, -1);
|
|
322
329
|
}
|
|
323
330
|
if (!this.__handleGuilds.size)
|
|
324
331
|
delete this.__handleGuilds;
|
|
@@ -326,7 +333,7 @@ class WorkerClient extends base_1.BaseClient {
|
|
|
326
333
|
}
|
|
327
334
|
}
|
|
328
335
|
}
|
|
329
|
-
await this.events
|
|
336
|
+
await this.events?.execute(packet.t, packet, this, shardId);
|
|
330
337
|
}
|
|
331
338
|
break;
|
|
332
339
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type APIApplicationCommandBasicOption, type APIApplicationCommandOption, ApplicationCommandOptionType, ApplicationCommandType, type LocaleString } from 'discord-api-types/v10';
|
|
2
|
+
import type { PermissionStrings, SeyfertNumberOption, SeyfertStringOption } from '../..';
|
|
2
3
|
import type { Attachment } from '../../builders';
|
|
3
|
-
import
|
|
4
|
-
import { ApplicationCommandOptionType, ApplicationCommandType } from '../../common';
|
|
4
|
+
import { type FlatObjectKeys } from '../../common';
|
|
5
5
|
import type { AllChannels, AutocompleteInteraction, GuildRole, InteractionGuildMember, User } from '../../structures';
|
|
6
6
|
import type { Groups, IntegrationTypes, InteractionContextTypes, RegisteredMiddlewares } from '../decorators';
|
|
7
7
|
import type { CommandContext } from './chatcontext';
|
|
@@ -71,7 +71,7 @@ declare class BaseCommand {
|
|
|
71
71
|
name: string | undefined;
|
|
72
72
|
description: string | undefined;
|
|
73
73
|
};
|
|
74
|
-
|
|
74
|
+
__autoload?: true;
|
|
75
75
|
__tGroups?: Record<string, {
|
|
76
76
|
name: string | undefined;
|
|
77
77
|
description: string | undefined;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SubCommand = exports.Command = void 0;
|
|
4
|
+
const v10_1 = require("discord-api-types/v10");
|
|
4
5
|
const common_1 = require("../../common");
|
|
5
6
|
class BaseCommand {
|
|
6
7
|
middlewares = [];
|
|
7
8
|
__filePath;
|
|
8
9
|
__t;
|
|
9
|
-
|
|
10
|
+
__autoload;
|
|
10
11
|
__tGroups;
|
|
11
12
|
guild_id;
|
|
12
13
|
name;
|
|
@@ -76,19 +77,21 @@ class BaseCommand {
|
|
|
76
77
|
running = false;
|
|
77
78
|
return res({ pass: true });
|
|
78
79
|
};
|
|
79
|
-
|
|
80
|
+
function next(obj) {
|
|
80
81
|
if (!running) {
|
|
81
82
|
return;
|
|
82
83
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
// biome-ignore lint/style/noArguments: yes
|
|
85
|
+
if (arguments.length) {
|
|
86
|
+
// @ts-expect-error
|
|
87
|
+
context[global ? 'globalMetadata' : 'metadata'][middlewares[index]] = obj;
|
|
88
|
+
}
|
|
86
89
|
if (++index >= middlewares.length) {
|
|
87
90
|
running = false;
|
|
88
91
|
return res({});
|
|
89
92
|
}
|
|
90
93
|
context.client.middlewares[middlewares[index]]({ context, next, stop, pass });
|
|
91
|
-
}
|
|
94
|
+
}
|
|
92
95
|
const stop = err => {
|
|
93
96
|
if (!running) {
|
|
94
97
|
return;
|
|
@@ -126,10 +129,15 @@ class BaseCommand {
|
|
|
126
129
|
delete require.cache[this.__filePath];
|
|
127
130
|
const __tempCommand = await (0, common_1.magicImport)(this.__filePath).then(x => x.default ?? x);
|
|
128
131
|
Object.setPrototypeOf(this, __tempCommand.prototype);
|
|
132
|
+
for (const i of this.options ?? []) {
|
|
133
|
+
if (i instanceof SubCommand && i.__filePath) {
|
|
134
|
+
await i.reload();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
129
137
|
}
|
|
130
138
|
}
|
|
131
139
|
class Command extends BaseCommand {
|
|
132
|
-
type =
|
|
140
|
+
type = v10_1.ApplicationCommandType.ChatInput;
|
|
133
141
|
groups;
|
|
134
142
|
toJSON() {
|
|
135
143
|
const options = [];
|
|
@@ -141,7 +149,7 @@ class Command extends BaseCommand {
|
|
|
141
149
|
if (i.group) {
|
|
142
150
|
if (!options.find(x => x.name === i.group)) {
|
|
143
151
|
options.push({
|
|
144
|
-
type:
|
|
152
|
+
type: v10_1.ApplicationCommandOptionType.SubcommandGroup,
|
|
145
153
|
name: i.group,
|
|
146
154
|
description: this.groups[i.group].defaultDescription,
|
|
147
155
|
description_localizations: Object.fromEntries(this.groups?.[i.group].description ?? []),
|
|
@@ -178,7 +186,7 @@ class Command extends BaseCommand {
|
|
|
178
186
|
}
|
|
179
187
|
exports.Command = Command;
|
|
180
188
|
class SubCommand extends BaseCommand {
|
|
181
|
-
type =
|
|
189
|
+
type = v10_1.ApplicationCommandOptionType.Subcommand;
|
|
182
190
|
group;
|
|
183
191
|
toJSON() {
|
|
184
192
|
return {
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { AllChannels, Guild, InferWithPrefix, ReturnCache, WebhookMessage } from '../..';
|
|
2
|
+
import type { If, UnionToTuple, When } from '../../common';
|
|
3
3
|
import type { InteractionCreateBodyRequest, InteractionMessageUpdateBodyRequest } from '../../common/types/write';
|
|
4
4
|
import { Message, type ChatInputCommandInteraction, type GuildMember, type InteractionGuildMember } from '../../structures';
|
|
5
|
+
import { BaseContext } from '../basecontex';
|
|
5
6
|
import type { RegisteredMiddlewares } from '../decorators';
|
|
6
7
|
import type { OptionResolver } from '../optionresolver';
|
|
7
8
|
import type { Command, ContextOptions, OptionsRecord, SubCommand } from './chat';
|
|
8
9
|
import type { CommandMetadata, ExtendContext, GlobalMetadata, UsingClient } from './shared';
|
|
9
|
-
export interface CommandContext<T extends OptionsRecord = {}, M extends keyof RegisteredMiddlewares = never> extends ExtendContext {
|
|
10
|
+
export interface CommandContext<T extends OptionsRecord = {}, M extends keyof RegisteredMiddlewares = never> extends BaseContext, ExtendContext {
|
|
10
11
|
}
|
|
11
|
-
export declare class CommandContext<T extends OptionsRecord = {}, M extends keyof RegisteredMiddlewares = never> {
|
|
12
|
+
export declare class CommandContext<T extends OptionsRecord = {}, M extends keyof RegisteredMiddlewares = never> extends BaseContext {
|
|
12
13
|
readonly client: UsingClient;
|
|
13
14
|
readonly resolver: OptionResolver;
|
|
14
15
|
readonly shardId: number;
|
|
@@ -28,7 +29,7 @@ export declare class CommandContext<T extends OptionsRecord = {}, M extends keyo
|
|
|
28
29
|
write<FR extends boolean = false>(body: InteractionCreateBodyRequest, fetchReply?: FR): Promise<When<FR, WebhookMessage | Message, void | WebhookMessage | Message>>;
|
|
29
30
|
deferReply(ephemeral?: boolean): Promise<void | Message>;
|
|
30
31
|
editResponse(body: InteractionMessageUpdateBodyRequest): Promise<Message>;
|
|
31
|
-
deleteResponse(): Promise<void>;
|
|
32
|
+
deleteResponse(): Promise<void | undefined>;
|
|
32
33
|
editOrReply<FR extends boolean = false>(body: InteractionCreateBodyRequest | InteractionMessageUpdateBodyRequest, fetchReply?: FR): Promise<When<FR, WebhookMessage | Message, void | WebhookMessage | Message>>;
|
|
33
34
|
fetchResponse(): Promise<If<InferWithPrefix, WebhookMessage | Message | undefined, WebhookMessage | undefined>>;
|
|
34
35
|
channel(mode?: 'rest' | 'flow'): Promise<If<InferWithPrefix, AllChannels | undefined, AllChannels>>;
|
|
@@ -39,10 +40,6 @@ export declare class CommandContext<T extends OptionsRecord = {}, M extends keyo
|
|
|
39
40
|
guild(mode?: 'cache'): ReturnCache<Guild<'cached'> | undefined>;
|
|
40
41
|
get guildId(): string | undefined;
|
|
41
42
|
get channelId(): string;
|
|
42
|
-
get author(): User;
|
|
43
|
+
get author(): import("../..").User;
|
|
43
44
|
get member(): If<InferWithPrefix, GuildMember | InteractionGuildMember | undefined, InteractionGuildMember | undefined>;
|
|
44
|
-
isChat(): this is CommandContext;
|
|
45
|
-
isMenu(): this is MenuCommandContext<any>;
|
|
46
|
-
isMenuUser(): this is MenuCommandContext<UserCommandInteraction>;
|
|
47
|
-
isMenuMessage(): this is MenuCommandContext<MessageCommandInteraction>;
|
|
48
45
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CommandContext = void 0;
|
|
4
|
-
const
|
|
5
|
-
const common_1 = require("../../common");
|
|
4
|
+
const v10_1 = require("discord-api-types/v10");
|
|
6
5
|
const structures_1 = require("../../structures");
|
|
7
|
-
|
|
6
|
+
const basecontex_1 = require("../basecontex");
|
|
7
|
+
class CommandContext extends basecontex_1.BaseContext {
|
|
8
8
|
client;
|
|
9
9
|
resolver;
|
|
10
10
|
shardId;
|
|
@@ -13,6 +13,7 @@ class CommandContext {
|
|
|
13
13
|
interaction;
|
|
14
14
|
messageResponse;
|
|
15
15
|
constructor(client, data, resolver, shardId, command) {
|
|
16
|
+
super(client);
|
|
16
17
|
this.client = client;
|
|
17
18
|
this.resolver = resolver;
|
|
18
19
|
this.shardId = shardId;
|
|
@@ -31,7 +32,7 @@ class CommandContext {
|
|
|
31
32
|
return this.client.proxy;
|
|
32
33
|
}
|
|
33
34
|
get t() {
|
|
34
|
-
return this.client.
|
|
35
|
+
return this.client.t(this.interaction?.locale ?? this.client.langs?.defaultLang ?? 'en-US');
|
|
35
36
|
}
|
|
36
37
|
get fullCommandName() {
|
|
37
38
|
return this.resolver.fullCommandName;
|
|
@@ -44,7 +45,7 @@ class CommandContext {
|
|
|
44
45
|
}
|
|
45
46
|
async deferReply(ephemeral = false) {
|
|
46
47
|
if (this.interaction)
|
|
47
|
-
return this.interaction.deferReply(ephemeral ?
|
|
48
|
+
return this.interaction.deferReply(ephemeral ? v10_1.MessageFlags.Ephemeral : undefined);
|
|
48
49
|
const options = this.client.options?.commands;
|
|
49
50
|
return (this.messageResponse = await this.message[options?.reply?.(this) ? 'reply' : 'write'](options?.deferReplyResponse?.(this) ?? { content: 'Thinking...' }));
|
|
50
51
|
}
|
|
@@ -121,17 +122,5 @@ class CommandContext {
|
|
|
121
122
|
get member() {
|
|
122
123
|
return this.interaction?.member || this.message?.member;
|
|
123
124
|
}
|
|
124
|
-
isChat() {
|
|
125
|
-
return this instanceof CommandContext;
|
|
126
|
-
}
|
|
127
|
-
isMenu() {
|
|
128
|
-
return this instanceof __1.MenuCommandContext;
|
|
129
|
-
}
|
|
130
|
-
isMenuUser() {
|
|
131
|
-
return this instanceof __1.MenuCommandContext && this.target instanceof __1.User;
|
|
132
|
-
}
|
|
133
|
-
isMenuMessage() {
|
|
134
|
-
return this instanceof __1.MenuCommandContext && this.target instanceof structures_1.Message;
|
|
135
|
-
}
|
|
136
125
|
}
|
|
137
126
|
exports.CommandContext = CommandContext;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ApplicationCommandType, LocaleString } from 'discord-api-types/v10';
|
|
2
|
+
import { type PermissionStrings } from '../../common';
|
|
2
3
|
import type { IntegrationTypes, InteractionContextTypes, RegisteredMiddlewares } from '../decorators';
|
|
3
4
|
import type { MenuCommandContext } from './menucontext';
|
|
4
5
|
import type { UsingClient } from './shared';
|
|
@@ -33,19 +33,21 @@ class ContextMenuCommand {
|
|
|
33
33
|
running = false;
|
|
34
34
|
return res({ pass: true });
|
|
35
35
|
};
|
|
36
|
-
|
|
36
|
+
function next(obj) {
|
|
37
37
|
if (!running) {
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
// biome-ignore lint/style/noArguments: yes
|
|
41
|
+
if (arguments.length) {
|
|
42
|
+
// @ts-expect-error
|
|
43
|
+
context[global ? 'globalMetadata' : 'metadata'][middlewares[index]] = obj;
|
|
44
|
+
}
|
|
43
45
|
if (++index >= middlewares.length) {
|
|
44
46
|
running = false;
|
|
45
47
|
return res({});
|
|
46
48
|
}
|
|
47
49
|
context.client.middlewares[middlewares[index]]({ context, next, stop, pass });
|
|
48
|
-
}
|
|
50
|
+
}
|
|
49
51
|
const stop = err => {
|
|
50
52
|
if (!running) {
|
|
51
53
|
return;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ContextMenuCommand, ReturnCache, WebhookMessage } from '../..';
|
|
2
2
|
import { type InteractionCreateBodyRequest, type InteractionMessageUpdateBodyRequest, type UnionToTuple, type When } from '../../common';
|
|
3
3
|
import { Message, User, type AllChannels, type Guild, type GuildMember, type MessageCommandInteraction, type UserCommandInteraction } from '../../structures';
|
|
4
|
+
import { BaseContext } from '../basecontex';
|
|
4
5
|
import type { RegisteredMiddlewares } from '../decorators';
|
|
5
6
|
import type { CommandMetadata, ExtendContext, GlobalMetadata, UsingClient } from './shared';
|
|
6
7
|
export type InteractionTarget<T> = T extends MessageCommandInteraction ? Message : User;
|
|
7
|
-
export interface MenuCommandContext<T extends MessageCommandInteraction | UserCommandInteraction, M extends keyof RegisteredMiddlewares = never> extends ExtendContext {
|
|
8
|
+
export interface MenuCommandContext<T extends MessageCommandInteraction | UserCommandInteraction, M extends keyof RegisteredMiddlewares = never> extends BaseContext, ExtendContext {
|
|
8
9
|
}
|
|
9
|
-
export declare class MenuCommandContext<T extends MessageCommandInteraction | UserCommandInteraction, M extends keyof RegisteredMiddlewares = never> {
|
|
10
|
+
export declare class MenuCommandContext<T extends MessageCommandInteraction | UserCommandInteraction, M extends keyof RegisteredMiddlewares = never> extends BaseContext {
|
|
10
11
|
readonly client: UsingClient;
|
|
11
12
|
readonly interaction: T;
|
|
12
13
|
readonly shardId: number;
|
|
@@ -14,7 +15,6 @@ export declare class MenuCommandContext<T extends MessageCommandInteraction | Us
|
|
|
14
15
|
constructor(client: UsingClient, interaction: T, shardId: number, command: ContextMenuCommand);
|
|
15
16
|
metadata: CommandMetadata<UnionToTuple<M>>;
|
|
16
17
|
globalMetadata: GlobalMetadata;
|
|
17
|
-
get proxy(): import("../..").APIRoutes;
|
|
18
18
|
get target(): InteractionTarget<T>;
|
|
19
19
|
get t(): import("../..").__InternalParseLocale<import("./shared").DefaultLocale> & {
|
|
20
20
|
get(locale?: string | undefined): import("./shared").DefaultLocale;
|
|
@@ -24,7 +24,7 @@ export declare class MenuCommandContext<T extends MessageCommandInteraction | Us
|
|
|
24
24
|
get modal(): ((body: import("../../common").ModalCreateBodyRequest) => Promise<void>) | ((body: import("../../common").ModalCreateBodyRequest) => Promise<void>);
|
|
25
25
|
deferReply(ephemeral?: boolean): Promise<void>;
|
|
26
26
|
editResponse(body: InteractionMessageUpdateBodyRequest): Promise<Message>;
|
|
27
|
-
deleteResponse(): Promise<void>;
|
|
27
|
+
deleteResponse(): Promise<void | undefined>;
|
|
28
28
|
editOrReply<FR extends boolean = false>(body: InteractionCreateBodyRequest | InteractionMessageUpdateBodyRequest, fetchReply?: FR): Promise<When<FR, WebhookMessage | Message, void | WebhookMessage | Message>>;
|
|
29
29
|
fetchResponse(): Promise<WebhookMessage | undefined>;
|
|
30
30
|
channel(mode?: 'rest' | 'flow'): Promise<AllChannels>;
|
|
@@ -37,8 +37,4 @@ export declare class MenuCommandContext<T extends MessageCommandInteraction | Us
|
|
|
37
37
|
get channelId(): string;
|
|
38
38
|
get author(): User;
|
|
39
39
|
get member(): import("../..").InteractionGuildMember | undefined;
|
|
40
|
-
isChat(): this is CommandContext;
|
|
41
|
-
isMenu(): this is MenuCommandContext<any>;
|
|
42
|
-
isMenuUser(): this is MenuCommandContext<UserCommandInteraction>;
|
|
43
|
-
isMenuMessage(): this is MenuCommandContext<MessageCommandInteraction>;
|
|
44
40
|
}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MenuCommandContext = void 0;
|
|
4
|
-
const
|
|
4
|
+
const v10_1 = require("discord-api-types/v10");
|
|
5
5
|
const common_1 = require("../../common");
|
|
6
6
|
const structures_1 = require("../../structures");
|
|
7
|
-
|
|
7
|
+
const basecontex_1 = require("../basecontex");
|
|
8
|
+
class MenuCommandContext extends basecontex_1.BaseContext {
|
|
8
9
|
client;
|
|
9
10
|
interaction;
|
|
10
11
|
shardId;
|
|
11
12
|
command;
|
|
12
13
|
constructor(client, interaction, shardId, command) {
|
|
14
|
+
super(client);
|
|
13
15
|
this.client = client;
|
|
14
16
|
this.interaction = interaction;
|
|
15
17
|
this.shardId = shardId;
|
|
@@ -17,24 +19,21 @@ class MenuCommandContext {
|
|
|
17
19
|
}
|
|
18
20
|
metadata = {};
|
|
19
21
|
globalMetadata = {};
|
|
20
|
-
get proxy() {
|
|
21
|
-
return this.client.proxy;
|
|
22
|
-
}
|
|
23
22
|
// biome-ignore lint/suspicious/useGetterReturn: default don't exist.
|
|
24
23
|
get target() {
|
|
25
24
|
switch (this.interaction.data.type) {
|
|
26
|
-
case
|
|
25
|
+
case v10_1.ApplicationCommandType.Message: {
|
|
27
26
|
const data = this.interaction.data.resolved.messages[this.interaction.data.targetId];
|
|
28
27
|
return new structures_1.Message(this.client, (0, common_1.toSnakeCase)(data));
|
|
29
28
|
}
|
|
30
|
-
case
|
|
29
|
+
case v10_1.ApplicationCommandType.User: {
|
|
31
30
|
const data = this.interaction.data.resolved.users[this.interaction.data.targetId];
|
|
32
31
|
return new structures_1.User(this.client, (0, common_1.toSnakeCase)(data));
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
35
|
get t() {
|
|
37
|
-
return this.client.langs.get(this.interaction.locale);
|
|
36
|
+
return this.client.langs.get(this.interaction.locale ?? this.client.langs.defaultLang ?? 'en-US');
|
|
38
37
|
}
|
|
39
38
|
get fullCommandName() {
|
|
40
39
|
return this.command.name;
|
|
@@ -46,7 +45,7 @@ class MenuCommandContext {
|
|
|
46
45
|
return this.interaction.modal;
|
|
47
46
|
}
|
|
48
47
|
deferReply(ephemeral = false) {
|
|
49
|
-
return this.interaction.deferReply(ephemeral ?
|
|
48
|
+
return this.interaction.deferReply(ephemeral ? v10_1.MessageFlags.Ephemeral : undefined);
|
|
50
49
|
}
|
|
51
50
|
editResponse(body) {
|
|
52
51
|
return this.interaction.editResponse(body);
|
|
@@ -97,17 +96,5 @@ class MenuCommandContext {
|
|
|
97
96
|
get member() {
|
|
98
97
|
return this.interaction.member;
|
|
99
98
|
}
|
|
100
|
-
isChat() {
|
|
101
|
-
return this instanceof __1.CommandContext;
|
|
102
|
-
}
|
|
103
|
-
isMenu() {
|
|
104
|
-
return this instanceof MenuCommandContext;
|
|
105
|
-
}
|
|
106
|
-
isMenuUser() {
|
|
107
|
-
return this instanceof MenuCommandContext && this.target instanceof structures_1.User;
|
|
108
|
-
}
|
|
109
|
-
isMenuMessage() {
|
|
110
|
-
return this instanceof MenuCommandContext && this.target instanceof structures_1.Message;
|
|
111
|
-
}
|
|
112
99
|
}
|
|
113
100
|
exports.MenuCommandContext = MenuCommandContext;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { BaseClient } from '../../client/base';
|
|
2
|
+
import type { IsStrictlyUndefined } from '../../common';
|
|
2
3
|
import type { RegisteredMiddlewares } from '../decorators';
|
|
3
4
|
export type OKFunction<T> = (value: T) => void;
|
|
4
5
|
export type StopFunction = (error: string) => void;
|
|
5
|
-
export type NextFunction<T = unknown> = (data: T) => void;
|
|
6
|
+
export type NextFunction<T = unknown> = IsStrictlyUndefined<T> extends true ? () => void : (data: T) => void;
|
|
6
7
|
export type PassFunction = () => void;
|
|
7
8
|
export type InferWithPrefix = InternalOptions extends {
|
|
8
9
|
withPrefix: infer P;
|
|
@@ -24,13 +25,13 @@ export type MiddlewareContext<T = any, C = any> = (context: {
|
|
|
24
25
|
stop: StopFunction;
|
|
25
26
|
pass: PassFunction;
|
|
26
27
|
}) => any;
|
|
27
|
-
export type MetadataMiddleware<T extends MiddlewareContext> = Parameters<Parameters<T>[0]['next']>[0];
|
|
28
|
+
export type MetadataMiddleware<T extends MiddlewareContext> = IsStrictlyUndefined<Parameters<Parameters<T>[0]['next']>[0]> extends true ? never : Parameters<Parameters<T>[0]['next']>[0];
|
|
28
29
|
export type CommandMetadata<T extends readonly (keyof RegisteredMiddlewares)[]> = T extends readonly [
|
|
29
30
|
infer first,
|
|
30
31
|
...infer rest
|
|
31
|
-
] ? first extends keyof RegisteredMiddlewares ? {
|
|
32
|
+
] ? first extends keyof RegisteredMiddlewares ? (MetadataMiddleware<RegisteredMiddlewares[first]> extends never ? {} : {
|
|
32
33
|
[key in first]: MetadataMiddleware<RegisteredMiddlewares[first]>;
|
|
33
|
-
} & (rest extends readonly (keyof RegisteredMiddlewares)[] ? CommandMetadata<rest> : {}) : {} : {};
|
|
34
|
+
}) & (rest extends readonly (keyof RegisteredMiddlewares)[] ? CommandMetadata<rest> : {}) : {} : {};
|
|
34
35
|
export type OnOptionsReturnObject = Record<string, {
|
|
35
36
|
failed: false;
|
|
36
37
|
value: unknown;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ComponentCommandInteractionMap, ComponentContext } from '../components/componentcontext';
|
|
2
|
+
import { type MessageCommandInteraction, type UserCommandInteraction } from '../structures';
|
|
3
|
+
import type { CommandContext } from './applications/chatcontext';
|
|
4
|
+
import type { MenuCommandContext } from './applications/menucontext';
|
|
5
|
+
import type { UsingClient } from './applications/shared';
|
|
6
|
+
export declare class BaseContext {
|
|
7
|
+
readonly client: UsingClient;
|
|
8
|
+
constructor(client: UsingClient);
|
|
9
|
+
get proxy(): import("..").APIRoutes;
|
|
10
|
+
isChat(): this is CommandContext;
|
|
11
|
+
isMenu(): this is MenuCommandContext<UserCommandInteraction | MessageCommandInteraction>;
|
|
12
|
+
isMenuUser(): this is MenuCommandContext<UserCommandInteraction>;
|
|
13
|
+
isMenuMessage(): this is MenuCommandContext<MessageCommandInteraction>;
|
|
14
|
+
isComponent(): this is ComponentContext<keyof ComponentCommandInteractionMap>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseContext = void 0;
|
|
4
|
+
const v10_1 = require("discord-api-types/v10");
|
|
5
|
+
const structures_1 = require("../structures");
|
|
6
|
+
class BaseContext {
|
|
7
|
+
client;
|
|
8
|
+
constructor(client) {
|
|
9
|
+
this.client = client;
|
|
10
|
+
}
|
|
11
|
+
get proxy() {
|
|
12
|
+
return this.client.proxy;
|
|
13
|
+
}
|
|
14
|
+
isChat() {
|
|
15
|
+
//@ts-expect-error
|
|
16
|
+
return this.message || this.interaction.type === v10_1.ApplicationCommandType.ChatInput;
|
|
17
|
+
}
|
|
18
|
+
isMenu() {
|
|
19
|
+
return this.isMenuUser() || this.isMenuMessage();
|
|
20
|
+
}
|
|
21
|
+
isMenuUser() {
|
|
22
|
+
//@ts-expect-error
|
|
23
|
+
return this.target instanceof structures_1.User;
|
|
24
|
+
}
|
|
25
|
+
isMenuMessage() {
|
|
26
|
+
//@ts-expect-error
|
|
27
|
+
return this.target instanceof structures_1.Message;
|
|
28
|
+
}
|
|
29
|
+
isComponent() {
|
|
30
|
+
//@ts-expect-error
|
|
31
|
+
return this.interaction.type === v10_1.InteractionType.MessageComponent;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.BaseContext = BaseContext;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ApplicationCommandType, type
|
|
1
|
+
import { ApplicationCommandType, type LocaleString } from 'discord-api-types/v10';
|
|
2
|
+
import type { FlatObjectKeys, PermissionStrings } from '../common';
|
|
2
3
|
import type { CommandOption, OptionsRecord, SubCommand } from './applications/chat';
|
|
3
4
|
import type { DefaultLocale, MiddlewareContext } from './applications/shared';
|
|
4
5
|
export interface RegisteredMiddlewares {
|
|
@@ -92,7 +93,7 @@ export declare function Options(options: (new () => SubCommand)[] | OptionsRecor
|
|
|
92
93
|
} & T;
|
|
93
94
|
export declare function AutoLoad(): <T extends new (...args: any[]) => {}>(target: T) => {
|
|
94
95
|
new (...args: any[]): {
|
|
95
|
-
|
|
96
|
+
__autoload: boolean;
|
|
96
97
|
};
|
|
97
98
|
} & T;
|
|
98
99
|
export type ParseMiddlewares<T extends Record<string, MiddlewareContext>> = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Declare = exports.Middlewares = exports.AutoLoad = exports.Options = exports.Group = exports.Groups = exports.GroupsT = exports.LocalesT = exports.Locales = exports.InteractionContextTypes = exports.IntegrationTypes = void 0;
|
|
4
|
-
const
|
|
4
|
+
const v10_1 = require("discord-api-types/v10");
|
|
5
5
|
var IntegrationTypes;
|
|
6
6
|
(function (IntegrationTypes) {
|
|
7
7
|
IntegrationTypes[IntegrationTypes["GUILD_INSTALL"] = 0] = "GUILD_INSTALL";
|
|
@@ -59,7 +59,7 @@ function Options(options) {
|
|
|
59
59
|
exports.Options = Options;
|
|
60
60
|
function AutoLoad() {
|
|
61
61
|
return (target) => class extends target {
|
|
62
|
-
|
|
62
|
+
__autoload = true;
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
exports.AutoLoad = AutoLoad;
|
|
@@ -76,13 +76,13 @@ function Declare(declare) {
|
|
|
76
76
|
contexts = declare.contexts?.map(i => InteractionContextTypes[i]);
|
|
77
77
|
integration_types = declare.integrationTypes?.map(i => IntegrationTypes[i]);
|
|
78
78
|
default_member_permissions = Array.isArray(declare.defaultMemberPermissions)
|
|
79
|
-
? declare.defaultMemberPermissions?.reduce((acc, prev) => acc |
|
|
79
|
+
? declare.defaultMemberPermissions?.reduce((acc, prev) => acc | v10_1.PermissionFlagsBits[prev], BigInt(0)).toString()
|
|
80
80
|
: declare.defaultMemberPermissions;
|
|
81
81
|
botPermissions = Array.isArray(declare.botPermissions)
|
|
82
|
-
? declare.botPermissions?.reduce((acc, prev) => acc |
|
|
82
|
+
? declare.botPermissions?.reduce((acc, prev) => acc | v10_1.PermissionFlagsBits[prev], BigInt(0))
|
|
83
83
|
: declare.botPermissions;
|
|
84
84
|
description = '';
|
|
85
|
-
type =
|
|
85
|
+
type = v10_1.ApplicationCommandType.ChatInput;
|
|
86
86
|
guild_id;
|
|
87
87
|
constructor(...args) {
|
|
88
88
|
super(...args);
|
|
@@ -3,6 +3,12 @@ import { BaseHandler } from '../common';
|
|
|
3
3
|
import { Command } from './applications/chat';
|
|
4
4
|
import { ContextMenuCommand } from './applications/menu';
|
|
5
5
|
import type { UsingClient } from './applications/shared';
|
|
6
|
+
export interface CommandHandlerLike {
|
|
7
|
+
values: CommandHandler['values'];
|
|
8
|
+
load: CommandHandler['load'];
|
|
9
|
+
reload: CommandHandler['reload'];
|
|
10
|
+
reloadAll: CommandHandler['reloadAll'];
|
|
11
|
+
}
|
|
6
12
|
export declare class CommandHandler extends BaseHandler {
|
|
7
13
|
protected logger: Logger;
|
|
8
14
|
protected client: UsingClient;
|