seyfert 2.1.0 → 2.1.1-dev-11310514874.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/Router.d.ts +2 -2
- package/lib/api/Router.js +2 -1
- package/lib/api/Routes/applications.d.ts +29 -30
- package/lib/api/Routes/cdn.d.ts +6 -1
- package/lib/api/Routes/channels.d.ts +44 -45
- package/lib/api/Routes/gateway.d.ts +3 -4
- package/lib/api/Routes/guilds.d.ts +81 -80
- package/lib/api/Routes/index.d.ts +3 -1
- package/lib/api/Routes/interactions.d.ts +6 -6
- package/lib/api/Routes/invites.d.ts +3 -4
- package/lib/api/Routes/skus.d.ts +4 -5
- package/lib/api/Routes/soundboard.d.ts +23 -0
- package/lib/api/Routes/soundboard.js +2 -0
- package/lib/api/Routes/stage-instances.d.ts +5 -6
- package/lib/api/Routes/stickers.d.ts +3 -4
- package/lib/api/Routes/users.d.ts +11 -12
- package/lib/api/Routes/voice.d.ts +2 -3
- package/lib/api/Routes/webhooks.d.ts +16 -15
- package/lib/api/api.d.ts +17 -11
- package/lib/api/api.js +12 -10
- package/lib/api/shared.d.ts +1 -1
- package/lib/api/utils/constants.d.ts +2 -0
- package/lib/api/utils/constants.js +2 -1
- package/lib/builders/ActionRow.d.ts +1 -1
- package/lib/builders/Attachment.d.ts +2 -2
- package/lib/builders/Attachment.js +1 -1
- package/lib/builders/Button.d.ts +1 -1
- package/lib/builders/Button.js +1 -1
- package/lib/builders/Embed.d.ts +1 -1
- package/lib/builders/Embed.js +2 -2
- package/lib/builders/Modal.d.ts +1 -1
- package/lib/builders/Poll.d.ts +1 -1
- package/lib/builders/Poll.js +1 -1
- package/lib/builders/SelectMenu.d.ts +1 -1
- package/lib/builders/SelectMenu.js +1 -1
- package/lib/builders/types.d.ts +2 -1
- package/lib/cache/adapters/default.js +5 -3
- package/lib/cache/adapters/limited.d.ts +1 -2
- package/lib/cache/adapters/limited.js +34 -30
- package/lib/cache/adapters/workeradapter.js +3 -1
- package/lib/cache/index.d.ts +8 -11
- package/lib/cache/index.js +38 -37
- package/lib/cache/resources/bans.d.ts +2 -2
- package/lib/cache/resources/bans.js +1 -1
- package/lib/cache/resources/channels.d.ts +1 -1
- package/lib/cache/resources/default/guild-related.d.ts +1 -2
- package/lib/cache/resources/emojis.d.ts +2 -2
- package/lib/cache/resources/emojis.js +1 -1
- package/lib/cache/resources/guilds.d.ts +2 -2
- package/lib/cache/resources/guilds.js +7 -11
- package/lib/cache/resources/members.d.ts +2 -2
- package/lib/cache/resources/members.js +1 -1
- package/lib/cache/resources/messages.d.ts +2 -2
- package/lib/cache/resources/messages.js +3 -3
- package/lib/cache/resources/overwrites.d.ts +1 -1
- package/lib/cache/resources/roles.d.ts +2 -2
- package/lib/cache/resources/roles.js +1 -1
- package/lib/cache/resources/stickers.d.ts +2 -2
- package/lib/cache/resources/stickers.js +1 -1
- package/lib/cache/resources/users.d.ts +2 -2
- package/lib/cache/resources/users.js +1 -1
- package/lib/cache/resources/voice-states.d.ts +2 -2
- package/lib/cache/resources/voice-states.js +1 -1
- package/lib/client/base.d.ts +9 -14
- package/lib/client/base.js +43 -44
- package/lib/client/client.d.ts +3 -7
- package/lib/client/client.js +24 -41
- package/lib/client/collectors.js +1 -1
- package/lib/client/httpclient.d.ts +1 -1
- package/lib/client/transformers.d.ts +37 -34
- package/lib/client/transformers.js +66 -63
- package/lib/client/workerclient.d.ts +10 -11
- package/lib/client/workerclient.js +180 -75
- package/lib/collection.d.ts +3 -3
- package/lib/commands/applications/chat.d.ts +3 -3
- package/lib/commands/applications/chat.js +5 -6
- package/lib/commands/applications/chatcontext.d.ts +6 -6
- package/lib/commands/applications/chatcontext.js +16 -8
- package/lib/commands/applications/entryPoint.d.ts +1 -1
- package/lib/commands/applications/entrycontext.d.ts +6 -6
- package/lib/commands/applications/entrycontext.js +4 -4
- package/lib/commands/applications/menu.d.ts +1 -1
- package/lib/commands/applications/menucontext.d.ts +5 -5
- package/lib/commands/applications/menucontext.js +6 -6
- package/lib/commands/applications/options.d.ts +4 -4
- package/lib/commands/applications/shared.d.ts +5 -2
- package/lib/commands/basecontext.d.ts +1 -1
- package/lib/commands/decorators.d.ts +10 -10
- package/lib/commands/decorators.js +5 -4
- package/lib/commands/handle.d.ts +9 -9
- package/lib/commands/handle.js +94 -68
- package/lib/commands/handler.d.ts +5 -5
- package/lib/commands/handler.js +21 -17
- package/lib/commands/optionresolver.d.ts +4 -4
- package/lib/commands/optionresolver.js +3 -3
- package/lib/common/it/formatter.d.ts +21 -21
- package/lib/common/it/formatter.js +40 -41
- package/lib/common/it/logger.js +1 -1
- package/lib/common/it/utils.d.ts +4 -3
- package/lib/common/it/utils.js +52 -27
- package/lib/common/shorters/application.d.ts +2 -3
- package/lib/common/shorters/application.js +3 -3
- package/lib/common/shorters/bans.js +1 -1
- package/lib/common/shorters/channels.d.ts +3 -3
- package/lib/common/shorters/channels.js +3 -3
- package/lib/common/shorters/emojis.js +4 -4
- package/lib/common/shorters/guilds.d.ts +3 -3
- package/lib/common/shorters/guilds.js +5 -9
- package/lib/common/shorters/interaction.d.ts +3 -3
- package/lib/common/shorters/interaction.js +6 -5
- package/lib/common/shorters/members.d.ts +4 -5
- package/lib/common/shorters/members.js +6 -7
- package/lib/common/shorters/messages.d.ts +1 -1
- package/lib/common/shorters/messages.js +4 -4
- package/lib/common/shorters/reactions.d.ts +1 -1
- package/lib/common/shorters/reactions.js +1 -1
- package/lib/common/shorters/roles.js +1 -1
- package/lib/common/shorters/templates.js +2 -2
- package/lib/common/shorters/threads.d.ts +1 -1
- package/lib/common/shorters/threads.js +17 -11
- package/lib/common/shorters/webhook.d.ts +1 -1
- package/lib/common/shorters/webhook.js +4 -4
- package/lib/common/types/options.d.ts +2 -2
- package/lib/common/types/resolvables.d.ts +1 -1
- package/lib/common/types/util.d.ts +4 -1
- package/lib/common/types/write.d.ts +1 -1
- package/lib/components/BaseComponent.js +1 -1
- package/lib/components/ButtonComponent.d.ts +1 -1
- package/lib/components/componentcommand.d.ts +1 -1
- package/lib/components/componentcontext.d.ts +4 -4
- package/lib/components/componentcontext.js +1 -1
- package/lib/components/handler.d.ts +10 -8
- package/lib/components/handler.js +16 -13
- package/lib/components/index.js +2 -1
- package/lib/components/modalcontext.d.ts +2 -2
- package/lib/components/modalcontext.js +1 -1
- package/lib/deps/mixer.d.ts +1 -1
- package/lib/events/handler.d.ts +5 -5
- package/lib/events/handler.js +66 -16
- package/lib/events/hooks/application_command.d.ts +1 -1
- package/lib/events/hooks/auto_moderation.d.ts +1 -1
- package/lib/events/hooks/auto_moderation.js +1 -1
- 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 -5
- package/lib/events/hooks/entitlement.js +4 -4
- package/lib/events/hooks/guild.d.ts +3 -3
- package/lib/events/hooks/guild.js +1 -1
- package/lib/events/hooks/index.d.ts +1 -0
- package/lib/events/hooks/index.js +1 -0
- package/lib/events/hooks/integration.d.ts +1 -1
- package/lib/events/hooks/integration.js +1 -1
- package/lib/events/hooks/interactions.d.ts +3 -3
- package/lib/events/hooks/invite.d.ts +1 -1
- package/lib/events/hooks/message.d.ts +3 -3
- package/lib/events/hooks/message.js +1 -1
- package/lib/events/hooks/presence.d.ts +2 -2
- package/lib/events/hooks/soundboard.d.ts +155 -0
- package/lib/events/hooks/soundboard.js +28 -0
- package/lib/events/hooks/stage.d.ts +2 -2
- package/lib/events/hooks/thread.d.ts +2 -2
- package/lib/events/hooks/thread.js +2 -2
- package/lib/events/hooks/typing.d.ts +1 -1
- package/lib/events/hooks/typing.js +1 -1
- package/lib/events/hooks/user.d.ts +2 -2
- package/lib/events/hooks/voice.d.ts +2 -2
- package/lib/events/hooks/voice.js +1 -1
- package/lib/events/hooks/webhook.d.ts +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +3 -5
- package/lib/langs/handler.d.ts +2 -2
- package/lib/structures/Guild.d.ts +7 -4
- package/lib/structures/Guild.js +1 -1
- package/lib/structures/GuildBan.d.ts +1 -1
- package/lib/structures/GuildMember.d.ts +7 -5
- package/lib/structures/GuildMember.js +5 -3
- package/lib/structures/GuildRole.d.ts +1 -1
- package/lib/structures/GuildTemplate.d.ts +1 -1
- package/lib/structures/Interaction.d.ts +17 -14
- package/lib/structures/Interaction.js +28 -21
- package/lib/structures/Message.d.ts +4 -7
- package/lib/structures/Message.js +5 -5
- package/lib/structures/Poll.d.ts +3 -3
- package/lib/structures/Sticker.d.ts +2 -2
- package/lib/structures/Sticker.js +1 -1
- package/lib/structures/VoiceState.d.ts +2 -1
- package/lib/structures/VoiceState.js +1 -1
- package/lib/structures/Webhook.d.ts +3 -3
- package/lib/structures/Webhook.js +1 -1
- package/lib/structures/channels.d.ts +4 -4
- package/lib/structures/channels.js +6 -5
- package/lib/structures/extra/BitField.d.ts +3 -3
- package/lib/structures/extra/BitField.js +34 -33
- package/lib/structures/extra/DiscordBase.js +1 -1
- package/lib/structures/extra/Permissions.d.ts +2 -0
- package/lib/structures/extra/Permissions.js +21 -0
- package/lib/types/gateway.d.ts +53 -5
- package/lib/types/payloads/_interactions/base.d.ts +1 -1
- package/lib/types/payloads/channel.d.ts +2 -2
- package/lib/types/payloads/guild.d.ts +9 -1
- package/lib/types/payloads/guild.js +8 -0
- package/lib/types/payloads/index.d.ts +1 -0
- package/lib/types/payloads/index.js +1 -0
- package/lib/types/payloads/soundboard.d.ts +23 -0
- package/lib/types/payloads/soundboard.js +5 -0
- package/lib/types/payloads/user.js +0 -1
- package/lib/types/rest/application.d.ts +3 -3
- package/lib/types/rest/auditLog.d.ts +1 -1
- package/lib/types/rest/channel.d.ts +2 -2
- package/lib/types/rest/guild.d.ts +2 -2
- package/lib/types/rest/guildScheduledEvent.d.ts +1 -1
- package/lib/types/rest/index.d.ts +1 -0
- package/lib/types/rest/index.js +1 -0
- package/lib/types/rest/oauth2.d.ts +1 -1
- package/lib/types/rest/poll.d.ts +1 -1
- package/lib/types/rest/soundboard.d.ts +64 -0
- package/lib/types/rest/soundboard.js +2 -0
- package/lib/types/rest/stageInstance.d.ts +1 -1
- package/lib/types/rest/template.d.ts +1 -1
- package/lib/types/rest/user.d.ts +1 -1
- package/lib/types/rest/webhook.d.ts +1 -1
- package/lib/types/utils/index.d.ts +11 -2
- package/lib/types/utils/index.js +10 -2
- package/lib/websocket/SharedTypes.d.ts +11 -2
- package/lib/websocket/constants/index.js +0 -10
- package/lib/websocket/discord/basesocket.d.ts +1 -1
- package/lib/websocket/discord/shard.d.ts +1 -1
- package/lib/websocket/discord/shard.js +25 -16
- package/lib/websocket/discord/sharder.d.ts +9 -6
- package/lib/websocket/discord/sharder.js +91 -74
- package/lib/websocket/discord/shared.d.ts +3 -14
- package/lib/websocket/discord/socket/custom.js +19 -6
- package/lib/websocket/discord/worker.d.ts +8 -2
- package/lib/websocket/discord/workermanager.d.ts +42 -17
- package/lib/websocket/discord/workermanager.js +144 -37
- package/lib/websocket/structures/timeout.d.ts +4 -5
- package/lib/websocket/structures/timeout.js +23 -24
- package/package.json +72 -70
- package/lib/cache/resources/threads.d.ts +0 -14
- package/lib/cache/resources/threads.js +0 -32
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MenuCommandContext = void 0;
|
|
4
|
-
const
|
|
4
|
+
const transformers_1 = require("../../client/transformers");
|
|
5
5
|
const common_1 = require("../../common");
|
|
6
|
+
const types_1 = require("../../types");
|
|
6
7
|
const basecontext_1 = require("../basecontext");
|
|
7
|
-
const transformers_1 = require("../../client/transformers");
|
|
8
8
|
class MenuCommandContext extends basecontext_1.BaseContext {
|
|
9
9
|
client;
|
|
10
10
|
interaction;
|
|
@@ -38,8 +38,8 @@ class MenuCommandContext extends basecontext_1.BaseContext {
|
|
|
38
38
|
get fullCommandName() {
|
|
39
39
|
return this.command.name;
|
|
40
40
|
}
|
|
41
|
-
write(body,
|
|
42
|
-
return this.interaction.write(body,
|
|
41
|
+
write(body, withResponse) {
|
|
42
|
+
return this.interaction.write(body, withResponse);
|
|
43
43
|
}
|
|
44
44
|
modal(body) {
|
|
45
45
|
return this.interaction.modal(body);
|
|
@@ -53,8 +53,8 @@ class MenuCommandContext extends basecontext_1.BaseContext {
|
|
|
53
53
|
deleteResponse() {
|
|
54
54
|
return this.interaction.deleteResponse();
|
|
55
55
|
}
|
|
56
|
-
editOrReply(body,
|
|
57
|
-
return this.interaction.editOrReply(body,
|
|
56
|
+
editOrReply(body, withResponse) {
|
|
57
|
+
return this.interaction.editOrReply(body, withResponse);
|
|
58
58
|
}
|
|
59
59
|
fetchResponse() {
|
|
60
60
|
return this.interaction.fetchResponse();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ApplicationCommandOptionType, type APIApplicationCommandOptionChoice, type ChannelType } from '../../types';
|
|
2
1
|
import type { AutocompleteCallback, EntryPointContext, MenuCommandContext, OnAutocompleteErrorCallback, ReturnOptionsTypes, __TypesWrapper } from '..';
|
|
2
|
+
import type { ModalContext } from '../../components';
|
|
3
|
+
import type { ComponentContext } from '../../components/componentcontext';
|
|
3
4
|
import type { MessageCommandInteraction, UserCommandInteraction } from '../../structures';
|
|
5
|
+
import { type APIApplicationCommandOptionChoice, ApplicationCommandOptionType, type ChannelType } from '../../types';
|
|
4
6
|
import type { CommandContext } from './chatcontext';
|
|
5
7
|
import type { MiddlewareContext } from './shared';
|
|
6
|
-
|
|
7
|
-
import type { ComponentContext } from '../../components/componentcontext';
|
|
8
|
-
export type SeyfertBasicOption<T extends keyof __TypesWrapper, D = {}> = __TypesWrapper[T] & D;
|
|
8
|
+
export type SeyfertBasicOption<T extends keyof __TypesWrapper, D = object> = __TypesWrapper[T] & D;
|
|
9
9
|
export type SeyfertStringOption = SeyfertBasicOption<'String'> & {
|
|
10
10
|
autocomplete?: AutocompleteCallback;
|
|
11
11
|
onAutocompleteError?: OnAutocompleteErrorCallback;
|
|
@@ -20,6 +20,9 @@ export interface ExtraProps {
|
|
|
20
20
|
export interface UsingClient extends BaseClient {
|
|
21
21
|
}
|
|
22
22
|
export type ParseClient<T extends BaseClient> = T;
|
|
23
|
+
export type ParseGlobalMiddlewares<T extends Record<string, MiddlewareContext>> = {
|
|
24
|
+
[K in keyof T]: MetadataMiddleware<T[K]>;
|
|
25
|
+
};
|
|
23
26
|
export interface InternalOptions {
|
|
24
27
|
}
|
|
25
28
|
export interface CustomStructures {
|
|
@@ -34,9 +37,9 @@ export type MetadataMiddleware<T extends MiddlewareContext> = IsStrictlyUndefine
|
|
|
34
37
|
export type CommandMetadata<T extends readonly (keyof RegisteredMiddlewares)[]> = T extends readonly [
|
|
35
38
|
infer first,
|
|
36
39
|
...infer rest
|
|
37
|
-
] ? first extends keyof RegisteredMiddlewares ? (MetadataMiddleware<RegisteredMiddlewares[first]> extends never ?
|
|
40
|
+
] ? first extends keyof RegisteredMiddlewares ? (MetadataMiddleware<RegisteredMiddlewares[first]> extends never ? never : {
|
|
38
41
|
[key in first]: MetadataMiddleware<RegisteredMiddlewares[first]>;
|
|
39
|
-
}) & (rest extends readonly (keyof RegisteredMiddlewares)[] ? CommandMetadata<rest> :
|
|
42
|
+
}) & (rest extends readonly (keyof RegisteredMiddlewares)[] ? CommandMetadata<rest> : never) : never : never;
|
|
40
43
|
export type MessageCommandOptionErrors = ['CHANNEL_TYPES', type: ChannelType[]] | ['STRING_MIN_LENGTH', min: number] | ['STRING_MAX_LENGTH', max: number] | ['STRING_INVALID_CHOICE', choices: readonly {
|
|
41
44
|
name: string;
|
|
42
45
|
value: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ModalContext } from '../components';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ComponentContext, ContextComponentCommandInteractionMap } from '../components/componentcontext';
|
|
3
3
|
import type { MessageCommandInteraction, UserCommandInteraction } from '../structures';
|
|
4
4
|
import type { CommandContext } from './applications/chatcontext';
|
|
5
5
|
import type { MenuCommandContext } from './applications/menucontext';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ApplicationCommandType, ApplicationIntegrationType, type EntryPointCommandHandlerType, InteractionContextType, type LocaleString } from '../types';
|
|
2
1
|
import type { FlatObjectKeys, PermissionStrings } from '../common';
|
|
2
|
+
import { ApplicationCommandType, ApplicationIntegrationType, type EntryPointCommandHandlerType, InteractionContextType, type LocaleString } from '../types';
|
|
3
3
|
import type { CommandOption, OptionsRecord, SubCommand } from './applications/chat';
|
|
4
4
|
import type { DefaultLocale, ExtraProps, IgnoreCommand, MiddlewareContext } from './applications/shared';
|
|
5
5
|
export interface RegisteredMiddlewares {
|
|
@@ -27,7 +27,7 @@ export declare function Locales({ name: names, description: descriptions, }: {
|
|
|
27
27
|
name?: [language: LocaleString, value: string][];
|
|
28
28
|
description?: [language: LocaleString, value: string][];
|
|
29
29
|
}): <T extends {
|
|
30
|
-
new (...args: any[]):
|
|
30
|
+
new (...args: any[]): object;
|
|
31
31
|
}>(target: T) => {
|
|
32
32
|
new (...args: any[]): {
|
|
33
33
|
name_localizations: {
|
|
@@ -39,7 +39,7 @@ export declare function Locales({ name: names, description: descriptions, }: {
|
|
|
39
39
|
};
|
|
40
40
|
} & T;
|
|
41
41
|
export declare function LocalesT(name?: FlatObjectKeys<DefaultLocale>, description?: FlatObjectKeys<DefaultLocale>): <T extends {
|
|
42
|
-
new (...args: any[]):
|
|
42
|
+
new (...args: any[]): object;
|
|
43
43
|
}>(target: T) => {
|
|
44
44
|
new (...args: any[]): {
|
|
45
45
|
__t: {
|
|
@@ -54,7 +54,7 @@ export declare function GroupsT(groups: Record<string, {
|
|
|
54
54
|
defaultDescription: string;
|
|
55
55
|
aliases?: string[];
|
|
56
56
|
}>): <T extends {
|
|
57
|
-
new (...args: any[]):
|
|
57
|
+
new (...args: any[]): object;
|
|
58
58
|
}>(target: T) => {
|
|
59
59
|
new (...args: any[]): {
|
|
60
60
|
__tGroups: Record<string, {
|
|
@@ -72,7 +72,7 @@ export declare function Groups(groups: Record<string, {
|
|
|
72
72
|
defaultDescription: string;
|
|
73
73
|
aliases?: string[];
|
|
74
74
|
}>): <T extends {
|
|
75
|
-
new (...args: any[]):
|
|
75
|
+
new (...args: any[]): object;
|
|
76
76
|
}>(target: T) => {
|
|
77
77
|
new (...args: any[]): {
|
|
78
78
|
groups: Record<string, {
|
|
@@ -85,21 +85,21 @@ export declare function Groups(groups: Record<string, {
|
|
|
85
85
|
};
|
|
86
86
|
} & T;
|
|
87
87
|
export declare function Group(groupName: string): <T extends {
|
|
88
|
-
new (...args: any[]):
|
|
88
|
+
new (...args: any[]): object;
|
|
89
89
|
}>(target: T) => {
|
|
90
90
|
new (...args: any[]): {
|
|
91
91
|
group: string;
|
|
92
92
|
};
|
|
93
93
|
} & T;
|
|
94
94
|
export declare function Options(options: (new () => SubCommand)[] | OptionsRecord): <T extends {
|
|
95
|
-
new (...args: any[]):
|
|
95
|
+
new (...args: any[]): object;
|
|
96
96
|
}>(target: T) => {
|
|
97
97
|
new (...args: any[]): {
|
|
98
98
|
options: SubCommand[] | CommandOption[];
|
|
99
99
|
};
|
|
100
100
|
} & T;
|
|
101
101
|
export declare function AutoLoad(): <T extends {
|
|
102
|
-
new (...args: any[]):
|
|
102
|
+
new (...args: any[]): object;
|
|
103
103
|
}>(target: T) => {
|
|
104
104
|
new (...args: any[]): {
|
|
105
105
|
__autoload: boolean;
|
|
@@ -109,14 +109,14 @@ export type ParseMiddlewares<T extends Record<string, MiddlewareContext>> = {
|
|
|
109
109
|
[k in keyof T]: T[k];
|
|
110
110
|
};
|
|
111
111
|
export declare function Middlewares(cbs: readonly (keyof RegisteredMiddlewares)[]): <T extends {
|
|
112
|
-
new (...args: any[]):
|
|
112
|
+
new (...args: any[]): object;
|
|
113
113
|
}>(target: T) => {
|
|
114
114
|
new (...args: any[]): {
|
|
115
115
|
middlewares: readonly never[];
|
|
116
116
|
};
|
|
117
117
|
} & T;
|
|
118
118
|
export declare function Declare(declare: CommandDeclareOptions): <T extends {
|
|
119
|
-
new (...args: any[]):
|
|
119
|
+
new (...args: any[]): object;
|
|
120
120
|
}>(target: T) => {
|
|
121
121
|
new (...args: any[]): {
|
|
122
122
|
name: string;
|
|
@@ -9,6 +9,7 @@ exports.Options = Options;
|
|
|
9
9
|
exports.AutoLoad = AutoLoad;
|
|
10
10
|
exports.Middlewares = Middlewares;
|
|
11
11
|
exports.Declare = Declare;
|
|
12
|
+
const Permissions_1 = require("../structures/extra/Permissions");
|
|
12
13
|
const types_1 = require("../types");
|
|
13
14
|
function Locales({ name: names, description: descriptions, }) {
|
|
14
15
|
return (target) => class extends target {
|
|
@@ -86,11 +87,11 @@ function Declare(declare) {
|
|
|
86
87
|
integrationTypes = declare.integrationTypes?.map(i => types_1.ApplicationIntegrationType[i]) ?? [
|
|
87
88
|
types_1.ApplicationIntegrationType.GuildInstall,
|
|
88
89
|
];
|
|
89
|
-
defaultMemberPermissions =
|
|
90
|
-
? declare.defaultMemberPermissions
|
|
90
|
+
defaultMemberPermissions = declare.defaultMemberPermissions
|
|
91
|
+
? Permissions_1.PermissionsBitField.resolve(declare.defaultMemberPermissions)
|
|
91
92
|
: declare.defaultMemberPermissions;
|
|
92
|
-
botPermissions =
|
|
93
|
-
? declare.botPermissions
|
|
93
|
+
botPermissions = declare.botPermissions
|
|
94
|
+
? Permissions_1.PermissionsBitField.resolve(declare.botPermissions)
|
|
94
95
|
: declare.botPermissions;
|
|
95
96
|
description = '';
|
|
96
97
|
type = types_1.ApplicationCommandType.ChatInput;
|
package/lib/commands/handle.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import {
|
|
3
|
-
import { AutocompleteInteraction, type ComponentInteraction, type ModalSubmitInteraction, type ChatInputCommandInteraction, type MessageCommandInteraction, type UserCommandInteraction, type __InternalReplyFunction, type EntryPointInteraction } from '../structures';
|
|
4
|
-
import type { PermissionsBitField } from '../structures/extra/Permissions';
|
|
1
|
+
import { Command, type CommandAutocompleteOption, CommandContext, type CommandOption, type ContextMenuCommand, type ContextOptionsResolved, type EntryPointCommand, EntryPointContext, MenuCommandContext, type MessageCommandOptionErrors, SubCommand, type UsingClient } from '.';
|
|
2
|
+
import { type MessageStructure, type OptionResolverStructure, Transformers } from '../client/transformers';
|
|
5
3
|
import type { MakeRequired } from '../common';
|
|
6
|
-
import { type
|
|
4
|
+
import { AutocompleteInteraction, type ChatInputCommandInteraction, type ComponentInteraction, type EntryPointInteraction, type MessageCommandInteraction, type ModalSubmitInteraction, type UserCommandInteraction, type __InternalReplyFunction } from '../structures';
|
|
5
|
+
import type { PermissionsBitField } from '../structures/extra/Permissions';
|
|
6
|
+
import { type APIApplicationCommandInteraction, type APIApplicationCommandInteractionDataOption, type APIInteraction, ApplicationCommandOptionType, type GatewayMessageCreateDispatchData } from '../types';
|
|
7
7
|
export type CommandOptionWithType = CommandOption & {
|
|
8
8
|
type: ApplicationCommandOptionType;
|
|
9
9
|
};
|
|
@@ -36,10 +36,10 @@ export declare class HandleCommand {
|
|
|
36
36
|
name: string;
|
|
37
37
|
}): T | undefined;
|
|
38
38
|
checkPermissions(app: PermissionsBitField, bot: bigint): import("../common").PermissionStrings | undefined;
|
|
39
|
-
fetchChannel(_option: CommandOptionWithType, query: string): Promise<import("../types").APIChannel | null
|
|
40
|
-
fetchUser(_option: CommandOptionWithType, query: string): Promise<import("../types").APIUser | null
|
|
41
|
-
fetchMember(_option: CommandOptionWithType, query: string, guildId: string): Promise<import("../types").APIGuildMember | null
|
|
42
|
-
fetchRole(_option: CommandOptionWithType, query: string, guildId?: string): Promise<import("../types").APIRole | null
|
|
39
|
+
fetchChannel(_option: CommandOptionWithType, query: string): Promise<import("../types").APIChannel> | null;
|
|
40
|
+
fetchUser(_option: CommandOptionWithType, query: string): Promise<import("../types").APIUser> | null;
|
|
41
|
+
fetchMember(_option: CommandOptionWithType, query: string, guildId: string): Promise<import("../types").APIGuildMember> | null;
|
|
42
|
+
fetchRole(_option: CommandOptionWithType, query: string, guildId?: string): Promise<import("../types").APIRole> | null;
|
|
43
43
|
runGlobalMiddlewares(command: Command | ContextMenuCommand | SubCommand | EntryPointCommand, context: CommandContext<{}, never> | MenuCommandContext<any> | EntryPointContext): Promise<false | {
|
|
44
44
|
error?: string;
|
|
45
45
|
pass?: boolean;
|
package/lib/commands/handle.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HandleCommand = void 0;
|
|
4
|
-
const types_1 = require("../types");
|
|
5
4
|
const _1 = require(".");
|
|
6
|
-
const structures_1 = require("../structures");
|
|
7
|
-
const components_1 = require("../components");
|
|
8
5
|
const transformers_1 = require("../client/transformers");
|
|
6
|
+
const components_1 = require("../components");
|
|
7
|
+
const structures_1 = require("../structures");
|
|
8
|
+
const types_1 = require("../types");
|
|
9
9
|
class HandleCommand {
|
|
10
10
|
client;
|
|
11
11
|
constructor(client) {
|
|
@@ -40,7 +40,7 @@ class HandleCommand {
|
|
|
40
40
|
return this.contextMenuUser(command, interaction, context);
|
|
41
41
|
}
|
|
42
42
|
async contextMenuUser(command, interaction, context) {
|
|
43
|
-
if (command.botPermissions && interaction.appPermissions) {
|
|
43
|
+
if (context.guildId && command.botPermissions && interaction.appPermissions) {
|
|
44
44
|
const permissions = this.checkPermissions(interaction.appPermissions, command.botPermissions);
|
|
45
45
|
if (permissions)
|
|
46
46
|
return command.onBotPermissionsFail(context, permissions);
|
|
@@ -71,10 +71,10 @@ class HandleCommand {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
async entryPoint(command, interaction, context) {
|
|
74
|
-
if (command.botPermissions && interaction.appPermissions) {
|
|
74
|
+
if (context.guildId && command.botPermissions && interaction.appPermissions) {
|
|
75
75
|
const permissions = this.checkPermissions(interaction.appPermissions, command.botPermissions);
|
|
76
76
|
if (permissions)
|
|
77
|
-
return command.onBotPermissionsFail
|
|
77
|
+
return command.onBotPermissionsFail(context, permissions);
|
|
78
78
|
}
|
|
79
79
|
const resultGlobal = await this.runGlobalMiddlewares(command, context);
|
|
80
80
|
if (typeof resultGlobal === 'boolean')
|
|
@@ -102,10 +102,17 @@ class HandleCommand {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
async chatInput(command, interaction, resolver, context) {
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
if (context.guildId && interaction.appPermissions) {
|
|
106
|
+
if (command.botPermissions) {
|
|
107
|
+
const permissions = this.checkPermissions(interaction.appPermissions, command.botPermissions);
|
|
108
|
+
if (permissions)
|
|
109
|
+
return command.onBotPermissionsFail?.(context, permissions);
|
|
110
|
+
}
|
|
111
|
+
if (command.defaultMemberPermissions) {
|
|
112
|
+
const permissions = this.checkPermissions(interaction.member.permissions, command.defaultMemberPermissions);
|
|
113
|
+
if (permissions)
|
|
114
|
+
return command.onPermissionsFail?.(context, permissions);
|
|
115
|
+
}
|
|
109
116
|
}
|
|
110
117
|
if (!(await this.runOptions(command, context, resolver)))
|
|
111
118
|
return;
|
|
@@ -164,8 +171,9 @@ class HandleCommand {
|
|
|
164
171
|
const data = this.makeMenuCommand(body, shardId, __reply);
|
|
165
172
|
if (!data)
|
|
166
173
|
return;
|
|
174
|
+
this.contextMenuMessage(data.command,
|
|
167
175
|
// @ts-expect-error
|
|
168
|
-
|
|
176
|
+
data.interaction, data.context);
|
|
169
177
|
break;
|
|
170
178
|
}
|
|
171
179
|
case types_1.ApplicationCommandType.User: {
|
|
@@ -285,7 +293,7 @@ class HandleCommand {
|
|
|
285
293
|
if (command.botPermissions) {
|
|
286
294
|
const appPermissions = await self.members.permissions(rawMessage.guild_id, self.botId);
|
|
287
295
|
const permissions = this.checkPermissions(appPermissions, command.botPermissions);
|
|
288
|
-
if (
|
|
296
|
+
if (permissions) {
|
|
289
297
|
return command.onBotPermissionsFail?.(context, permissions);
|
|
290
298
|
}
|
|
291
299
|
}
|
|
@@ -311,7 +319,9 @@ class HandleCommand {
|
|
|
311
319
|
try {
|
|
312
320
|
await command.onInternalError?.(this.client, command, error);
|
|
313
321
|
}
|
|
314
|
-
catch {
|
|
322
|
+
catch {
|
|
323
|
+
// http 418
|
|
324
|
+
}
|
|
315
325
|
}
|
|
316
326
|
}
|
|
317
327
|
argsParser(content, _command, _message) {
|
|
@@ -387,34 +397,36 @@ class HandleCommand {
|
|
|
387
397
|
});
|
|
388
398
|
}
|
|
389
399
|
checkPermissions(app, bot) {
|
|
400
|
+
if (app.has('Administrator'))
|
|
401
|
+
return;
|
|
390
402
|
const permissions = app.missings(...app.values([bot]));
|
|
391
|
-
if (
|
|
403
|
+
if (permissions.length) {
|
|
392
404
|
return app.keys(permissions);
|
|
393
405
|
}
|
|
394
406
|
return;
|
|
395
407
|
}
|
|
396
|
-
|
|
408
|
+
fetchChannel(_option, query) {
|
|
397
409
|
const id = query.match(/[0-9]{17,19}/g)?.[0];
|
|
398
410
|
if (id)
|
|
399
411
|
return this.client.channels.raw(id);
|
|
400
412
|
return null;
|
|
401
413
|
}
|
|
402
|
-
|
|
414
|
+
fetchUser(_option, query) {
|
|
403
415
|
const id = query.match(/[0-9]{17,19}/g)?.[0];
|
|
404
416
|
if (id)
|
|
405
417
|
return this.client.users.raw(id);
|
|
406
418
|
return null;
|
|
407
419
|
}
|
|
408
|
-
|
|
420
|
+
fetchMember(_option, query, guildId) {
|
|
409
421
|
const id = query.match(/[0-9]{17,19}/g)?.[0];
|
|
410
422
|
if (id)
|
|
411
423
|
return this.client.members.raw(guildId, id);
|
|
412
424
|
return null;
|
|
413
425
|
}
|
|
414
|
-
|
|
426
|
+
fetchRole(_option, query, guildId) {
|
|
415
427
|
const id = query.match(/[0-9]{17,19}/g)?.[0];
|
|
416
428
|
if (id && guildId)
|
|
417
|
-
return
|
|
429
|
+
return this.client.roles.raw(guildId, id);
|
|
418
430
|
return null;
|
|
419
431
|
}
|
|
420
432
|
async runGlobalMiddlewares(command, context) {
|
|
@@ -433,7 +445,9 @@ class HandleCommand {
|
|
|
433
445
|
try {
|
|
434
446
|
await command.onInternalError?.(this.client, command, e);
|
|
435
447
|
}
|
|
436
|
-
catch {
|
|
448
|
+
catch {
|
|
449
|
+
// http 418
|
|
450
|
+
}
|
|
437
451
|
}
|
|
438
452
|
return false;
|
|
439
453
|
}
|
|
@@ -453,7 +467,9 @@ class HandleCommand {
|
|
|
453
467
|
try {
|
|
454
468
|
await command.onInternalError?.(this.client, command, e);
|
|
455
469
|
}
|
|
456
|
-
catch {
|
|
470
|
+
catch {
|
|
471
|
+
// http 418
|
|
472
|
+
}
|
|
457
473
|
}
|
|
458
474
|
return false;
|
|
459
475
|
}
|
|
@@ -478,7 +494,9 @@ class HandleCommand {
|
|
|
478
494
|
try {
|
|
479
495
|
await command.onInternalError?.(this.client, command, e);
|
|
480
496
|
}
|
|
481
|
-
catch {
|
|
497
|
+
catch {
|
|
498
|
+
// http 418
|
|
499
|
+
}
|
|
482
500
|
}
|
|
483
501
|
return false;
|
|
484
502
|
}
|
|
@@ -513,13 +531,14 @@ class HandleCommand {
|
|
|
513
531
|
if (channel) {
|
|
514
532
|
if ('channel_types' in i) {
|
|
515
533
|
if (!i.channel_types.includes(channel.type)) {
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
534
|
+
if (i.required)
|
|
535
|
+
errors.push({
|
|
536
|
+
name: i.name,
|
|
537
|
+
error: `The entered channel type is not one of ${i
|
|
538
|
+
.channel_types.map(t => types_1.ChannelType[t])
|
|
539
|
+
.join(', ')}`,
|
|
540
|
+
fullError: ['CHANNEL_TYPES', i.channel_types],
|
|
541
|
+
});
|
|
523
542
|
break;
|
|
524
543
|
}
|
|
525
544
|
}
|
|
@@ -601,22 +620,24 @@ class HandleCommand {
|
|
|
601
620
|
if (option.min_length) {
|
|
602
621
|
if (value.length < option.min_length) {
|
|
603
622
|
value = undefined;
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
623
|
+
if (i.required)
|
|
624
|
+
errors.push({
|
|
625
|
+
name: i.name,
|
|
626
|
+
error: `The entered string has less than ${option.min_length} characters. The minimum required is ${option.min_length} characters.`,
|
|
627
|
+
fullError: ['STRING_MIN_LENGTH', option.min_length],
|
|
628
|
+
});
|
|
609
629
|
break;
|
|
610
630
|
}
|
|
611
631
|
}
|
|
612
632
|
if (option.max_length) {
|
|
613
633
|
if (value.length > option.max_length) {
|
|
614
634
|
value = undefined;
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
635
|
+
if (i.required)
|
|
636
|
+
errors.push({
|
|
637
|
+
name: i.name,
|
|
638
|
+
error: `The entered string has more than ${option.max_length} characters. The maximum required is ${option.max_length} characters.`,
|
|
639
|
+
fullError: ['STRING_MAX_LENGTH', option.max_length],
|
|
640
|
+
});
|
|
620
641
|
break;
|
|
621
642
|
}
|
|
622
643
|
}
|
|
@@ -624,13 +645,14 @@ class HandleCommand {
|
|
|
624
645
|
const choice = option.choices.find(x => x.name === value);
|
|
625
646
|
if (!choice) {
|
|
626
647
|
value = undefined;
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
.
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
648
|
+
if (i.required)
|
|
649
|
+
errors.push({
|
|
650
|
+
name: i.name,
|
|
651
|
+
error: `The entered choice is invalid. Please choose one of the following options: ${option.choices
|
|
652
|
+
.map(x => x.name)
|
|
653
|
+
.join(', ')}.`,
|
|
654
|
+
fullError: ['STRING_INVALID_CHOICE', option.choices],
|
|
655
|
+
});
|
|
634
656
|
break;
|
|
635
657
|
}
|
|
636
658
|
value = choice.value;
|
|
@@ -649,32 +671,35 @@ class HandleCommand {
|
|
|
649
671
|
}
|
|
650
672
|
if (Number.isNaN(value)) {
|
|
651
673
|
value = undefined;
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
674
|
+
if (i.required)
|
|
675
|
+
errors.push({
|
|
676
|
+
name: i.name,
|
|
677
|
+
error: 'The entered choice is an invalid number.',
|
|
678
|
+
fullError: ['NUMBER_NAN', args[i.name]],
|
|
679
|
+
});
|
|
657
680
|
break;
|
|
658
681
|
}
|
|
659
682
|
if (option.min_value) {
|
|
660
683
|
if (value < option.min_value) {
|
|
661
684
|
value = undefined;
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
685
|
+
if (i.required)
|
|
686
|
+
errors.push({
|
|
687
|
+
name: i.name,
|
|
688
|
+
error: `The entered number is less than ${option.min_value}. The minimum allowed is ${option.min_value}`,
|
|
689
|
+
fullError: ['NUMBER_MIN_VALUE', option.min_value],
|
|
690
|
+
});
|
|
667
691
|
break;
|
|
668
692
|
}
|
|
669
693
|
}
|
|
670
694
|
if (option.max_value) {
|
|
671
695
|
if (value > option.max_value) {
|
|
672
696
|
value = undefined;
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
697
|
+
if (i.required)
|
|
698
|
+
errors.push({
|
|
699
|
+
name: i.name,
|
|
700
|
+
error: `The entered number is greater than ${option.max_value}. The maximum allowed is ${option.max_value}`,
|
|
701
|
+
fullError: ['NUMBER_MAX_VALUE', option.max_value],
|
|
702
|
+
});
|
|
678
703
|
break;
|
|
679
704
|
}
|
|
680
705
|
}
|
|
@@ -683,13 +708,14 @@ class HandleCommand {
|
|
|
683
708
|
const choice = option.choices.find(x => x.name === args[i.name]);
|
|
684
709
|
if (!choice) {
|
|
685
710
|
value = undefined;
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
.
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
711
|
+
if (i.required)
|
|
712
|
+
errors.push({
|
|
713
|
+
name: i.name,
|
|
714
|
+
error: `The entered choice is invalid. Please choose one of the following options: ${option.choices
|
|
715
|
+
.map(x => x.name)
|
|
716
|
+
.join(', ')}.`,
|
|
717
|
+
fullError: ['NUMBER_INVALID_CHOICE', option.choices],
|
|
718
|
+
});
|
|
693
719
|
break;
|
|
694
720
|
}
|
|
695
721
|
value = choice.value;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { EntryPointCommand } from '.';
|
|
2
2
|
import type { Logger, MakeRequired, NulleableCoalising, OmitInsert } from '../common';
|
|
3
3
|
import { BaseHandler } from '../common';
|
|
4
|
+
import { type APIApplicationCommandOption, type LocalizationMap } from '../types';
|
|
4
5
|
import { Command, type CommandOption, SubCommand } from './applications/chat';
|
|
5
6
|
import { ContextMenuCommand } from './applications/menu';
|
|
6
7
|
import type { UsingClient } from './applications/shared';
|
|
7
|
-
import type { EntryPointCommand } from '.';
|
|
8
8
|
export declare class CommandHandler extends BaseHandler {
|
|
9
9
|
protected logger: Logger;
|
|
10
10
|
protected client: UsingClient;
|
|
11
11
|
values: (Command | ContextMenuCommand)[];
|
|
12
12
|
entryPoint: EntryPointCommand | null;
|
|
13
|
-
|
|
13
|
+
filter: (path: string) => boolean;
|
|
14
14
|
constructor(logger: Logger, client: UsingClient);
|
|
15
15
|
reload(resolve: string | Command): Promise<void>;
|
|
16
16
|
reloadAll(stopIfFail?: boolean): Promise<void>;
|
|
17
17
|
protected shouldUploadLocales(locales?: LocalizationMap | null, cachedLocales?: LocalizationMap | null): boolean;
|
|
18
|
-
protected shouldUploadOption(option: APIApplicationCommandOption, cached: APIApplicationCommandOption): boolean
|
|
18
|
+
protected shouldUploadOption(option: APIApplicationCommandOption, cached: APIApplicationCommandOption): boolean;
|
|
19
19
|
shouldUpload(file: string, guildId?: string): Promise<boolean>;
|
|
20
20
|
set(commands: SeteableCommand[]): void;
|
|
21
21
|
load(commandsDir: string, client: UsingClient): Promise<(Command | ContextMenuCommand)[]>;
|
|
22
|
-
parseLocales(command: InstanceType<HandleableCommand>): Command | ContextMenuCommand |
|
|
22
|
+
parseLocales(command: InstanceType<HandleableCommand>): Command | ContextMenuCommand | SubCommand | EntryPointCommand;
|
|
23
23
|
parseGlobalLocales(command: InstanceType<HandleableCommand>): void;
|
|
24
24
|
parseCommandOptionLocales(option: MakeRequired<CommandOption, 'locales'>): void;
|
|
25
25
|
parseCommandLocales(command: Command): void;
|
package/lib/commands/handler.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CommandHandler = void 0;
|
|
4
|
-
const
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
5
|
const node_path_1 = require("node:path");
|
|
6
6
|
const common_1 = require("../common");
|
|
7
|
+
const Permissions_1 = require("../structures/extra/Permissions");
|
|
8
|
+
const types_1 = require("../types");
|
|
7
9
|
const chat_1 = require("./applications/chat");
|
|
8
10
|
const menu_1 = require("./applications/menu");
|
|
9
|
-
const node_fs_1 = require("node:fs");
|
|
10
11
|
class CommandHandler extends common_1.BaseHandler {
|
|
11
12
|
logger;
|
|
12
13
|
client;
|
|
@@ -89,22 +90,25 @@ class CommandHandler extends common_1.BaseHandler {
|
|
|
89
90
|
return option.channel_types.some(ct => !cached.channel_types.includes(ct));
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
|
-
|
|
93
|
+
break;
|
|
93
94
|
case types_1.ApplicationCommandOptionType.Subcommand:
|
|
94
95
|
case types_1.ApplicationCommandOptionType.SubcommandGroup:
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
cached.options)
|
|
101
|
-
for (const i of option.options) {
|
|
102
|
-
const cachedOption = cached.options.find(x => x.name === i.name);
|
|
103
|
-
if (!cachedOption)
|
|
104
|
-
return true;
|
|
105
|
-
if (this.shouldUploadOption(i, cachedOption))
|
|
106
|
-
return true;
|
|
96
|
+
{
|
|
97
|
+
if (option.options?.length !==
|
|
98
|
+
cached.options
|
|
99
|
+
?.length) {
|
|
100
|
+
return true;
|
|
107
101
|
}
|
|
102
|
+
if (option.options &&
|
|
103
|
+
cached.options)
|
|
104
|
+
for (const i of option.options) {
|
|
105
|
+
const cachedOption = cached.options.find(x => x.name === i.name);
|
|
106
|
+
if (!cachedOption)
|
|
107
|
+
return true;
|
|
108
|
+
if (this.shouldUploadOption(i, cachedOption))
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
108
112
|
break;
|
|
109
113
|
case types_1.ApplicationCommandOptionType.Integer:
|
|
110
114
|
case types_1.ApplicationCommandOptionType.Number:
|
|
@@ -470,8 +474,8 @@ class CommandHandler extends common_1.BaseHandler {
|
|
|
470
474
|
option.onPermissionsFail?.bind(option) ??
|
|
471
475
|
commandInstance.onPermissionsFail?.bind(commandInstance) ??
|
|
472
476
|
this.client.options.commands?.defaults?.onPermissionsFail;
|
|
473
|
-
option.botPermissions
|
|
474
|
-
option.defaultMemberPermissions ??= commandInstance.defaultMemberPermissions;
|
|
477
|
+
option.botPermissions = new Permissions_1.PermissionsBitField().add(option.botPermissions ?? Permissions_1.PermissionsBitField.None, commandInstance.botPermissions);
|
|
478
|
+
option.defaultMemberPermissions ??= new Permissions_1.PermissionsBitField().add(option.defaultMemberPermissions ?? Permissions_1.PermissionsBitField.None, commandInstance.defaultMemberPermissions);
|
|
475
479
|
option.contexts ??= commandInstance.contexts;
|
|
476
480
|
option.integrationTypes ??= commandInstance.integrationTypes;
|
|
477
481
|
option.props ??= commandInstance.props;
|