seyfert 4.4.1 → 5.0.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/README.md +7 -1
- package/lib/api/Routes/cdn.d.ts +2 -2
- package/lib/api/Routes/guilds.d.ts +2 -2
- package/lib/api/Routes/invites.d.ts +2 -2
- package/lib/api/api.d.ts +20 -8
- package/lib/api/api.js +198 -44
- package/lib/api/shared.d.ts +30 -1
- package/lib/api/utils/constants.d.ts +1 -1
- package/lib/api/utils/constants.js +1 -1
- package/lib/api/utils/utils.d.ts +2 -1
- package/lib/api/utils/utils.js +1 -1
- package/lib/builders/Attachment.d.ts +1 -1
- package/lib/builders/Attachment.js +30 -8
- package/lib/builders/MediaGallery.d.ts +2 -2
- package/lib/builders/MediaGallery.js +10 -0
- package/lib/builders/Modal.d.ts +18 -8
- package/lib/builders/Modal.js +36 -7
- package/lib/builders/Poll.js +18 -0
- package/lib/builders/RadioGroup.d.ts +4 -3
- package/lib/builders/RadioGroup.js +24 -3
- package/lib/builders/SelectMenu.d.ts +8 -6
- package/lib/builders/SelectMenu.js +24 -3
- package/lib/builders/types.d.ts +3 -2
- package/lib/cache/adapters/default.d.ts +1 -1
- package/lib/cache/adapters/default.js +23 -26
- package/lib/cache/adapters/limited.d.ts +1 -0
- package/lib/cache/adapters/limited.js +47 -33
- package/lib/cache/index.d.ts +19 -25
- package/lib/cache/index.js +58 -6
- package/lib/cache/resources/bans.d.ts +1 -1
- package/lib/cache/resources/bans.js +4 -4
- package/lib/cache/resources/channels.d.ts +1 -1
- package/lib/cache/resources/channels.js +4 -4
- package/lib/cache/resources/default/base.d.ts +1 -1
- package/lib/cache/resources/default/base.js +8 -8
- package/lib/cache/resources/default/guild-based.d.ts +5 -5
- package/lib/cache/resources/default/guild-based.js +29 -16
- package/lib/cache/resources/default/guild-related.d.ts +5 -5
- package/lib/cache/resources/default/guild-related.js +14 -14
- package/lib/cache/resources/emojis.d.ts +1 -1
- package/lib/cache/resources/emojis.js +4 -4
- package/lib/cache/resources/guilds.js +28 -15
- package/lib/cache/resources/members.d.ts +1 -1
- package/lib/cache/resources/members.js +6 -6
- package/lib/cache/resources/messages.d.ts +7 -2
- package/lib/cache/resources/messages.js +43 -20
- package/lib/cache/resources/overwrites.d.ts +1 -1
- package/lib/cache/resources/overwrites.js +5 -8
- package/lib/cache/resources/roles.d.ts +1 -1
- package/lib/cache/resources/roles.js +4 -4
- package/lib/cache/resources/stickers.d.ts +1 -1
- package/lib/cache/resources/stickers.js +4 -4
- package/lib/cache/resources/users.js +4 -4
- package/lib/cache/resources/voice-states.d.ts +1 -1
- package/lib/cache/resources/voice-states.js +4 -4
- package/lib/client/base.d.ts +83 -24
- package/lib/client/base.js +594 -39
- package/lib/client/client.d.ts +29 -4
- package/lib/client/client.js +38 -13
- package/lib/client/collectors.d.ts +9 -8
- package/lib/client/collectors.js +19 -52
- package/lib/client/httpclient.d.ts +3 -0
- package/lib/client/index.d.ts +3 -1
- package/lib/client/index.js +4 -0
- package/lib/client/intents.d.ts +3 -0
- package/lib/client/intents.js +9 -0
- package/lib/client/plugins/api.d.ts +4 -0
- package/lib/client/plugins/api.js +550 -0
- package/lib/client/plugins/errors.d.ts +25 -0
- package/lib/client/plugins/errors.js +79 -0
- package/lib/client/plugins/order.d.ts +10 -0
- package/lib/client/plugins/order.js +32 -0
- package/lib/client/plugins/registry.d.ts +273 -0
- package/lib/client/plugins/registry.js +868 -0
- package/lib/client/plugins/shared.d.ts +23 -0
- package/lib/client/plugins/shared.js +193 -0
- package/lib/client/plugins/types.d.ts +398 -0
- package/lib/client/plugins/types.js +8 -0
- package/lib/client/plugins.d.ts +78 -0
- package/lib/client/plugins.js +558 -0
- package/lib/client/transformers.d.ts +33 -33
- package/lib/client/workerclient.d.ts +11 -2
- package/lib/client/workerclient.js +33 -22
- package/lib/collection.d.ts +10 -8
- package/lib/collection.js +19 -25
- package/lib/commands/applications/chat.d.ts +20 -18
- package/lib/commands/applications/chat.js +39 -14
- package/lib/commands/applications/chatcontext.d.ts +23 -15
- package/lib/commands/applications/chatcontext.js +23 -2
- package/lib/commands/applications/entryPoint.d.ts +4 -3
- package/lib/commands/applications/entryPoint.js +1 -1
- package/lib/commands/applications/entrycontext.d.ts +7 -9
- package/lib/commands/applications/entrycontext.js +3 -1
- package/lib/commands/applications/menu.d.ts +4 -3
- package/lib/commands/applications/menucontext.d.ts +7 -9
- package/lib/commands/applications/menucontext.js +3 -1
- package/lib/commands/applications/options.d.ts +23 -23
- package/lib/commands/applications/shared.d.ts +39 -17
- package/lib/commands/decorators.d.ts +50 -38
- package/lib/commands/decorators.js +15 -5
- package/lib/commands/handle.d.ts +19 -8
- package/lib/commands/handle.js +224 -143
- package/lib/commands/handler.d.ts +21 -8
- package/lib/commands/handler.js +157 -69
- package/lib/commands/index.d.ts +1 -0
- package/lib/commands/optionresolver.d.ts +2 -2
- package/lib/common/it/colors.js +12 -2
- package/lib/common/it/error.d.ts +9 -0
- package/lib/common/it/error.js +8 -0
- package/lib/common/it/fake-promise.d.ts +4 -0
- package/lib/common/it/fake-promise.js +10 -0
- package/lib/common/it/formatter.d.ts +14 -11
- package/lib/common/it/formatter.js +4 -3
- package/lib/common/it/logger.d.ts +7 -1
- package/lib/common/it/logger.js +24 -6
- package/lib/common/it/utils.d.ts +6 -8
- package/lib/common/it/utils.js +44 -42
- package/lib/common/shorters/application.d.ts +3 -3
- package/lib/common/shorters/application.js +3 -2
- package/lib/common/shorters/bans.d.ts +8 -4
- package/lib/common/shorters/bans.js +13 -5
- package/lib/common/shorters/channels.d.ts +4 -4
- package/lib/common/shorters/channels.js +4 -4
- package/lib/common/shorters/emojis.js +1 -0
- package/lib/common/shorters/guilds.d.ts +8 -8
- package/lib/common/shorters/guilds.js +14 -31
- package/lib/common/shorters/interaction.d.ts +1 -1
- package/lib/common/shorters/invites.d.ts +201 -201
- package/lib/common/shorters/members.d.ts +7 -7
- package/lib/common/shorters/members.js +13 -14
- package/lib/common/shorters/messages.d.ts +2 -2
- package/lib/common/shorters/soundboard.d.ts +5 -5
- package/lib/common/shorters/users.d.ts +1 -1
- package/lib/common/shorters/webhook.d.ts +3 -2
- package/lib/common/shorters/webhook.js +0 -7
- package/lib/common/types/options.d.ts +4 -0
- package/lib/common/types/util.d.ts +8 -0
- package/lib/common/types/write.d.ts +2 -1
- package/lib/components/BaseSelectMenuComponent.d.ts +1 -1
- package/lib/components/BaseSelectMenuComponent.js +1 -1
- package/lib/components/ButtonComponent.d.ts +3 -3
- package/lib/components/ChannelSelectMenuComponent.d.ts +2 -2
- package/lib/components/File.d.ts +1 -1
- package/lib/components/MediaGallery.d.ts +1 -1
- package/lib/components/MentionableSelectMenuComponent.d.ts +1 -1
- package/lib/components/RoleSelectMenuComponent.d.ts +1 -1
- package/lib/components/Separator.d.ts +1 -1
- package/lib/components/StringSelectMenuComponent.d.ts +1 -1
- package/lib/components/TextInputComponent.d.ts +1 -1
- package/lib/components/Thumbnail.d.ts +1 -1
- package/lib/components/UserSelectMenuComponent.d.ts +1 -1
- package/lib/components/componentcommand.d.ts +8 -7
- package/lib/components/componentcontext.d.ts +24 -36
- package/lib/components/componentcontext.js +7 -17
- package/lib/components/handler.d.ts +17 -7
- package/lib/components/handler.js +108 -49
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +1 -0
- package/lib/components/interactioncontext.d.ts +45 -0
- package/lib/components/interactioncontext.js +93 -0
- package/lib/components/modalcommand.d.ts +5 -4
- package/lib/components/modalcontext.d.ts +39 -20
- package/lib/components/modalcontext.js +59 -6
- package/lib/events/event.d.ts +9 -3
- package/lib/events/handler.d.ts +51 -6
- package/lib/events/handler.js +165 -36
- package/lib/events/hooks/application_command.d.ts +1 -1
- package/lib/events/hooks/auto_moderation.d.ts +2 -2
- package/lib/events/hooks/guild.d.ts +150 -150
- package/lib/events/hooks/interactions.d.ts +1 -1
- package/lib/events/hooks/invite.d.ts +20 -20
- package/lib/events/hooks/message.d.ts +27 -27
- package/lib/events/hooks/presence.d.ts +11 -11
- package/lib/events/hooks/soundboard.d.ts +6 -6
- package/lib/events/hooks/stage.d.ts +2 -2
- package/lib/events/hooks/subscriptions.d.ts +3 -3
- package/lib/events/hooks/thread.d.ts +30 -30
- package/lib/events/hooks/voice.d.ts +3 -4
- package/lib/events/hooks/voice.js +2 -1
- package/lib/events/utils.d.ts +4 -0
- package/lib/events/utils.js +59 -0
- package/lib/index.d.ts +9 -4
- package/lib/index.js +14 -8
- package/lib/langs/handler.d.ts +14 -11
- package/lib/langs/handler.js +46 -9
- package/lib/langs/router.d.ts +10 -3
- package/lib/structures/Application.d.ts +1 -1
- package/lib/structures/Emoji.d.ts +3 -3
- package/lib/structures/Emoji.js +2 -2
- package/lib/structures/Guild.d.ts +154 -154
- package/lib/structures/GuildBan.d.ts +4 -4
- package/lib/structures/GuildBan.js +3 -3
- package/lib/structures/GuildMember.d.ts +7 -7
- package/lib/structures/GuildMember.js +28 -7
- package/lib/structures/GuildRole.d.ts +1 -1
- package/lib/structures/GuildRole.js +2 -2
- package/lib/structures/Interaction.d.ts +11 -9
- package/lib/structures/Interaction.js +33 -12
- package/lib/structures/Message.d.ts +21 -14
- package/lib/structures/Message.js +29 -14
- package/lib/structures/User.d.ts +1 -1
- package/lib/structures/VoiceState.d.ts +4 -0
- package/lib/structures/VoiceState.js +13 -1
- package/lib/structures/Webhook.d.ts +9 -1
- package/lib/structures/Webhook.js +4 -1
- package/lib/structures/channels.d.ts +148 -134
- package/lib/structures/channels.js +27 -26
- package/lib/structures/extra/BitField.d.ts +4 -4
- package/lib/structures/extra/BitField.js +20 -4
- package/lib/structures/extra/DiscordBase.js +1 -1
- package/lib/structures/extra/Permissions.d.ts +2 -4
- package/lib/structures/extra/Permissions.js +1 -17
- package/lib/types/payloads/_interactions/responses.d.ts +2 -2
- package/lib/types/payloads/components.d.ts +4 -4
- package/lib/websocket/SharedTypes.d.ts +4 -4
- package/lib/websocket/constants/index.d.ts +1 -1
- package/lib/websocket/constants/index.js +3 -2
- package/lib/websocket/discord/events/memberUpdate.js +2 -2
- package/lib/websocket/discord/heartbeater.d.ts +1 -0
- package/lib/websocket/discord/heartbeater.js +7 -0
- package/lib/websocket/discord/shard.d.ts +2 -2
- package/lib/websocket/discord/shard.js +16 -14
- package/lib/websocket/discord/sharder.d.ts +8 -7
- package/lib/websocket/discord/sharder.js +26 -6
- package/lib/websocket/discord/shared.d.ts +19 -6
- package/lib/websocket/discord/socket/custom.js +5 -0
- package/lib/websocket/discord/worker.d.ts +1 -0
- package/lib/websocket/discord/worker.js +2 -0
- package/lib/websocket/discord/workermanager.d.ts +25 -11
- package/lib/websocket/discord/workermanager.js +41 -10
- package/package.json +13 -17
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import type { RegisteredPluginMiddlewares, SeyfertRegistry } from '../client/plugins';
|
|
1
2
|
import type { FlatObjectKeys, PermissionStrings } from '../common';
|
|
2
3
|
import { ApplicationCommandType, ApplicationIntegrationType, type EntryPointCommandHandlerType, InteractionContextType, type LocaleString } from '../types';
|
|
3
4
|
import type { CommandOption, OptionsRecord, SubCommand } from './applications/chat';
|
|
4
|
-
import type { DefaultLocale, ExtraProps, IgnoreCommand
|
|
5
|
-
export
|
|
6
|
-
|
|
5
|
+
import type { AnyMiddlewareContext, DefaultLocale, ExtraProps, IgnoreCommand } from './applications/shared';
|
|
6
|
+
export type RegisteredMiddlewares = SeyfertRegistry extends {
|
|
7
|
+
middlewares: infer M extends Record<string, AnyMiddlewareContext>;
|
|
8
|
+
} ? M : {};
|
|
9
|
+
export type ResolvedRegisteredMiddlewares = RegisteredMiddlewares & RegisteredPluginMiddlewares;
|
|
10
|
+
type MiddlewareKey = keyof ResolvedRegisteredMiddlewares;
|
|
11
|
+
export type InferMiddlewares<T extends readonly MiddlewareKey[]> = T[number];
|
|
7
12
|
export type CommandDeclareOptions = DecoratorDeclareOptions | (Omit<DecoratorDeclareOptions, 'description'> & {
|
|
8
13
|
type: ApplicationCommandType.User | ApplicationCommandType.Message;
|
|
9
14
|
}) | (Omit<DecoratorDeclareOptions, 'ignore' | 'aliases' | 'guildId'> & {
|
|
@@ -15,12 +20,12 @@ export interface DecoratorDeclareOptions {
|
|
|
15
20
|
description: string;
|
|
16
21
|
botPermissions?: PermissionStrings;
|
|
17
22
|
defaultMemberPermissions?: PermissionStrings;
|
|
18
|
-
guildId?: string[];
|
|
23
|
+
guildId?: readonly string[];
|
|
19
24
|
nsfw?: boolean;
|
|
20
25
|
integrationTypes?: (keyof typeof ApplicationIntegrationType)[] | ApplicationIntegrationType[];
|
|
21
26
|
contexts?: (keyof typeof InteractionContextType)[] | InteractionContextType[];
|
|
22
27
|
ignore?: IgnoreCommand;
|
|
23
|
-
aliases?: string[];
|
|
28
|
+
aliases?: readonly string[];
|
|
24
29
|
props?: ExtraProps;
|
|
25
30
|
}
|
|
26
31
|
export declare function Locales({ name: names, description: descriptions, }: {
|
|
@@ -48,56 +53,64 @@ export declare function LocalesT(name?: FlatObjectKeys<DefaultLocale>, descripti
|
|
|
48
53
|
};
|
|
49
54
|
};
|
|
50
55
|
} & T;
|
|
51
|
-
export
|
|
56
|
+
export type TranslatedGroupDefinition = {
|
|
52
57
|
name?: FlatObjectKeys<DefaultLocale>;
|
|
53
58
|
description?: FlatObjectKeys<DefaultLocale>;
|
|
54
59
|
defaultDescription: string;
|
|
55
60
|
aliases?: string[];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
}>(target: T) => {
|
|
59
|
-
new (...args: any[]): {
|
|
60
|
-
__tGroups: Record<string, {
|
|
61
|
-
name?: FlatObjectKeys<DefaultLocale>;
|
|
62
|
-
description?: FlatObjectKeys<DefaultLocale>;
|
|
63
|
-
defaultDescription: string;
|
|
64
|
-
aliases?: string[];
|
|
65
|
-
}>;
|
|
66
|
-
groupsAliases: Record<string, string>;
|
|
67
|
-
};
|
|
68
|
-
} & T;
|
|
69
|
-
export declare function Groups(groups: Record<string, {
|
|
61
|
+
};
|
|
62
|
+
export type LocalizedGroupDefinition = {
|
|
70
63
|
name?: [language: LocaleString, value: string][];
|
|
71
64
|
description?: [language: LocaleString, value: string][];
|
|
72
65
|
defaultDescription: string;
|
|
73
66
|
aliases?: string[];
|
|
74
|
-
}
|
|
67
|
+
};
|
|
68
|
+
export type GroupDefinition = TranslatedGroupDefinition | LocalizedGroupDefinition;
|
|
69
|
+
export type GroupDefinitions = Record<string, LocalizedGroupDefinition> | Record<string, TranslatedGroupDefinition>;
|
|
70
|
+
export declare function defineGroups<const T extends Record<string, LocalizedGroupDefinition>>(groups: T): T;
|
|
71
|
+
export declare function defineGroups<const T extends Record<string, TranslatedGroupDefinition>>(groups: T): T;
|
|
72
|
+
export declare function GroupsT<const T extends Record<string, TranslatedGroupDefinition>>(groups: T): <T_1 extends {
|
|
75
73
|
new (...args: any[]): object;
|
|
76
|
-
}>(target:
|
|
74
|
+
}>(target: T_1) => {
|
|
77
75
|
new (...args: any[]): {
|
|
78
|
-
|
|
79
|
-
name?: [language: LocaleString, value: string][];
|
|
80
|
-
description?: [language: LocaleString, value: string][];
|
|
81
|
-
defaultDescription: string;
|
|
82
|
-
aliases?: string[];
|
|
83
|
-
}>;
|
|
76
|
+
__tGroups: T;
|
|
84
77
|
groupsAliases: Record<string, string>;
|
|
85
78
|
};
|
|
86
|
-
} &
|
|
87
|
-
export declare function
|
|
79
|
+
} & T_1;
|
|
80
|
+
export declare function Groups<const T extends Record<string, LocalizedGroupDefinition>>(groups: T): <T_1 extends {
|
|
81
|
+
new (...args: any[]): object;
|
|
82
|
+
}>(target: T_1) => {
|
|
83
|
+
new (...args: any[]): {
|
|
84
|
+
groups: T;
|
|
85
|
+
groupsAliases: Record<string, string>;
|
|
86
|
+
};
|
|
87
|
+
} & T_1;
|
|
88
|
+
type GroupDecorator = <T extends {
|
|
88
89
|
new (...args: any[]): object;
|
|
89
90
|
}>(target: T) => {
|
|
90
91
|
new (...args: any[]): {
|
|
91
92
|
group: string;
|
|
92
93
|
};
|
|
93
94
|
} & T;
|
|
94
|
-
|
|
95
|
+
type OptionsDecorator = <T extends {
|
|
95
96
|
new (...args: any[]): object;
|
|
96
97
|
}>(target: T) => {
|
|
97
98
|
new (...args: any[]): {
|
|
98
99
|
options: SubCommand[] | CommandOption[];
|
|
99
100
|
};
|
|
100
101
|
} & T;
|
|
102
|
+
type LowercaseOptionsRecord<T extends OptionsRecord> = T & {
|
|
103
|
+
[K in keyof T as K extends string ? (K extends Lowercase<K> ? never : K) : never]: never;
|
|
104
|
+
};
|
|
105
|
+
type LowercaseDeclareName<T extends CommandDeclareOptions> = {
|
|
106
|
+
[K in keyof T]: K extends 'name' ? T extends {
|
|
107
|
+
type: ApplicationCommandType.User | ApplicationCommandType.Message;
|
|
108
|
+
} ? T[K] : string extends T[K] ? T[K] : T[K] extends Lowercase<T[K] & string> ? T[K] : Lowercase<T[K] & string> : T[K];
|
|
109
|
+
};
|
|
110
|
+
export declare function Group(groupName: string): GroupDecorator;
|
|
111
|
+
export declare function Group<const T extends GroupDefinitions>(_groupsDef: T, groupName: keyof T & string): GroupDecorator;
|
|
112
|
+
export declare function Options(options: (new () => SubCommand)[]): OptionsDecorator;
|
|
113
|
+
export declare function Options<const T extends OptionsRecord>(options: LowercaseOptionsRecord<T>): OptionsDecorator;
|
|
101
114
|
export declare function AutoLoad(): <T extends {
|
|
102
115
|
new (...args: any[]): object;
|
|
103
116
|
}>(target: T) => {
|
|
@@ -105,19 +118,17 @@ export declare function AutoLoad(): <T extends {
|
|
|
105
118
|
__autoload: boolean;
|
|
106
119
|
};
|
|
107
120
|
} & T;
|
|
108
|
-
export
|
|
109
|
-
|
|
110
|
-
};
|
|
111
|
-
export declare function Middlewares(cbs: readonly (keyof RegisteredMiddlewares)[]): <T extends {
|
|
121
|
+
export declare function middlewares<const T extends readonly MiddlewareKey[]>(...cbs: T): T;
|
|
122
|
+
export declare function Middlewares(cbs: readonly MiddlewareKey[]): <T extends {
|
|
112
123
|
new (...args: any[]): object;
|
|
113
124
|
}>(target: T) => {
|
|
114
125
|
new (...args: any[]): {
|
|
115
126
|
middlewares: readonly never[];
|
|
116
127
|
};
|
|
117
128
|
} & T;
|
|
118
|
-
export declare function Declare(
|
|
129
|
+
export declare function Declare<const T extends CommandDeclareOptions>(input: LowercaseDeclareName<T>): <C extends {
|
|
119
130
|
new (...args: any[]): object;
|
|
120
|
-
}>(target:
|
|
131
|
+
}>(target: C) => {
|
|
121
132
|
new (...args: any[]): {
|
|
122
133
|
name: string;
|
|
123
134
|
nsfw: boolean | undefined;
|
|
@@ -133,4 +144,5 @@ export declare function Declare(declare: CommandDeclareOptions): <T extends {
|
|
|
133
144
|
aliases?: string[];
|
|
134
145
|
handler?: EntryPointCommandHandlerType;
|
|
135
146
|
};
|
|
136
|
-
} &
|
|
147
|
+
} & C;
|
|
148
|
+
export {};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Locales = Locales;
|
|
4
4
|
exports.LocalesT = LocalesT;
|
|
5
|
+
exports.defineGroups = defineGroups;
|
|
5
6
|
exports.GroupsT = GroupsT;
|
|
6
7
|
exports.Groups = Groups;
|
|
7
8
|
exports.Group = Group;
|
|
8
9
|
exports.Options = Options;
|
|
9
10
|
exports.AutoLoad = AutoLoad;
|
|
11
|
+
exports.middlewares = middlewares;
|
|
10
12
|
exports.Middlewares = Middlewares;
|
|
11
13
|
exports.Declare = Declare;
|
|
12
14
|
const Permissions_1 = require("../structures/extra/Permissions");
|
|
@@ -22,6 +24,9 @@ function LocalesT(name, description) {
|
|
|
22
24
|
__t = { name, description };
|
|
23
25
|
};
|
|
24
26
|
}
|
|
27
|
+
function defineGroups(groups) {
|
|
28
|
+
return groups;
|
|
29
|
+
}
|
|
25
30
|
function GroupsT(groups) {
|
|
26
31
|
return (target) => class extends target {
|
|
27
32
|
__tGroups = groups;
|
|
@@ -50,9 +55,10 @@ function Groups(groups) {
|
|
|
50
55
|
}
|
|
51
56
|
};
|
|
52
57
|
}
|
|
53
|
-
function Group(groupName) {
|
|
58
|
+
function Group(groupsDefOrGroupName, groupName) {
|
|
59
|
+
const resolvedGroupName = typeof groupsDefOrGroupName === 'string' ? groupsDefOrGroupName : groupName;
|
|
54
60
|
return (target) => class extends target {
|
|
55
|
-
group =
|
|
61
|
+
group = resolvedGroupName;
|
|
56
62
|
};
|
|
57
63
|
}
|
|
58
64
|
function Options(options) {
|
|
@@ -72,12 +78,16 @@ function AutoLoad() {
|
|
|
72
78
|
__autoload = true;
|
|
73
79
|
};
|
|
74
80
|
}
|
|
81
|
+
function middlewares(...cbs) {
|
|
82
|
+
return cbs;
|
|
83
|
+
}
|
|
75
84
|
function Middlewares(cbs) {
|
|
76
85
|
return (target) => class extends target {
|
|
77
86
|
middlewares = cbs;
|
|
78
87
|
};
|
|
79
88
|
}
|
|
80
|
-
function Declare(
|
|
89
|
+
function Declare(input) {
|
|
90
|
+
const declare = input;
|
|
81
91
|
return (target) => class extends target {
|
|
82
92
|
name = declare.name;
|
|
83
93
|
nsfw = declare.nsfw;
|
|
@@ -104,11 +114,11 @@ function Declare(declare) {
|
|
|
104
114
|
if ('type' in declare)
|
|
105
115
|
this.type = declare.type;
|
|
106
116
|
if ('guildId' in declare)
|
|
107
|
-
this.guildId = declare.guildId;
|
|
117
|
+
this.guildId = declare.guildId?.slice();
|
|
108
118
|
if ('ignore' in declare)
|
|
109
119
|
this.ignore = declare.ignore;
|
|
110
120
|
if ('aliases' in declare)
|
|
111
|
-
this.aliases = declare.aliases;
|
|
121
|
+
this.aliases = declare.aliases?.slice();
|
|
112
122
|
if ('handler' in declare)
|
|
113
123
|
this.handler = declare.handler;
|
|
114
124
|
// check if all properties are valid
|
package/lib/commands/handle.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { type MessageStructure, type OptionResolverStructure, Transformers } fro
|
|
|
2
2
|
import type { MakeRequired } from '../common';
|
|
3
3
|
import { type __InternalReplyFunction, AutocompleteInteraction, type ChatInputCommandInteraction, type ComponentInteraction, type EntryPointInteraction, type MessageCommandInteraction, type ModalSubmitInteraction, type UserCommandInteraction } from '../structures';
|
|
4
4
|
import type { PermissionsBitField } from '../structures/extra/Permissions';
|
|
5
|
-
import { type APIApplicationCommandInteraction, type
|
|
5
|
+
import { type APIApplicationCommandInteraction, type APIApplicationCommandInteractionDataBasicOption, type APIInteraction, ApplicationCommandOptionType, type GatewayMessageCreateDispatchData } from '../types';
|
|
6
6
|
import { Command, type CommandAutocompleteOption, CommandContext, type CommandOption, type ContextMenuCommand, type ContextOptionsResolved, type EntryPointCommand, EntryPointContext, MenuCommandContext, type MessageCommandOptionErrors, SubCommand, type UsingClient } from '.';
|
|
7
7
|
export type CommandOptionWithType = CommandOption & {
|
|
8
8
|
type: ApplicationCommandOptionType;
|
|
@@ -16,6 +16,7 @@ export declare class HandleCommand {
|
|
|
16
16
|
client: UsingClient;
|
|
17
17
|
constructor(client: UsingClient);
|
|
18
18
|
autocomplete(interaction: AutocompleteInteraction, optionsResolver: OptionResolverStructure, command?: CommandAutocompleteOption): Promise<void>;
|
|
19
|
+
private runAutocomplete;
|
|
19
20
|
contextMenu(command: ContextMenuCommand, interaction: MessageCommandInteraction | UserCommandInteraction, context: MenuCommandContext<MessageCommandInteraction | UserCommandInteraction>): Promise<any>;
|
|
20
21
|
contextMenuMessage(command: ContextMenuCommand, interaction: MessageCommandInteraction, context: MenuCommandContext<MessageCommandInteraction>): Promise<any>;
|
|
21
22
|
contextMenuUser(command: ContextMenuCommand, interaction: UserCommandInteraction, context: MenuCommandContext<UserCommandInteraction>): Promise<any>;
|
|
@@ -29,24 +30,34 @@ export declare class HandleCommand {
|
|
|
29
30
|
resolveCommandFromContent(content: string, _prefix: string, _message: GatewayMessageCreateDispatchData): CommandFromContent & {
|
|
30
31
|
argsContent?: string;
|
|
31
32
|
};
|
|
32
|
-
getCommandFromContent(commandRaw: string[]): CommandFromContent;
|
|
33
|
+
getCommandFromContent(commandRaw: string[], guildId?: string): CommandFromContent;
|
|
34
|
+
/**
|
|
35
|
+
* Resolves a message command by its full name.
|
|
36
|
+
*
|
|
37
|
+
* Guild-scoped commands require a matching `guildId`; without one, they intentionally resolve to `undefined`.
|
|
38
|
+
*/
|
|
39
|
+
resolveByName(fullName: string, guildId?: string): CommandFromContent | undefined;
|
|
40
|
+
private resolveCommandFromNameParts;
|
|
33
41
|
makeResolver(...args: Parameters<(typeof Transformers)['OptionResolver']>): OptionResolverStructure;
|
|
34
|
-
getParentMessageCommand(rawParentName: string): Command | ContextMenuCommand | undefined;
|
|
42
|
+
getParentMessageCommand(rawParentName: string, guildId?: string): Command | ContextMenuCommand | undefined;
|
|
43
|
+
private commandCanRunInGuild;
|
|
35
44
|
getCommand<T extends Command | ContextMenuCommand | EntryPointCommand>(data: {
|
|
36
45
|
guild_id?: string;
|
|
37
46
|
name: string;
|
|
38
47
|
}): T | undefined;
|
|
39
48
|
checkPermissions(app: PermissionsBitField, bot: bigint): ("CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTTSMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "ViewGuildInsights" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVAD" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageGuildExpressions" | "UseApplicationCommands" | "RequestToSpeak" | "ManageEvents" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "UseEmbeddedActivities" | "ModerateMembers" | "ViewCreatorMonetizationAnalytics" | "UseSoundboard" | "CreateGuildExpressions" | "CreateEvents" | "UseExternalSounds" | "SendVoiceMessages" | "SetVoiceChannelStatus" | "SendPolls" | "UseExternalApps" | "PinMessages" | "BypassSlowmode")[] | undefined;
|
|
40
|
-
fetchChannel(_option: CommandOptionWithType, query: string): Promise<import("
|
|
41
|
-
fetchUser(_option: CommandOptionWithType, query: string): Promise<import("
|
|
42
|
-
fetchMember(_option: CommandOptionWithType, query: string, guildId: string): Promise<import("
|
|
43
|
-
fetchRole(_option: CommandOptionWithType, query: string, guildId?: string): Promise<import("
|
|
49
|
+
fetchChannel(_option: CommandOptionWithType, query: string): Promise<import("..").APIChannel> | null;
|
|
50
|
+
fetchUser(_option: CommandOptionWithType, query: string): Promise<import("..").APIUser> | null;
|
|
51
|
+
fetchMember(_option: CommandOptionWithType, query: string, guildId: string): Promise<import("..").APIGuildMember> | null;
|
|
52
|
+
fetchRole(_option: CommandOptionWithType, query: string, guildId?: string): Promise<import("..").APIRole> | null;
|
|
44
53
|
runGlobalMiddlewares(command: Command | ContextMenuCommand | SubCommand | EntryPointCommand, context: CommandContext<{}, never> | MenuCommandContext<any> | EntryPointContext): Promise<false | {
|
|
45
54
|
error?: string;
|
|
55
|
+
metadata?: import("..").PluginMiddlewareDenialMetadata;
|
|
46
56
|
pass?: boolean;
|
|
47
57
|
}>;
|
|
48
58
|
runMiddlewares(command: Command | ContextMenuCommand | SubCommand | EntryPointCommand, context: CommandContext<{}, never> | MenuCommandContext<any> | EntryPointContext): Promise<false | {
|
|
49
59
|
error?: string;
|
|
60
|
+
metadata?: import("..").PluginMiddlewareDenialMetadata;
|
|
50
61
|
pass?: boolean;
|
|
51
62
|
}>;
|
|
52
63
|
makeMenuCommand(body: APIApplicationCommandInteraction, shardId: number, __reply?: __InternalReplyFunction): void | {
|
|
@@ -61,6 +72,6 @@ export declare class HandleCommand {
|
|
|
61
72
|
error: string;
|
|
62
73
|
fullError: MessageCommandOptionErrors;
|
|
63
74
|
}[];
|
|
64
|
-
options:
|
|
75
|
+
options: APIApplicationCommandInteractionDataBasicOption[];
|
|
65
76
|
}>;
|
|
66
77
|
}
|