seyfert 0.1.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/LICENSE +190 -0
- package/README.md +57 -0
- package/lib/api/CDN.d.ts +220 -0
- package/lib/api/CDN.js +236 -0
- package/lib/api/REST.d.ts +127 -0
- package/lib/api/REST.js +424 -0
- package/lib/api/Router.d.ts +17 -0
- package/lib/api/Router.js +63 -0
- package/lib/api/Routes/applications.d.ts +46 -0
- package/lib/api/Routes/applications.js +2 -0
- package/lib/api/Routes/cdn.d.ts +66 -0
- package/lib/api/Routes/cdn.js +2 -0
- package/lib/api/Routes/channels.d.ts +109 -0
- package/lib/api/Routes/channels.js +2 -0
- package/lib/api/Routes/gateway.d.ts +11 -0
- package/lib/api/Routes/gateway.js +2 -0
- package/lib/api/Routes/guilds.d.ts +171 -0
- package/lib/api/Routes/guilds.js +2 -0
- package/lib/api/Routes/index.d.ts +13 -0
- package/lib/api/Routes/index.js +17 -0
- package/lib/api/Routes/interactions.d.ts +14 -0
- package/lib/api/Routes/interactions.js +2 -0
- package/lib/api/Routes/invites.d.ts +9 -0
- package/lib/api/Routes/invites.js +2 -0
- package/lib/api/Routes/stage-instances.d.ts +13 -0
- package/lib/api/Routes/stage-instances.js +2 -0
- package/lib/api/Routes/stickers.d.ts +11 -0
- package/lib/api/Routes/stickers.js +2 -0
- package/lib/api/Routes/users.d.ts +35 -0
- package/lib/api/Routes/users.js +2 -0
- package/lib/api/Routes/voice.d.ts +10 -0
- package/lib/api/Routes/voice.js +2 -0
- package/lib/api/Routes/webhooks.d.ts +29 -0
- package/lib/api/Routes/webhooks.js +2 -0
- package/lib/api/errors/DiscordAPIError.d.ts +51 -0
- package/lib/api/errors/DiscordAPIError.js +81 -0
- package/lib/api/errors/HTTPError.d.ts +20 -0
- package/lib/api/errors/HTTPError.js +28 -0
- package/lib/api/errors/RateLimitError.d.ts +19 -0
- package/lib/api/errors/RateLimitError.js +37 -0
- package/lib/api/handlers/BurstHandler.d.ts +51 -0
- package/lib/api/handlers/BurstHandler.js +124 -0
- package/lib/api/handlers/SequentialHandler.d.ts +81 -0
- package/lib/api/handlers/SequentialHandler.js +365 -0
- package/lib/api/handlers/Shared.d.ts +14 -0
- package/lib/api/handlers/Shared.js +125 -0
- package/lib/api/index.d.ts +5 -0
- package/lib/api/index.js +21 -0
- package/lib/api/interfaces/Handler.d.ts +21 -0
- package/lib/api/interfaces/Handler.js +2 -0
- package/lib/api/shared.d.ts +7 -0
- package/lib/api/shared.js +27 -0
- package/lib/api/utils/constants.d.ts +39 -0
- package/lib/api/utils/constants.js +50 -0
- package/lib/api/utils/types.d.ts +335 -0
- package/lib/api/utils/types.js +14 -0
- package/lib/api/utils/utils.d.ts +52 -0
- package/lib/api/utils/utils.js +159 -0
- package/lib/builders/ActionRow.d.ts +40 -0
- package/lib/builders/ActionRow.js +58 -0
- package/lib/builders/Attachment.d.ts +106 -0
- package/lib/builders/Attachment.js +196 -0
- package/lib/builders/Base.d.ts +10 -0
- package/lib/builders/Base.js +13 -0
- package/lib/builders/Button.d.ts +59 -0
- package/lib/builders/Button.js +94 -0
- package/lib/builders/MessageEmbed.d.ts +116 -0
- package/lib/builders/MessageEmbed.js +159 -0
- package/lib/builders/Modal.d.ts +111 -0
- package/lib/builders/Modal.js +162 -0
- package/lib/builders/SelectMenu.d.ts +201 -0
- package/lib/builders/SelectMenu.js +293 -0
- package/lib/builders/index.d.ts +12 -0
- package/lib/builders/index.js +54 -0
- package/lib/builders/types.d.ts +21 -0
- package/lib/builders/types.js +2 -0
- package/lib/cache/adapters/default.d.ts +24 -0
- package/lib/cache/adapters/default.js +118 -0
- package/lib/cache/adapters/index.d.ts +4 -0
- package/lib/cache/adapters/index.js +20 -0
- package/lib/cache/adapters/redis.d.ts +35 -0
- package/lib/cache/adapters/redis.js +180 -0
- package/lib/cache/adapters/types.d.ts +25 -0
- package/lib/cache/adapters/types.js +2 -0
- package/lib/cache/adapters/workeradapter.d.ts +24 -0
- package/lib/cache/adapters/workeradapter.js +76 -0
- package/lib/cache/index.d.ts +97 -0
- package/lib/cache/index.js +394 -0
- package/lib/cache/resources/channels.d.ts +7 -0
- package/lib/cache/resources/channels.js +20 -0
- package/lib/cache/resources/default/base.d.ts +25 -0
- package/lib/cache/resources/default/base.js +75 -0
- package/lib/cache/resources/default/guild-based.d.ts +33 -0
- package/lib/cache/resources/default/guild-based.js +91 -0
- package/lib/cache/resources/default/guild-related.d.ts +32 -0
- package/lib/cache/resources/default/guild-related.js +102 -0
- package/lib/cache/resources/emojis.d.ts +7 -0
- package/lib/cache/resources/emojis.js +17 -0
- package/lib/cache/resources/guilds.d.ts +10 -0
- package/lib/cache/resources/guilds.js +117 -0
- package/lib/cache/resources/members.d.ts +10 -0
- package/lib/cache/resources/members.js +41 -0
- package/lib/cache/resources/presence.d.ts +9 -0
- package/lib/cache/resources/presence.js +14 -0
- package/lib/cache/resources/roles.d.ts +7 -0
- package/lib/cache/resources/roles.js +17 -0
- package/lib/cache/resources/stage-instances.d.ts +5 -0
- package/lib/cache/resources/stage-instances.js +8 -0
- package/lib/cache/resources/stickers.d.ts +7 -0
- package/lib/cache/resources/stickers.js +17 -0
- package/lib/cache/resources/threads.d.ts +7 -0
- package/lib/cache/resources/threads.js +17 -0
- package/lib/cache/resources/users.d.ts +7 -0
- package/lib/cache/resources/users.js +17 -0
- package/lib/cache/resources/voice-states.d.ts +9 -0
- package/lib/cache/resources/voice-states.js +13 -0
- package/lib/client/base.d.ts +244 -0
- package/lib/client/base.js +178 -0
- package/lib/client/client.d.ts +32 -0
- package/lib/client/client.js +156 -0
- package/lib/client/httpclient.d.ts +21 -0
- package/lib/client/httpclient.js +143 -0
- package/lib/client/index.d.ts +4 -0
- package/lib/client/index.js +19 -0
- package/lib/client/oninteraction.d.ts +4 -0
- package/lib/client/oninteraction.js +180 -0
- package/lib/client/workerclient.d.ts +28 -0
- package/lib/client/workerclient.js +213 -0
- package/lib/collection.d.ts +233 -0
- package/lib/collection.js +371 -0
- package/lib/commands/applications/chat.d.ts +139 -0
- package/lib/commands/applications/chat.js +173 -0
- package/lib/commands/applications/chatcontext.d.ts +28 -0
- package/lib/commands/applications/chatcontext.js +53 -0
- package/lib/commands/applications/menu.d.ts +39 -0
- package/lib/commands/applications/menu.js +87 -0
- package/lib/commands/applications/menucontext.d.ts +25 -0
- package/lib/commands/applications/menucontext.js +64 -0
- package/lib/commands/applications/options.d.ts +67 -0
- package/lib/commands/applications/options.js +44 -0
- package/lib/commands/applications/shared.d.ts +35 -0
- package/lib/commands/applications/shared.js +2 -0
- package/lib/commands/decorators.d.ts +107 -0
- package/lib/commands/decorators.js +85 -0
- package/lib/commands/handler.d.ts +15 -0
- package/lib/commands/handler.js +140 -0
- package/lib/commands/index.d.ts +8 -0
- package/lib/commands/index.js +24 -0
- package/lib/commands/optionresolver.d.ts +49 -0
- package/lib/commands/optionresolver.js +146 -0
- package/lib/common/bot/watcher.d.ts +53 -0
- package/lib/common/bot/watcher.js +104 -0
- package/lib/common/index.d.ts +13 -0
- package/lib/common/index.js +30 -0
- package/lib/common/it/colors.d.ts +274 -0
- package/lib/common/it/colors.js +453 -0
- package/lib/common/it/constants.d.ts +36 -0
- package/lib/common/it/constants.js +40 -0
- package/lib/common/it/logger.d.ts +114 -0
- package/lib/common/it/logger.js +189 -0
- package/lib/common/it/utils.d.ts +107 -0
- package/lib/common/it/utils.js +275 -0
- package/lib/common/shorters/base.d.ts +5 -0
- package/lib/common/shorters/base.js +10 -0
- package/lib/common/shorters/channels.d.ts +90 -0
- package/lib/common/shorters/channels.js +95 -0
- package/lib/common/shorters/guilds.d.ts +389 -0
- package/lib/common/shorters/guilds.js +350 -0
- package/lib/common/shorters/members.d.ts +115 -0
- package/lib/common/shorters/members.js +179 -0
- package/lib/common/shorters/messages.d.ts +27 -0
- package/lib/common/shorters/messages.js +117 -0
- package/lib/common/shorters/roles.d.ts +12 -0
- package/lib/common/shorters/roles.js +51 -0
- package/lib/common/shorters/templates.d.ts +12 -0
- package/lib/common/shorters/templates.js +29 -0
- package/lib/common/shorters/users.d.ts +11 -0
- package/lib/common/shorters/users.js +42 -0
- package/lib/common/shorters/webhook.d.ts +33 -0
- package/lib/common/shorters/webhook.js +69 -0
- package/lib/common/types/options.d.ts +10 -0
- package/lib/common/types/options.js +2 -0
- package/lib/common/types/resolvables.d.ts +10 -0
- package/lib/common/types/resolvables.js +2 -0
- package/lib/common/types/util.d.ts +90 -0
- package/lib/common/types/util.js +2 -0
- package/lib/common/types/write.d.ts +21 -0
- package/lib/common/types/write.js +2 -0
- package/lib/components/ActionRow.d.ts +10 -0
- package/lib/components/ActionRow.js +13 -0
- package/lib/components/ButtonComponent.d.ts +19 -0
- package/lib/components/ButtonComponent.js +34 -0
- package/lib/components/ChannelSelectMenuComponent.d.ts +6 -0
- package/lib/components/ChannelSelectMenuComponent.js +12 -0
- package/lib/components/MentionableSelectMenuComponent.d.ts +4 -0
- package/lib/components/MentionableSelectMenuComponent.js +7 -0
- package/lib/components/RoleSelectMenuComponent.d.ts +4 -0
- package/lib/components/RoleSelectMenuComponent.js +7 -0
- package/lib/components/StringSelectMenuComponent.d.ts +6 -0
- package/lib/components/StringSelectMenuComponent.js +12 -0
- package/lib/components/TextInputComponent.d.ts +7 -0
- package/lib/components/TextInputComponent.js +14 -0
- package/lib/components/UserSelectMenuComponent.d.ts +4 -0
- package/lib/components/UserSelectMenuComponent.js +7 -0
- package/lib/components/command.d.ts +23 -0
- package/lib/components/command.js +15 -0
- package/lib/components/handler.d.ts +48 -0
- package/lib/components/handler.js +231 -0
- package/lib/components/index.d.ts +20 -0
- package/lib/components/index.js +55 -0
- package/lib/components/listener.d.ts +11 -0
- package/lib/components/listener.js +18 -0
- package/lib/events/event.d.ts +23 -0
- package/lib/events/event.js +2 -0
- package/lib/events/handler.d.ts +19 -0
- package/lib/events/handler.js +112 -0
- package/lib/events/hooks/application_command.d.ts +12 -0
- package/lib/events/hooks/application_command.js +8 -0
- package/lib/events/hooks/auto_moderation.d.ts +22 -0
- package/lib/events/hooks/auto_moderation.js +21 -0
- package/lib/events/hooks/channel.d.ts +11 -0
- package/lib/events/hooks/channel.js +24 -0
- package/lib/events/hooks/custom.d.ts +4 -0
- package/lib/events/hooks/custom.js +11 -0
- package/lib/events/hooks/dispatch.d.ts +5 -0
- package/lib/events/hooks/dispatch.js +12 -0
- package/lib/events/hooks/entitlement.d.ts +35 -0
- package/lib/events/hooks/entitlement.js +16 -0
- package/lib/events/hooks/guild.d.ts +228 -0
- package/lib/events/hooks/guild.js +101 -0
- package/lib/events/hooks/index.d.ts +23 -0
- package/lib/events/hooks/index.js +34 -0
- package/lib/events/hooks/integration.d.ts +94 -0
- package/lib/events/hooks/integration.js +27 -0
- package/lib/events/hooks/interactions.d.ts +4 -0
- package/lib/events/hooks/interactions.js +8 -0
- package/lib/events/hooks/invite.d.ts +21 -0
- package/lib/events/hooks/invite.js +12 -0
- package/lib/events/hooks/message.d.ts +69 -0
- package/lib/events/hooks/message.js +37 -0
- package/lib/events/hooks/presence.d.ts +27 -0
- package/lib/events/hooks/presence.js +8 -0
- package/lib/events/hooks/stage.d.ts +29 -0
- package/lib/events/hooks/stage.js +16 -0
- package/lib/events/hooks/thread.d.ts +198 -0
- package/lib/events/hooks/thread.js +29 -0
- package/lib/events/hooks/typing.d.ts +16 -0
- package/lib/events/hooks/typing.js +14 -0
- package/lib/events/hooks/user.d.ts +4 -0
- package/lib/events/hooks/user.js +8 -0
- package/lib/events/hooks/voice.d.ts +37 -0
- package/lib/events/hooks/voice.js +18 -0
- package/lib/events/hooks/webhook.d.ts +6 -0
- package/lib/events/hooks/webhook.js +8 -0
- package/lib/events/index.d.ts +2 -0
- package/lib/events/index.js +18 -0
- package/lib/index.d.ts +79 -0
- package/lib/index.js +104 -0
- package/lib/langs/handler.d.ts +11 -0
- package/lib/langs/handler.js +34 -0
- package/lib/langs/index.d.ts +2 -0
- package/lib/langs/index.js +18 -0
- package/lib/langs/router.d.ts +18 -0
- package/lib/langs/router.js +42 -0
- package/lib/structures/AnonymousGuild.d.ts +7 -0
- package/lib/structures/AnonymousGuild.js +11 -0
- package/lib/structures/AutoModerationRule.d.ts +22 -0
- package/lib/structures/AutoModerationRule.js +34 -0
- package/lib/structures/ClientUser.d.ts +25 -0
- package/lib/structures/ClientUser.js +52 -0
- package/lib/structures/Guild.d.ts +86 -0
- package/lib/structures/Guild.js +66 -0
- package/lib/structures/GuildEmoji.d.ts +29 -0
- package/lib/structures/GuildEmoji.js +47 -0
- package/lib/structures/GuildMember.d.ts +92 -0
- package/lib/structures/GuildMember.js +137 -0
- package/lib/structures/GuildPreview.d.ts +10 -0
- package/lib/structures/GuildPreview.js +14 -0
- package/lib/structures/GuildRole.d.ts +21 -0
- package/lib/structures/GuildRole.js +32 -0
- package/lib/structures/GuildTemplate.d.ts +23 -0
- package/lib/structures/GuildTemplate.js +36 -0
- package/lib/structures/Interaction.d.ts +152 -0
- package/lib/structures/Interaction.js +409 -0
- package/lib/structures/Message.d.ts +53 -0
- package/lib/structures/Message.js +123 -0
- package/lib/structures/Sticker.d.ts +27 -0
- package/lib/structures/Sticker.js +44 -0
- package/lib/structures/User.d.ts +20 -0
- package/lib/structures/User.js +37 -0
- package/lib/structures/Webhook.d.ts +42 -0
- package/lib/structures/Webhook.js +63 -0
- package/lib/structures/channels.d.ts +232 -0
- package/lib/structures/channels.js +366 -0
- package/lib/structures/extra/Base.d.ts +7 -0
- package/lib/structures/extra/Base.js +39 -0
- package/lib/structures/extra/BaseComponent.d.ts +9 -0
- package/lib/structures/extra/BaseComponent.js +12 -0
- package/lib/structures/extra/BaseGuild.d.ts +40 -0
- package/lib/structures/extra/BaseGuild.js +71 -0
- package/lib/structures/extra/BaseSelectMenuComponent.d.ts +9 -0
- package/lib/structures/extra/BaseSelectMenuComponent.js +13 -0
- package/lib/structures/extra/BitField.d.ts +14 -0
- package/lib/structures/extra/BitField.js +56 -0
- package/lib/structures/extra/DiscordBase.d.ts +18 -0
- package/lib/structures/extra/DiscordBase.js +28 -0
- package/lib/structures/extra/Permissions.d.ts +54 -0
- package/lib/structures/extra/Permissions.js +9 -0
- package/lib/structures/extra/functions.d.ts +11 -0
- package/lib/structures/extra/functions.js +69 -0
- package/lib/structures/index.d.ts +15 -0
- package/lib/structures/index.js +31 -0
- package/lib/websocket/SharedTypes.d.ts +128 -0
- package/lib/websocket/SharedTypes.js +2 -0
- package/lib/websocket/constants/index.d.ts +26 -0
- package/lib/websocket/constants/index.js +31 -0
- package/lib/websocket/discord/basesocket.d.ts +12 -0
- package/lib/websocket/discord/basesocket.js +37 -0
- package/lib/websocket/discord/events/memberUpdate.d.ts +16 -0
- package/lib/websocket/discord/events/memberUpdate.js +47 -0
- package/lib/websocket/discord/events/presenceUpdate.d.ts +24 -0
- package/lib/websocket/discord/events/presenceUpdate.js +46 -0
- package/lib/websocket/discord/handlemessage.d.ts +0 -0
- package/lib/websocket/discord/handlemessage.js +1 -0
- package/lib/websocket/discord/index.d.ts +4 -0
- package/lib/websocket/discord/index.js +20 -0
- package/lib/websocket/discord/memberUpdate.d.ts +16 -0
- package/lib/websocket/discord/memberUpdate.js +47 -0
- package/lib/websocket/discord/shard.d.ts +46 -0
- package/lib/websocket/discord/shard.js +278 -0
- package/lib/websocket/discord/sharder.d.ts +25 -0
- package/lib/websocket/discord/sharder.js +153 -0
- package/lib/websocket/discord/shared.d.ts +99 -0
- package/lib/websocket/discord/shared.js +8 -0
- package/lib/websocket/discord/worker.d.ts +43 -0
- package/lib/websocket/discord/worker.js +2 -0
- package/lib/websocket/discord/workermanager.d.ts +69 -0
- package/lib/websocket/discord/workermanager.js +273 -0
- package/lib/websocket/index.d.ts +3 -0
- package/lib/websocket/index.js +19 -0
- package/lib/websocket/structures/index.d.ts +117 -0
- package/lib/websocket/structures/index.js +261 -0
- package/lib/websocket/structures/timeout.d.ts +20 -0
- package/lib/websocket/structures/timeout.js +75 -0
- package/package.json +70 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ApplicationCommandOptionType, type APIApplicationCommandOptionChoice, type ChannelType } from 'discord-api-types/v10';
|
|
2
|
+
import type { AutocompleteCallback, OnAutocompleteErrorCallback, ReturnOptionsTypes, __TypesWrapper } from '..';
|
|
3
|
+
import type { CommandContext } from './chatcontext';
|
|
4
|
+
import type { MiddlewareContext } from './shared';
|
|
5
|
+
type SeyfertBasicOption<T extends keyof __TypesWrapper, D = {}> = __TypesWrapper[T] & D;
|
|
6
|
+
type SeyfertStringOption = SeyfertBasicOption<'String'> & {
|
|
7
|
+
autocomplete?: AutocompleteCallback;
|
|
8
|
+
onAutocompleteError?: OnAutocompleteErrorCallback;
|
|
9
|
+
choices?: readonly {
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly value: string;
|
|
12
|
+
}[] | APIApplicationCommandOptionChoice<ReturnOptionsTypes[ApplicationCommandOptionType.String]>[];
|
|
13
|
+
min_length?: number;
|
|
14
|
+
max_length?: number;
|
|
15
|
+
};
|
|
16
|
+
type SeyfertIntegerOption = SeyfertBasicOption<'Integer'> & {
|
|
17
|
+
autocomplete?: AutocompleteCallback;
|
|
18
|
+
onAutocompleteError?: OnAutocompleteErrorCallback;
|
|
19
|
+
choices?: APIApplicationCommandOptionChoice<ReturnOptionsTypes[ApplicationCommandOptionType.Integer]>[];
|
|
20
|
+
min_value?: number;
|
|
21
|
+
max_value?: number;
|
|
22
|
+
};
|
|
23
|
+
type SeyfertBooleanOption = SeyfertBasicOption<'Boolean'>;
|
|
24
|
+
type SeyfertUserOption = SeyfertBasicOption<'User'>;
|
|
25
|
+
type SeyfertChannelOption = SeyfertBasicOption<'Channel'> & {
|
|
26
|
+
channel_types?: ChannelType[];
|
|
27
|
+
};
|
|
28
|
+
type SeyfertRoleOption = SeyfertBasicOption<'Role'>;
|
|
29
|
+
type SeyfertMentionableOption = SeyfertBasicOption<'Mentionable'>;
|
|
30
|
+
type SeyfertNumberOption = SeyfertBasicOption<'Number'> & {
|
|
31
|
+
autocomplete?: AutocompleteCallback;
|
|
32
|
+
onAutocompleteError?: OnAutocompleteErrorCallback;
|
|
33
|
+
choices?: APIApplicationCommandOptionChoice<ReturnOptionsTypes[ApplicationCommandOptionType.Number]>[];
|
|
34
|
+
min_value?: number;
|
|
35
|
+
max_value?: number;
|
|
36
|
+
};
|
|
37
|
+
type SeyfertAttachmentOption = SeyfertBasicOption<'Attachment'>;
|
|
38
|
+
export declare function createStringOption<T extends SeyfertStringOption = SeyfertStringOption>(data: T): T & {
|
|
39
|
+
readonly type: ApplicationCommandOptionType.String;
|
|
40
|
+
};
|
|
41
|
+
export declare function createIntegerOption<T extends SeyfertIntegerOption = SeyfertIntegerOption>(data: T): T & {
|
|
42
|
+
readonly type: ApplicationCommandOptionType.Integer;
|
|
43
|
+
};
|
|
44
|
+
export declare function createBooleanOption<T extends SeyfertBooleanOption = SeyfertBooleanOption>(data: T): T & {
|
|
45
|
+
readonly type: ApplicationCommandOptionType.Boolean;
|
|
46
|
+
};
|
|
47
|
+
export declare function createUserOption<T extends SeyfertUserOption = SeyfertUserOption>(data: T): T & {
|
|
48
|
+
readonly type: ApplicationCommandOptionType.User;
|
|
49
|
+
};
|
|
50
|
+
export declare function createChannelOption<T extends SeyfertChannelOption = SeyfertChannelOption>(data: T): T & {
|
|
51
|
+
readonly type: ApplicationCommandOptionType.Channel;
|
|
52
|
+
};
|
|
53
|
+
export declare function createRoleOption<T extends SeyfertRoleOption = SeyfertRoleOption>(data: T): T & {
|
|
54
|
+
readonly type: ApplicationCommandOptionType.Role;
|
|
55
|
+
};
|
|
56
|
+
export declare function createMentionableOption<T extends SeyfertMentionableOption = SeyfertMentionableOption>(data: T): T & {
|
|
57
|
+
readonly type: ApplicationCommandOptionType.Mentionable;
|
|
58
|
+
};
|
|
59
|
+
export declare function createNumberOption<T extends SeyfertNumberOption = SeyfertNumberOption>(data: T): T & {
|
|
60
|
+
readonly type: ApplicationCommandOptionType.Number;
|
|
61
|
+
};
|
|
62
|
+
export declare function createAttachmentOption<T extends SeyfertAttachmentOption = SeyfertAttachmentOption>(data: T): T & {
|
|
63
|
+
readonly type: ApplicationCommandOptionType.Attachment;
|
|
64
|
+
};
|
|
65
|
+
export type ParseMiddlewareType<T> = T extends MiddlewareContext<any, CommandContext> ? T : MiddlewareContext<T, CommandContext>;
|
|
66
|
+
export declare function createMiddleware<T = ParseMiddlewareType<unknown>>(data: ParseMiddlewareType<T>): ParseMiddlewareType<T>;
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createMiddleware = exports.createAttachmentOption = exports.createNumberOption = exports.createMentionableOption = exports.createRoleOption = exports.createChannelOption = exports.createUserOption = exports.createBooleanOption = exports.createIntegerOption = exports.createStringOption = void 0;
|
|
4
|
+
const v10_1 = require("discord-api-types/v10");
|
|
5
|
+
function createStringOption(data) {
|
|
6
|
+
return { ...data, type: v10_1.ApplicationCommandOptionType.String };
|
|
7
|
+
}
|
|
8
|
+
exports.createStringOption = createStringOption;
|
|
9
|
+
function createIntegerOption(data) {
|
|
10
|
+
return { ...data, type: v10_1.ApplicationCommandOptionType.Integer };
|
|
11
|
+
}
|
|
12
|
+
exports.createIntegerOption = createIntegerOption;
|
|
13
|
+
function createBooleanOption(data) {
|
|
14
|
+
return { ...data, type: v10_1.ApplicationCommandOptionType.Boolean };
|
|
15
|
+
}
|
|
16
|
+
exports.createBooleanOption = createBooleanOption;
|
|
17
|
+
function createUserOption(data) {
|
|
18
|
+
return { ...data, type: v10_1.ApplicationCommandOptionType.User };
|
|
19
|
+
}
|
|
20
|
+
exports.createUserOption = createUserOption;
|
|
21
|
+
function createChannelOption(data) {
|
|
22
|
+
return { ...data, type: v10_1.ApplicationCommandOptionType.Channel };
|
|
23
|
+
}
|
|
24
|
+
exports.createChannelOption = createChannelOption;
|
|
25
|
+
function createRoleOption(data) {
|
|
26
|
+
return { ...data, type: v10_1.ApplicationCommandOptionType.Role };
|
|
27
|
+
}
|
|
28
|
+
exports.createRoleOption = createRoleOption;
|
|
29
|
+
function createMentionableOption(data) {
|
|
30
|
+
return { ...data, type: v10_1.ApplicationCommandOptionType.Mentionable };
|
|
31
|
+
}
|
|
32
|
+
exports.createMentionableOption = createMentionableOption;
|
|
33
|
+
function createNumberOption(data) {
|
|
34
|
+
return { ...data, type: v10_1.ApplicationCommandOptionType.Number };
|
|
35
|
+
}
|
|
36
|
+
exports.createNumberOption = createNumberOption;
|
|
37
|
+
function createAttachmentOption(data) {
|
|
38
|
+
return { ...data, type: v10_1.ApplicationCommandOptionType.Attachment };
|
|
39
|
+
}
|
|
40
|
+
exports.createAttachmentOption = createAttachmentOption;
|
|
41
|
+
function createMiddleware(data) {
|
|
42
|
+
return data;
|
|
43
|
+
}
|
|
44
|
+
exports.createMiddleware = createMiddleware;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { BaseClient } from '../../client/base';
|
|
2
|
+
import type { RegisteredMiddlewares } from '../decorators';
|
|
3
|
+
export type OKFunction<T> = (value: T) => void;
|
|
4
|
+
export type StopFunction = (error: Error) => void;
|
|
5
|
+
export type NextFunction<T = unknown> = (data: T) => void;
|
|
6
|
+
export type PassFunction = () => void;
|
|
7
|
+
export interface GlobalMetadata {
|
|
8
|
+
}
|
|
9
|
+
export interface DefaultLocale {
|
|
10
|
+
}
|
|
11
|
+
export interface ExtendContext {
|
|
12
|
+
}
|
|
13
|
+
export interface UsingClient extends BaseClient {
|
|
14
|
+
}
|
|
15
|
+
export type ParseClient<T extends BaseClient> = T;
|
|
16
|
+
export type MiddlewareContext<T = any, C = any> = (context: {
|
|
17
|
+
context: C;
|
|
18
|
+
next: NextFunction<T>;
|
|
19
|
+
stop: StopFunction;
|
|
20
|
+
pass: PassFunction;
|
|
21
|
+
}) => any;
|
|
22
|
+
export type MetadataMiddleware<T extends MiddlewareContext> = Parameters<Parameters<T>[0]['next']>[0];
|
|
23
|
+
export type CommandMetadata<T extends readonly (keyof RegisteredMiddlewares)[]> = T extends readonly [
|
|
24
|
+
infer first,
|
|
25
|
+
...infer rest
|
|
26
|
+
] ? first extends keyof RegisteredMiddlewares ? {
|
|
27
|
+
[key in first]: MetadataMiddleware<RegisteredMiddlewares[first]>;
|
|
28
|
+
} & (rest extends readonly (keyof RegisteredMiddlewares)[] ? CommandMetadata<rest> : {}) : {} : {};
|
|
29
|
+
export type OnOptionsReturnObject = Record<string, {
|
|
30
|
+
failed: false;
|
|
31
|
+
value: unknown;
|
|
32
|
+
} | {
|
|
33
|
+
failed: true;
|
|
34
|
+
value: Error;
|
|
35
|
+
}>;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { ApplicationCommandType, type LocaleString, type PermissionStrings } from '../common';
|
|
2
|
+
import type { CommandOption, OptionsRecord, SubCommand } from './applications/chat';
|
|
3
|
+
import type { MiddlewareContext } from './applications/shared';
|
|
4
|
+
export interface RegisteredMiddlewares {
|
|
5
|
+
}
|
|
6
|
+
type DeclareOptions = {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
permissions?: PermissionStrings | bigint;
|
|
10
|
+
defaultPermissions?: PermissionStrings | bigint;
|
|
11
|
+
guildId?: string[];
|
|
12
|
+
dm?: boolean;
|
|
13
|
+
nsfw?: boolean;
|
|
14
|
+
} | (Omit<{
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
permissions?: PermissionStrings | bigint;
|
|
18
|
+
defaultPermissions?: PermissionStrings | bigint;
|
|
19
|
+
guildId?: string[];
|
|
20
|
+
dm?: boolean;
|
|
21
|
+
nsfw?: boolean;
|
|
22
|
+
}, 'type' | 'description'> & {
|
|
23
|
+
type: ApplicationCommandType.User | ApplicationCommandType.Message;
|
|
24
|
+
});
|
|
25
|
+
export declare function Locales({ name: names, description: descriptions, }: {
|
|
26
|
+
name?: [language: LocaleString, value: string][];
|
|
27
|
+
description?: [language: LocaleString, value: string][];
|
|
28
|
+
}): <T extends new (...args: any[]) => {}>(target: T) => {
|
|
29
|
+
new (...args: any[]): {
|
|
30
|
+
name_localizations: {
|
|
31
|
+
[k: string]: string;
|
|
32
|
+
} | undefined;
|
|
33
|
+
description_localizations: {
|
|
34
|
+
[k: string]: string;
|
|
35
|
+
} | undefined;
|
|
36
|
+
};
|
|
37
|
+
} & T;
|
|
38
|
+
export declare function LocalesT(name: string, description: string): <T extends new (...args: any[]) => {}>(target: T) => {
|
|
39
|
+
new (...args: any[]): {
|
|
40
|
+
__t: {
|
|
41
|
+
name: string;
|
|
42
|
+
description: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
} & T;
|
|
46
|
+
export declare function GroupsT(groups: Record<string, {
|
|
47
|
+
name: string;
|
|
48
|
+
description: string;
|
|
49
|
+
defaultDescription: string;
|
|
50
|
+
}>): <T extends new (...args: any[]) => {}>(target: T) => {
|
|
51
|
+
new (...args: any[]): {
|
|
52
|
+
__tGroups: Record<string, {
|
|
53
|
+
name: string;
|
|
54
|
+
description: string;
|
|
55
|
+
defaultDescription: string;
|
|
56
|
+
}>;
|
|
57
|
+
};
|
|
58
|
+
} & T;
|
|
59
|
+
export declare function Groups(groups: Record<string, {
|
|
60
|
+
name?: [language: LocaleString, value: string][];
|
|
61
|
+
description?: [language: LocaleString, value: string][];
|
|
62
|
+
defaultDescription: string;
|
|
63
|
+
}>): <T extends new (...args: any[]) => {}>(target: T) => {
|
|
64
|
+
new (...args: any[]): {
|
|
65
|
+
groups: Record<string, {
|
|
66
|
+
name?: [language: "id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", value: string][] | undefined;
|
|
67
|
+
description?: [language: "id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", value: string][] | undefined;
|
|
68
|
+
defaultDescription: string;
|
|
69
|
+
}>;
|
|
70
|
+
};
|
|
71
|
+
} & T;
|
|
72
|
+
export declare function Group(groupName: string): <T extends new (...args: any[]) => {}>(target: T) => {
|
|
73
|
+
new (...args: any[]): {
|
|
74
|
+
group: string;
|
|
75
|
+
};
|
|
76
|
+
} & T;
|
|
77
|
+
export declare function Options(options: (new () => SubCommand)[] | OptionsRecord): <T extends new (...args: any[]) => {}>(target: T) => {
|
|
78
|
+
new (...args: any[]): {
|
|
79
|
+
options: SubCommand[] | CommandOption[];
|
|
80
|
+
};
|
|
81
|
+
} & T;
|
|
82
|
+
export declare function AutoLoad(): <T extends new (...args: any[]) => {}>(target: T) => {
|
|
83
|
+
new (...args: any[]): {
|
|
84
|
+
__d: boolean;
|
|
85
|
+
};
|
|
86
|
+
} & T;
|
|
87
|
+
export type ParseMiddlewares<T extends Record<string, MiddlewareContext>> = {
|
|
88
|
+
[k in keyof T]: T[k];
|
|
89
|
+
};
|
|
90
|
+
export declare function Middlewares(cbs: readonly (keyof RegisteredMiddlewares)[]): <T extends new (...args: any[]) => {}>(target: T) => {
|
|
91
|
+
new (...args: any[]): {
|
|
92
|
+
middlewares: readonly never[];
|
|
93
|
+
};
|
|
94
|
+
} & T;
|
|
95
|
+
export declare function Declare(declare: DeclareOptions): <T extends new (...args: any[]) => {}>(target: T) => {
|
|
96
|
+
new (...args: any[]): {
|
|
97
|
+
name: string;
|
|
98
|
+
dm: boolean;
|
|
99
|
+
nsfw: boolean | undefined;
|
|
100
|
+
guild_id: string[] | undefined;
|
|
101
|
+
default_member_permissions: string | bigint | undefined;
|
|
102
|
+
permissions: bigint | undefined;
|
|
103
|
+
description: string;
|
|
104
|
+
type: ApplicationCommandType;
|
|
105
|
+
};
|
|
106
|
+
} & T;
|
|
107
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Declare = exports.Middlewares = exports.AutoLoad = exports.Options = exports.Group = exports.Groups = exports.GroupsT = exports.LocalesT = exports.Locales = void 0;
|
|
4
|
+
const common_1 = require("../common");
|
|
5
|
+
function Locales({ name: names, description: descriptions, }) {
|
|
6
|
+
return (target) => class extends target {
|
|
7
|
+
name_localizations = names ? Object.fromEntries(names) : undefined;
|
|
8
|
+
description_localizations = descriptions ? Object.fromEntries(descriptions) : undefined;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
exports.Locales = Locales;
|
|
12
|
+
function LocalesT(name, description) {
|
|
13
|
+
return (target) => class extends target {
|
|
14
|
+
__t = { name, description };
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
exports.LocalesT = LocalesT;
|
|
18
|
+
function GroupsT(groups) {
|
|
19
|
+
return (target) => class extends target {
|
|
20
|
+
__tGroups = groups;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
exports.GroupsT = GroupsT;
|
|
24
|
+
function Groups(groups) {
|
|
25
|
+
return (target) => class extends target {
|
|
26
|
+
groups = groups;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
exports.Groups = Groups;
|
|
30
|
+
function Group(groupName) {
|
|
31
|
+
return (target) => class extends target {
|
|
32
|
+
group = groupName;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
exports.Group = Group;
|
|
36
|
+
function Options(options) {
|
|
37
|
+
return (target) => class extends target {
|
|
38
|
+
options = Array.isArray(options)
|
|
39
|
+
? options.map(x => new x())
|
|
40
|
+
: Object.entries(options).map(([name, option]) => {
|
|
41
|
+
return {
|
|
42
|
+
name,
|
|
43
|
+
...option,
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
exports.Options = Options;
|
|
49
|
+
function AutoLoad() {
|
|
50
|
+
return (target) => class extends target {
|
|
51
|
+
__d = true;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
exports.AutoLoad = AutoLoad;
|
|
55
|
+
function Middlewares(cbs) {
|
|
56
|
+
return (target) => class extends target {
|
|
57
|
+
middlewares = cbs;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
exports.Middlewares = Middlewares;
|
|
61
|
+
function Declare(declare) {
|
|
62
|
+
return (target) => class extends target {
|
|
63
|
+
name = declare.name;
|
|
64
|
+
dm = !!declare.dm;
|
|
65
|
+
nsfw = declare.nsfw;
|
|
66
|
+
guild_id = declare.guildId;
|
|
67
|
+
default_member_permissions = Array.isArray(declare.defaultPermissions)
|
|
68
|
+
? declare.defaultPermissions?.reduce((acc, prev) => acc | common_1.PermissionFlagsBits[prev], BigInt(0)).toString()
|
|
69
|
+
: declare.defaultPermissions;
|
|
70
|
+
permissions = Array.isArray(declare.permissions)
|
|
71
|
+
? declare.permissions?.reduce((acc, prev) => acc | common_1.PermissionFlagsBits[prev], BigInt(0))
|
|
72
|
+
: declare.permissions;
|
|
73
|
+
description = '';
|
|
74
|
+
type = common_1.ApplicationCommandType.ChatInput;
|
|
75
|
+
constructor(...args) {
|
|
76
|
+
super(...args);
|
|
77
|
+
if ('description' in declare)
|
|
78
|
+
this.description = declare.description;
|
|
79
|
+
if ('type' in declare)
|
|
80
|
+
this.type = declare.type;
|
|
81
|
+
// check if all properties are valid
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
exports.Declare = Declare;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { BaseClient } from '../client/base';
|
|
2
|
+
import type { Logger } from '../common';
|
|
3
|
+
import { BaseHandler } from '../common';
|
|
4
|
+
import { Command } from './applications/chat';
|
|
5
|
+
import { ContextMenuCommand } from './applications/menu';
|
|
6
|
+
export declare class CommandHandler extends BaseHandler {
|
|
7
|
+
protected logger: Logger;
|
|
8
|
+
values: (Command | ContextMenuCommand)[];
|
|
9
|
+
protected filter: (path: string) => boolean;
|
|
10
|
+
constructor(logger: Logger);
|
|
11
|
+
reload(resolve: string | Command): Promise<void>;
|
|
12
|
+
reloadAll(stopIfFail?: boolean): Promise<void>;
|
|
13
|
+
load(commandsDir: string, client: BaseClient): Promise<(Command | ContextMenuCommand)[]>;
|
|
14
|
+
private __parseLocales;
|
|
15
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommandHandler = void 0;
|
|
4
|
+
const node_path_1 = require("node:path");
|
|
5
|
+
const common_1 = require("../common");
|
|
6
|
+
const chat_1 = require("./applications/chat");
|
|
7
|
+
const menu_1 = require("./applications/menu");
|
|
8
|
+
class CommandHandler extends common_1.BaseHandler {
|
|
9
|
+
logger;
|
|
10
|
+
values = [];
|
|
11
|
+
filter = (path) => path.endsWith('.js') || path.endsWith('.ts');
|
|
12
|
+
constructor(logger) {
|
|
13
|
+
super(logger);
|
|
14
|
+
this.logger = logger;
|
|
15
|
+
}
|
|
16
|
+
async reload(resolve) {
|
|
17
|
+
if (typeof resolve === 'string') {
|
|
18
|
+
return this.values.find(x => x.name === resolve)?.reload();
|
|
19
|
+
}
|
|
20
|
+
return resolve.reload();
|
|
21
|
+
}
|
|
22
|
+
async reloadAll(stopIfFail = true) {
|
|
23
|
+
for (const command of this.values) {
|
|
24
|
+
try {
|
|
25
|
+
await this.reload(command.name);
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
if (stopIfFail) {
|
|
29
|
+
throw e;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async load(commandsDir, client) {
|
|
35
|
+
const result = (await this.loadFilesK(await this.getFiles(commandsDir))).filter(x => x.file);
|
|
36
|
+
this.values = [];
|
|
37
|
+
for (const command of result) {
|
|
38
|
+
let commandInstance;
|
|
39
|
+
try {
|
|
40
|
+
commandInstance = new command.file();
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
if (e instanceof Error && e.message === 'command.file is not a constructor') {
|
|
44
|
+
this.logger.warn(`${command.path
|
|
45
|
+
.split(process.cwd())
|
|
46
|
+
.slice(1)
|
|
47
|
+
.join(process.cwd())} doesn't export the class by \`export default <Command>\``);
|
|
48
|
+
}
|
|
49
|
+
else
|
|
50
|
+
this.logger.warn(e, command);
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (commandInstance instanceof menu_1.ContextMenuCommand) {
|
|
54
|
+
this.values.push(commandInstance);
|
|
55
|
+
commandInstance.__filePath = command.path;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (!(commandInstance instanceof chat_1.Command)) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
commandInstance.__filePath = command.path;
|
|
62
|
+
commandInstance.options ??= [];
|
|
63
|
+
if (commandInstance.__d) {
|
|
64
|
+
const options = await this.getFiles((0, node_path_1.dirname)(command.path));
|
|
65
|
+
for (const option of options) {
|
|
66
|
+
if (command.name === (0, node_path_1.basename)(option)) {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
try {
|
|
70
|
+
const subCommand = new (result.find(x => x.path === option).file)();
|
|
71
|
+
if (subCommand instanceof chat_1.SubCommand) {
|
|
72
|
+
commandInstance.options.push(subCommand);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
//pass
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
for (const option of commandInstance.options ?? []) {
|
|
81
|
+
if (option instanceof chat_1.SubCommand) {
|
|
82
|
+
option.middlewares = (commandInstance.middlewares ?? []).concat(option.middlewares ?? []);
|
|
83
|
+
option.onMiddlewaresError =
|
|
84
|
+
option.onMiddlewaresError?.bind(option) ?? commandInstance.onMiddlewaresError?.bind(commandInstance);
|
|
85
|
+
option.onRunError = option.onRunError?.bind(option) ?? commandInstance.onRunError?.bind(commandInstance);
|
|
86
|
+
option.onOptionsError =
|
|
87
|
+
option.onOptionsError?.bind(option) ?? commandInstance.onOptionsError?.bind(commandInstance);
|
|
88
|
+
option.onInternalError =
|
|
89
|
+
option.onInternalError?.bind(option) ?? commandInstance.onInternalError?.bind(commandInstance);
|
|
90
|
+
option.onAfterRun = option.onAfterRun?.bind(option) ?? commandInstance.onAfterRun?.bind(commandInstance);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
this.values.push(commandInstance);
|
|
94
|
+
this.__parseLocales(commandInstance, client);
|
|
95
|
+
for (const i of commandInstance.options ?? []) {
|
|
96
|
+
if (i instanceof chat_1.SubCommand) {
|
|
97
|
+
this.__parseLocales(i, client);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return this.values;
|
|
102
|
+
}
|
|
103
|
+
__parseLocales(command, client) {
|
|
104
|
+
if (command.__t) {
|
|
105
|
+
command.name_localizations = {};
|
|
106
|
+
command.description_localizations = {};
|
|
107
|
+
for (const locale of Object.keys(client.langs.values)) {
|
|
108
|
+
const valueName = client.langs.getKey(locale, command.__t.name);
|
|
109
|
+
if (valueName) {
|
|
110
|
+
command.name_localizations[locale] = valueName;
|
|
111
|
+
}
|
|
112
|
+
const valueKey = client.langs.getKey(locale, command.__t.description);
|
|
113
|
+
if (valueKey) {
|
|
114
|
+
command.description_localizations[locale] = valueKey;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (command instanceof chat_1.Command && command.__tGroups) {
|
|
119
|
+
command.groups = {};
|
|
120
|
+
for (const locale of Object.keys(client.langs.values)) {
|
|
121
|
+
for (const group in command.__tGroups) {
|
|
122
|
+
command.groups[group] ??= {
|
|
123
|
+
defaultDescription: command.__tGroups[group].defaultDescription,
|
|
124
|
+
description: [],
|
|
125
|
+
name: [],
|
|
126
|
+
};
|
|
127
|
+
const valueName = client.langs.getKey(locale, command.__tGroups[group].name);
|
|
128
|
+
if (valueName) {
|
|
129
|
+
command.groups[group].name.push([locale, valueName]);
|
|
130
|
+
}
|
|
131
|
+
const valueKey = client.langs.getKey(locale, command.__tGroups[group].description);
|
|
132
|
+
if (valueKey) {
|
|
133
|
+
command.groups[group].description.push([locale, valueKey]);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
exports.CommandHandler = CommandHandler;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './applications/chat';
|
|
2
|
+
export * from './applications/chatcontext';
|
|
3
|
+
export * from './applications/menu';
|
|
4
|
+
export * from './applications/menucontext';
|
|
5
|
+
export * from './applications/options';
|
|
6
|
+
export * from './applications/shared';
|
|
7
|
+
export * from './decorators';
|
|
8
|
+
export * from './optionresolver';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./applications/chat"), exports);
|
|
18
|
+
__exportStar(require("./applications/chatcontext"), exports);
|
|
19
|
+
__exportStar(require("./applications/menu"), exports);
|
|
20
|
+
__exportStar(require("./applications/menucontext"), exports);
|
|
21
|
+
__exportStar(require("./applications/options"), exports);
|
|
22
|
+
__exportStar(require("./applications/shared"), exports);
|
|
23
|
+
__exportStar(require("./decorators"), exports);
|
|
24
|
+
__exportStar(require("./optionresolver"), exports);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { APIApplicationCommandInteractionDataOption, APIAttachment, APIInteractionDataResolved, MakeRequired } from '../common';
|
|
2
|
+
import { ApplicationCommandOptionType } from '../common';
|
|
3
|
+
import type { AllChannels } from '../structures';
|
|
4
|
+
import { GuildRole, InteractionGuildMember, User } from '../structures';
|
|
5
|
+
import type { Command, CommandAutocompleteOption, SubCommand } from './applications/chat';
|
|
6
|
+
import type { UsingClient } from './applications/shared';
|
|
7
|
+
export declare class OptionResolver {
|
|
8
|
+
private client;
|
|
9
|
+
parent?: Command | undefined;
|
|
10
|
+
guildId?: string | undefined;
|
|
11
|
+
resolved?: APIInteractionDataResolved | undefined;
|
|
12
|
+
readonly options: OptionResolved[];
|
|
13
|
+
hoistedOptions: OptionResolved[];
|
|
14
|
+
private subCommand;
|
|
15
|
+
private group;
|
|
16
|
+
constructor(client: UsingClient, options: APIApplicationCommandInteractionDataOption[], parent?: Command | undefined, guildId?: string | undefined, resolved?: APIInteractionDataResolved | undefined);
|
|
17
|
+
get fullCommandName(): string;
|
|
18
|
+
getCommand(): SubCommand | Command | undefined;
|
|
19
|
+
getAutocompleteValue(): string | undefined;
|
|
20
|
+
getAutocomplete(): CommandAutocompleteOption | undefined;
|
|
21
|
+
getParent(): string | undefined;
|
|
22
|
+
getSubCommand(): string | null;
|
|
23
|
+
getGroup(): string | null;
|
|
24
|
+
get(name: string): OptionResolved | undefined;
|
|
25
|
+
getHoisted(name: string): OptionResolved | undefined;
|
|
26
|
+
getValue(name: string): string | number | boolean | APIAttachment | InteractionGuildMember | User | import("../structures").BaseChannel<import("discord-api-types/payloads/v10/channel").ChannelType> | import("../structures").DMChannel | import("../structures").CategoryChannel | GuildRole | undefined;
|
|
27
|
+
private getTypedOption;
|
|
28
|
+
getChannel(name: string, required?: true): AllChannels;
|
|
29
|
+
getString(name: string, required?: true): string;
|
|
30
|
+
transformOption(option: APIApplicationCommandInteractionDataOption, resolved?: APIInteractionDataResolved): OptionResolved;
|
|
31
|
+
}
|
|
32
|
+
export interface OptionResolved {
|
|
33
|
+
name: string;
|
|
34
|
+
type: ApplicationCommandOptionType;
|
|
35
|
+
value?: string | number | boolean;
|
|
36
|
+
options?: OptionResolved[];
|
|
37
|
+
user?: User;
|
|
38
|
+
member?: InteractionGuildMember;
|
|
39
|
+
attachment?: APIAttachment;
|
|
40
|
+
channel?: AllChannels;
|
|
41
|
+
role?: GuildRole;
|
|
42
|
+
focused?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export type OptionResolvedWithValue = MakeRequired<Pick<OptionResolved, 'name' | 'value' | 'focused'>, 'value'> & {
|
|
45
|
+
type: ApplicationCommandOptionType.Boolean | ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number | ApplicationCommandOptionType.String;
|
|
46
|
+
};
|
|
47
|
+
export type OptionResolvedWithProp = Exclude<OptionResolved, {
|
|
48
|
+
type: ApplicationCommandOptionType.Boolean | ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number | ApplicationCommandOptionType.String;
|
|
49
|
+
}>;
|