seyfert 2.0.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 +9 -3
- package/lib/api/Routes/invites.d.ts +3 -4
- package/lib/api/Routes/skus.d.ts +10 -0
- package/lib/api/Routes/skus.js +2 -0
- 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 +26 -22
- package/lib/api/shared.d.ts +2 -2
- package/lib/api/utils/constants.d.ts +3 -1
- package/lib/api/utils/constants.js +3 -2
- package/lib/builders/ActionRow.d.ts +1 -1
- package/lib/builders/Attachment.d.ts +3 -3
- package/lib/builders/Attachment.js +13 -13
- 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 +12 -12
- package/lib/cache/index.js +48 -39
- 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 +10 -15
- package/lib/client/base.js +48 -44
- package/lib/client/client.d.ts +4 -4
- package/lib/client/client.js +37 -38
- package/lib/client/collectors.js +1 -1
- package/lib/client/httpclient.d.ts +1 -1
- package/lib/client/httpclient.js +2 -2
- package/lib/client/transformers.d.ts +37 -34
- package/lib/client/transformers.js +66 -63
- package/lib/client/workerclient.d.ts +13 -13
- package/lib/client/workerclient.js +182 -65
- 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 +46 -0
- package/lib/commands/applications/entryPoint.js +56 -0
- package/lib/commands/applications/entrycontext.d.ts +40 -0
- package/lib/commands/applications/entrycontext.js +85 -0
- 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 +7 -6
- package/lib/commands/applications/shared.d.ts +5 -2
- package/lib/commands/basecontext.d.ts +1 -1
- package/lib/commands/decorators.d.ts +20 -26
- package/lib/commands/decorators.js +8 -4
- package/lib/commands/handle.d.ts +13 -12
- package/lib/commands/handle.js +133 -65
- package/lib/commands/handler.d.ts +9 -7
- package/lib/commands/handler.js +27 -18
- package/lib/commands/index.d.ts +2 -0
- package/lib/commands/index.js +2 -0
- package/lib/commands/optionresolver.d.ts +4 -4
- package/lib/commands/optionresolver.js +4 -4
- package/lib/common/bot/watcher.d.ts +1 -1
- 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 +14 -6
- package/lib/common/it/utils.js +62 -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 +3 -3
- 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/deps/mixer.js +6 -1
- package/lib/events/handler.d.ts +5 -5
- package/lib/events/handler.js +69 -19
- 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/custom.d.ts +1 -0
- package/lib/events/hooks/custom.js +5 -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/subscriptions.d.ts +35 -0
- package/lib/events/hooks/subscriptions.js +16 -0
- 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 +39 -16
- package/lib/structures/Interaction.js +82 -26
- package/lib/structures/Message.d.ts +4 -10
- package/lib/structures/Message.js +5 -8
- 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 +8 -7
- package/lib/structures/extra/BaseGuild.d.ts +11 -1
- package/lib/structures/extra/BaseGuild.js +27 -0
- 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 +71 -6
- package/lib/types/payloads/_interactions/_applicationCommands/chatInput.d.ts +6 -1
- package/lib/types/payloads/_interactions/applicationCommands.d.ts +41 -6
- package/lib/types/payloads/_interactions/applicationCommands.js +28 -1
- package/lib/types/payloads/_interactions/base.d.ts +1 -1
- package/lib/types/payloads/_interactions/responses.d.ts +74 -2
- package/lib/types/payloads/_interactions/responses.js +4 -0
- package/lib/types/payloads/channel.d.ts +46 -6
- package/lib/types/payloads/channel.js +5 -1
- 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/monetization.d.ts +29 -1
- package/lib/types/payloads/monetization.js +10 -1
- 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 +5 -18
- 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/interactions.d.ts +30 -8
- package/lib/types/rest/monetization.d.ts +22 -1
- 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 +3 -3
- package/lib/types/utils/index.d.ts +27 -7
- package/lib/types/utils/index.js +25 -6
- package/lib/websocket/SharedTypes.d.ts +18 -3
- package/lib/websocket/constants/index.d.ts +3 -2
- package/lib/websocket/constants/index.js +4 -4
- package/lib/websocket/discord/basesocket.d.ts +1 -1
- package/lib/websocket/discord/shard.d.ts +4 -3
- package/lib/websocket/discord/shard.js +47 -24
- package/lib/websocket/discord/sharder.d.ts +9 -6
- package/lib/websocket/discord/sharder.js +92 -17
- package/lib/websocket/discord/shared.d.ts +12 -3
- package/lib/websocket/discord/socket/custom.d.ts +1 -1
- package/lib/websocket/discord/socket/custom.js +70 -40
- package/lib/websocket/discord/worker.d.ts +9 -2
- package/lib/websocket/discord/workermanager.d.ts +42 -16
- package/lib/websocket/discord/workermanager.js +170 -46
- package/lib/websocket/structures/timeout.d.ts +4 -5
- package/lib/websocket/structures/timeout.js +23 -24
- package/package.json +72 -65
- package/lib/cache/resources/threads.d.ts +0 -14
- package/lib/cache/resources/threads.js +0 -32
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type PermissionStrings } from '../../common';
|
|
2
|
+
import { ApplicationCommandType, type ApplicationIntegrationType, type EntryPointCommandHandlerType, type InteractionContextType, type LocaleString } from '../../types';
|
|
3
|
+
import type { RegisteredMiddlewares } from '../decorators';
|
|
4
|
+
import type { EntryPointContext } from './entrycontext';
|
|
5
|
+
import type { ExtraProps, UsingClient } from './shared';
|
|
6
|
+
export declare abstract class EntryPointCommand {
|
|
7
|
+
middlewares: (keyof RegisteredMiddlewares)[];
|
|
8
|
+
__filePath?: string;
|
|
9
|
+
__t?: {
|
|
10
|
+
name: string | undefined;
|
|
11
|
+
description: string | undefined;
|
|
12
|
+
};
|
|
13
|
+
name: string;
|
|
14
|
+
type: ApplicationCommandType;
|
|
15
|
+
nsfw?: boolean;
|
|
16
|
+
integrationTypes: ApplicationIntegrationType[];
|
|
17
|
+
contexts: InteractionContextType[];
|
|
18
|
+
description: string;
|
|
19
|
+
botPermissions?: bigint;
|
|
20
|
+
dm?: boolean;
|
|
21
|
+
handler: EntryPointCommandHandlerType;
|
|
22
|
+
name_localizations?: Partial<Record<LocaleString, string>>;
|
|
23
|
+
description_localizations?: Partial<Record<LocaleString, string>>;
|
|
24
|
+
props: ExtraProps;
|
|
25
|
+
toJSON(): {
|
|
26
|
+
handler: EntryPointCommandHandlerType;
|
|
27
|
+
name: string;
|
|
28
|
+
type: ApplicationCommandType;
|
|
29
|
+
nsfw: boolean | undefined;
|
|
30
|
+
default_member_permissions: null;
|
|
31
|
+
guild_id: null;
|
|
32
|
+
description: string;
|
|
33
|
+
name_localizations: Partial<Record<"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", string>> | undefined;
|
|
34
|
+
description_localizations: Partial<Record<"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", string>> | undefined;
|
|
35
|
+
dm_permission: boolean | undefined;
|
|
36
|
+
contexts: InteractionContextType[];
|
|
37
|
+
integration_types: ApplicationIntegrationType[];
|
|
38
|
+
};
|
|
39
|
+
reload(): Promise<void>;
|
|
40
|
+
abstract run?(context: EntryPointContext): any;
|
|
41
|
+
onAfterRun?(context: EntryPointContext, error: unknown | undefined): any;
|
|
42
|
+
onRunError(context: EntryPointContext<never>, error: unknown): any;
|
|
43
|
+
onMiddlewaresError(context: EntryPointContext<never>, error: string): any;
|
|
44
|
+
onBotPermissionsFail(context: EntryPointContext<never>, permissions: PermissionStrings): any;
|
|
45
|
+
onInternalError(client: UsingClient, command: EntryPointCommand, error?: unknown): any;
|
|
46
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EntryPointCommand = void 0;
|
|
4
|
+
const common_1 = require("../../common");
|
|
5
|
+
const types_1 = require("../../types");
|
|
6
|
+
class EntryPointCommand {
|
|
7
|
+
middlewares = [];
|
|
8
|
+
__filePath;
|
|
9
|
+
__t;
|
|
10
|
+
name;
|
|
11
|
+
type = types_1.ApplicationCommandType.PrimaryEntryPoint;
|
|
12
|
+
nsfw;
|
|
13
|
+
integrationTypes = [];
|
|
14
|
+
contexts = [];
|
|
15
|
+
description;
|
|
16
|
+
botPermissions;
|
|
17
|
+
dm;
|
|
18
|
+
handler;
|
|
19
|
+
name_localizations;
|
|
20
|
+
description_localizations;
|
|
21
|
+
props = {};
|
|
22
|
+
toJSON() {
|
|
23
|
+
return {
|
|
24
|
+
handler: this.handler,
|
|
25
|
+
name: this.name,
|
|
26
|
+
type: this.type,
|
|
27
|
+
nsfw: this.nsfw,
|
|
28
|
+
default_member_permissions: null,
|
|
29
|
+
guild_id: null,
|
|
30
|
+
description: this.description,
|
|
31
|
+
name_localizations: this.name_localizations,
|
|
32
|
+
description_localizations: this.description_localizations,
|
|
33
|
+
dm_permission: this.dm,
|
|
34
|
+
contexts: this.contexts,
|
|
35
|
+
integration_types: this.integrationTypes,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
async reload() {
|
|
39
|
+
delete require.cache[this.__filePath];
|
|
40
|
+
const __tempCommand = await (0, common_1.magicImport)(this.__filePath).then(x => x.default ?? x);
|
|
41
|
+
Object.setPrototypeOf(this, __tempCommand.prototype);
|
|
42
|
+
}
|
|
43
|
+
onRunError(context, error) {
|
|
44
|
+
context.client.logger.fatal(`${this.name}.<onRunError>`, context.author.id, error);
|
|
45
|
+
}
|
|
46
|
+
onMiddlewaresError(context, error) {
|
|
47
|
+
context.client.logger.fatal(`${this.name}.<onMiddlewaresError>`, context.author.id, error);
|
|
48
|
+
}
|
|
49
|
+
onBotPermissionsFail(context, permissions) {
|
|
50
|
+
context.client.logger.fatal(`${this.name}.<onBotPermissionsFail>`, context.author.id, permissions);
|
|
51
|
+
}
|
|
52
|
+
onInternalError(client, command, error) {
|
|
53
|
+
client.logger.fatal(command.name, error);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.EntryPointCommand = EntryPointCommand;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ReturnCache } from '../..';
|
|
2
|
+
import type { GuildMemberStructure, GuildStructure, MessageStructure, WebhookMessageStructure } from '../../client/transformers';
|
|
3
|
+
import type { InteractionCreateBodyRequest, InteractionMessageUpdateBodyRequest, ModalCreateBodyRequest, UnionToTuple, When } from '../../common';
|
|
4
|
+
import type { AllChannels, EntryPointInteraction } from '../../structures';
|
|
5
|
+
import { BaseContext } from '../basecontext';
|
|
6
|
+
import type { RegisteredMiddlewares } from '../decorators';
|
|
7
|
+
import type { EntryPointCommand } from './entryPoint';
|
|
8
|
+
import type { CommandMetadata, ExtendContext, GlobalMetadata, UsingClient } from './shared';
|
|
9
|
+
export interface EntryPointContext<M extends keyof RegisteredMiddlewares = never> extends BaseContext, ExtendContext {
|
|
10
|
+
}
|
|
11
|
+
export declare class EntryPointContext<M extends keyof RegisteredMiddlewares = never> extends BaseContext {
|
|
12
|
+
readonly client: UsingClient;
|
|
13
|
+
readonly interaction: EntryPointInteraction;
|
|
14
|
+
readonly shardId: number;
|
|
15
|
+
readonly command: EntryPointCommand;
|
|
16
|
+
constructor(client: UsingClient, interaction: EntryPointInteraction, shardId: number, command: EntryPointCommand);
|
|
17
|
+
metadata: CommandMetadata<UnionToTuple<M>>;
|
|
18
|
+
globalMetadata: GlobalMetadata;
|
|
19
|
+
get t(): import("../..").__InternalParseLocale<import("./shared").DefaultLocale> & {
|
|
20
|
+
get(locale?: string): import("./shared").DefaultLocale;
|
|
21
|
+
};
|
|
22
|
+
get fullCommandName(): string;
|
|
23
|
+
write<WR extends boolean = false>(body: InteractionCreateBodyRequest, withResponse?: WR): Promise<When<WR, WebhookMessageStructure, void | WebhookMessageStructure>>;
|
|
24
|
+
modal(body: ModalCreateBodyRequest): Promise<undefined>;
|
|
25
|
+
deferReply<WR extends boolean = false>(ephemeral?: boolean): Promise<When<WR, WebhookMessageStructure, undefined>>;
|
|
26
|
+
editResponse(body: InteractionMessageUpdateBodyRequest): Promise<import("../..").WebhookMessage>;
|
|
27
|
+
deleteResponse(): Promise<void | undefined>;
|
|
28
|
+
editOrReply<WR extends boolean = false>(body: InteractionCreateBodyRequest | InteractionMessageUpdateBodyRequest, withResponse?: WR): Promise<When<WR, WebhookMessageStructure | MessageStructure, void | WebhookMessageStructure | MessageStructure>>;
|
|
29
|
+
fetchResponse(): Promise<import("../..").WebhookMessage | undefined>;
|
|
30
|
+
channel(mode?: 'rest' | 'flow'): Promise<AllChannels>;
|
|
31
|
+
channel(mode?: 'cache'): ReturnCache<AllChannels>;
|
|
32
|
+
me(mode?: 'rest' | 'flow'): Promise<GuildMemberStructure>;
|
|
33
|
+
me(mode?: 'cache'): ReturnCache<GuildMemberStructure | undefined>;
|
|
34
|
+
guild(mode?: 'rest' | 'flow'): Promise<GuildStructure<'cached' | 'api'> | undefined>;
|
|
35
|
+
guild(mode?: 'cache'): ReturnCache<GuildStructure<'cached'> | undefined>;
|
|
36
|
+
get guildId(): string | undefined;
|
|
37
|
+
get channelId(): string;
|
|
38
|
+
get author(): import("../..").User;
|
|
39
|
+
get member(): import("../..").InteractionGuildMember | undefined;
|
|
40
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EntryPointContext = void 0;
|
|
4
|
+
const types_1 = require("../../types");
|
|
5
|
+
const basecontext_1 = require("../basecontext");
|
|
6
|
+
class EntryPointContext extends basecontext_1.BaseContext {
|
|
7
|
+
client;
|
|
8
|
+
interaction;
|
|
9
|
+
shardId;
|
|
10
|
+
command;
|
|
11
|
+
constructor(client, interaction, shardId, command) {
|
|
12
|
+
super(client);
|
|
13
|
+
this.client = client;
|
|
14
|
+
this.interaction = interaction;
|
|
15
|
+
this.shardId = shardId;
|
|
16
|
+
this.command = command;
|
|
17
|
+
}
|
|
18
|
+
metadata = {};
|
|
19
|
+
globalMetadata = {};
|
|
20
|
+
get t() {
|
|
21
|
+
return this.client.t(this.interaction.locale ?? this.client.langs.defaultLang ?? 'en-US');
|
|
22
|
+
}
|
|
23
|
+
get fullCommandName() {
|
|
24
|
+
return this.command.name;
|
|
25
|
+
}
|
|
26
|
+
write(body, withResponse) {
|
|
27
|
+
return this.interaction.write(body, withResponse);
|
|
28
|
+
}
|
|
29
|
+
modal(body) {
|
|
30
|
+
return this.interaction.modal(body);
|
|
31
|
+
}
|
|
32
|
+
deferReply(ephemeral = false) {
|
|
33
|
+
return this.interaction.deferReply(ephemeral ? types_1.MessageFlags.Ephemeral : undefined);
|
|
34
|
+
}
|
|
35
|
+
editResponse(body) {
|
|
36
|
+
return this.interaction.editResponse(body);
|
|
37
|
+
}
|
|
38
|
+
deleteResponse() {
|
|
39
|
+
return this.interaction.deleteResponse();
|
|
40
|
+
}
|
|
41
|
+
editOrReply(body, withResponse) {
|
|
42
|
+
return this.interaction.editOrReply(body, withResponse);
|
|
43
|
+
}
|
|
44
|
+
fetchResponse() {
|
|
45
|
+
return this.interaction.fetchResponse();
|
|
46
|
+
}
|
|
47
|
+
channel(mode = 'cache') {
|
|
48
|
+
if (this.interaction.channel && mode === 'cache')
|
|
49
|
+
return this.client.cache.adapter.isAsync ? Promise.resolve(this.interaction.channel) : this.interaction.channel;
|
|
50
|
+
return this.client.channels.fetch(this.channelId, mode === 'rest');
|
|
51
|
+
}
|
|
52
|
+
me(mode = 'cache') {
|
|
53
|
+
if (!this.guildId)
|
|
54
|
+
return mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve();
|
|
55
|
+
switch (mode) {
|
|
56
|
+
case 'cache':
|
|
57
|
+
return this.client.cache.members?.get(this.client.botId, this.guildId);
|
|
58
|
+
default:
|
|
59
|
+
return this.client.members.fetch(this.guildId, this.client.botId, mode === 'rest');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
guild(mode = 'cache') {
|
|
63
|
+
if (!this.guildId)
|
|
64
|
+
return (mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve());
|
|
65
|
+
switch (mode) {
|
|
66
|
+
case 'cache':
|
|
67
|
+
return this.client.cache.guilds?.get(this.guildId);
|
|
68
|
+
default:
|
|
69
|
+
return this.client.guilds.fetch(this.guildId, mode === 'rest');
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
get guildId() {
|
|
73
|
+
return this.interaction.guildId;
|
|
74
|
+
}
|
|
75
|
+
get channelId() {
|
|
76
|
+
return this.interaction.channelId;
|
|
77
|
+
}
|
|
78
|
+
get author() {
|
|
79
|
+
return this.interaction.user;
|
|
80
|
+
}
|
|
81
|
+
get member() {
|
|
82
|
+
return this.interaction.member;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.EntryPointContext = EntryPointContext;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ApplicationCommandType, ApplicationIntegrationType, InteractionContextType, LocaleString } from '../../types';
|
|
2
1
|
import { type PermissionStrings } from '../../common';
|
|
2
|
+
import type { ApplicationCommandType, ApplicationIntegrationType, InteractionContextType, LocaleString } from '../../types';
|
|
3
3
|
import type { RegisteredMiddlewares } from '../decorators';
|
|
4
4
|
import type { MenuCommandContext } from './menucontext';
|
|
5
5
|
import type { ExtraProps, UsingClient } from './shared';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ContextMenuCommand, ReturnCache } from '../..';
|
|
2
|
+
import { type GuildMemberStructure, type GuildStructure, type MessageStructure, type UserStructure, type WebhookMessageStructure } from '../../client/transformers';
|
|
2
3
|
import { type InteractionCreateBodyRequest, type InteractionMessageUpdateBodyRequest, type ModalCreateBodyRequest, type UnionToTuple, type When } from '../../common';
|
|
3
4
|
import type { AllChannels, MessageCommandInteraction, UserCommandInteraction } from '../../structures';
|
|
4
5
|
import { BaseContext } from '../basecontext';
|
|
5
6
|
import type { RegisteredMiddlewares } from '../decorators';
|
|
6
7
|
import type { CommandMetadata, ExtendContext, GlobalMetadata, UsingClient } from './shared';
|
|
7
|
-
import { type GuildMemberStructure, type GuildStructure, type MessageStructure, type UserStructure, type WebhookMessageStructure } from '../../client/transformers';
|
|
8
8
|
export type InteractionTarget<T> = T extends MessageCommandInteraction ? MessageStructure : UserStructure;
|
|
9
9
|
export interface MenuCommandContext<T extends MessageCommandInteraction | UserCommandInteraction, M extends keyof RegisteredMiddlewares = never> extends BaseContext, ExtendContext {
|
|
10
10
|
}
|
|
@@ -21,12 +21,12 @@ export declare class MenuCommandContext<T extends MessageCommandInteraction | Us
|
|
|
21
21
|
get(locale?: string): import("./shared").DefaultLocale;
|
|
22
22
|
};
|
|
23
23
|
get fullCommandName(): string;
|
|
24
|
-
write<
|
|
25
|
-
modal(body: ModalCreateBodyRequest): Promise<
|
|
26
|
-
deferReply(ephemeral?: boolean): Promise<
|
|
24
|
+
write<WR extends boolean = false>(body: InteractionCreateBodyRequest, withResponse?: WR): Promise<When<WR, WebhookMessageStructure, void | WebhookMessageStructure>>;
|
|
25
|
+
modal(body: ModalCreateBodyRequest): Promise<undefined>;
|
|
26
|
+
deferReply<WR extends boolean = false>(ephemeral?: boolean): Promise<When<WR, WebhookMessageStructure, undefined>>;
|
|
27
27
|
editResponse(body: InteractionMessageUpdateBodyRequest): Promise<import("../..").WebhookMessage>;
|
|
28
28
|
deleteResponse(): Promise<void | undefined>;
|
|
29
|
-
editOrReply<
|
|
29
|
+
editOrReply<WR extends boolean = false>(body: InteractionCreateBodyRequest | InteractionMessageUpdateBodyRequest, withResponse?: WR): Promise<When<WR, WebhookMessageStructure | MessageStructure, void | WebhookMessageStructure | MessageStructure>>;
|
|
30
30
|
fetchResponse(): Promise<import("../..").WebhookMessage | undefined>;
|
|
31
31
|
channel(mode?: 'rest' | 'flow'): Promise<AllChannels>;
|
|
32
32
|
channel(mode?: 'cache'): ReturnCache<AllChannels>;
|
|
@@ -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 {
|
|
2
|
-
import type {
|
|
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;
|
|
@@ -65,4 +65,5 @@ export declare function createNumberOption<T extends SeyfertNumberOption = Seyfe
|
|
|
65
65
|
export declare function createAttachmentOption<T extends SeyfertAttachmentOption = SeyfertAttachmentOption>(data: T): T & {
|
|
66
66
|
readonly type: ApplicationCommandOptionType.Attachment;
|
|
67
67
|
};
|
|
68
|
-
export
|
|
68
|
+
export type AnyContext = CommandContext | MenuCommandContext<MessageCommandInteraction<boolean> | UserCommandInteraction<boolean>> | ComponentContext | ModalContext | EntryPointContext;
|
|
69
|
+
export declare function createMiddleware<T = any, C extends AnyContext = AnyContext>(data: MiddlewareContext<T, C>): MiddlewareContext<T, C>;
|
|
@@ -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,10 +1,16 @@
|
|
|
1
|
-
import { ApplicationCommandType, ApplicationIntegrationType, 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 {
|
|
6
6
|
}
|
|
7
|
-
type
|
|
7
|
+
export type CommandDeclareOptions = DecoratorDeclareOptions | (Omit<DecoratorDeclareOptions, 'description'> & {
|
|
8
|
+
type: ApplicationCommandType.User | ApplicationCommandType.Message;
|
|
9
|
+
}) | (Omit<DecoratorDeclareOptions, 'ignore' | 'aliases' | 'guildId'> & {
|
|
10
|
+
type: ApplicationCommandType.PrimaryEntryPoint;
|
|
11
|
+
handler: EntryPointCommandHandlerType;
|
|
12
|
+
});
|
|
13
|
+
export interface DecoratorDeclareOptions {
|
|
8
14
|
name: string;
|
|
9
15
|
description: string;
|
|
10
16
|
botPermissions?: PermissionStrings | bigint;
|
|
@@ -16,24 +22,12 @@ type DeclareOptions = {
|
|
|
16
22
|
ignore?: IgnoreCommand;
|
|
17
23
|
aliases?: string[];
|
|
18
24
|
props?: ExtraProps;
|
|
19
|
-
}
|
|
20
|
-
name: string;
|
|
21
|
-
description: string;
|
|
22
|
-
botPermissions?: PermissionStrings | bigint;
|
|
23
|
-
defaultMemberPermissions?: PermissionStrings | bigint;
|
|
24
|
-
guildId?: string[];
|
|
25
|
-
nsfw?: boolean;
|
|
26
|
-
integrationTypes?: (keyof typeof ApplicationIntegrationType)[];
|
|
27
|
-
contexts?: (keyof typeof InteractionContextType)[];
|
|
28
|
-
props?: ExtraProps;
|
|
29
|
-
}, 'type' | 'description'> & {
|
|
30
|
-
type: ApplicationCommandType.User | ApplicationCommandType.Message;
|
|
31
|
-
});
|
|
25
|
+
}
|
|
32
26
|
export declare function Locales({ name: names, description: descriptions, }: {
|
|
33
27
|
name?: [language: LocaleString, value: string][];
|
|
34
28
|
description?: [language: LocaleString, value: string][];
|
|
35
29
|
}): <T extends {
|
|
36
|
-
new (...args: any[]):
|
|
30
|
+
new (...args: any[]): object;
|
|
37
31
|
}>(target: T) => {
|
|
38
32
|
new (...args: any[]): {
|
|
39
33
|
name_localizations: {
|
|
@@ -45,7 +39,7 @@ export declare function Locales({ name: names, description: descriptions, }: {
|
|
|
45
39
|
};
|
|
46
40
|
} & T;
|
|
47
41
|
export declare function LocalesT(name?: FlatObjectKeys<DefaultLocale>, description?: FlatObjectKeys<DefaultLocale>): <T extends {
|
|
48
|
-
new (...args: any[]):
|
|
42
|
+
new (...args: any[]): object;
|
|
49
43
|
}>(target: T) => {
|
|
50
44
|
new (...args: any[]): {
|
|
51
45
|
__t: {
|
|
@@ -60,7 +54,7 @@ export declare function GroupsT(groups: Record<string, {
|
|
|
60
54
|
defaultDescription: string;
|
|
61
55
|
aliases?: string[];
|
|
62
56
|
}>): <T extends {
|
|
63
|
-
new (...args: any[]):
|
|
57
|
+
new (...args: any[]): object;
|
|
64
58
|
}>(target: T) => {
|
|
65
59
|
new (...args: any[]): {
|
|
66
60
|
__tGroups: Record<string, {
|
|
@@ -78,7 +72,7 @@ export declare function Groups(groups: Record<string, {
|
|
|
78
72
|
defaultDescription: string;
|
|
79
73
|
aliases?: string[];
|
|
80
74
|
}>): <T extends {
|
|
81
|
-
new (...args: any[]):
|
|
75
|
+
new (...args: any[]): object;
|
|
82
76
|
}>(target: T) => {
|
|
83
77
|
new (...args: any[]): {
|
|
84
78
|
groups: Record<string, {
|
|
@@ -91,21 +85,21 @@ export declare function Groups(groups: Record<string, {
|
|
|
91
85
|
};
|
|
92
86
|
} & T;
|
|
93
87
|
export declare function Group(groupName: string): <T extends {
|
|
94
|
-
new (...args: any[]):
|
|
88
|
+
new (...args: any[]): object;
|
|
95
89
|
}>(target: T) => {
|
|
96
90
|
new (...args: any[]): {
|
|
97
91
|
group: string;
|
|
98
92
|
};
|
|
99
93
|
} & T;
|
|
100
94
|
export declare function Options(options: (new () => SubCommand)[] | OptionsRecord): <T extends {
|
|
101
|
-
new (...args: any[]):
|
|
95
|
+
new (...args: any[]): object;
|
|
102
96
|
}>(target: T) => {
|
|
103
97
|
new (...args: any[]): {
|
|
104
98
|
options: SubCommand[] | CommandOption[];
|
|
105
99
|
};
|
|
106
100
|
} & T;
|
|
107
101
|
export declare function AutoLoad(): <T extends {
|
|
108
|
-
new (...args: any[]):
|
|
102
|
+
new (...args: any[]): object;
|
|
109
103
|
}>(target: T) => {
|
|
110
104
|
new (...args: any[]): {
|
|
111
105
|
__autoload: boolean;
|
|
@@ -115,14 +109,14 @@ export type ParseMiddlewares<T extends Record<string, MiddlewareContext>> = {
|
|
|
115
109
|
[k in keyof T]: T[k];
|
|
116
110
|
};
|
|
117
111
|
export declare function Middlewares(cbs: readonly (keyof RegisteredMiddlewares)[]): <T extends {
|
|
118
|
-
new (...args: any[]):
|
|
112
|
+
new (...args: any[]): object;
|
|
119
113
|
}>(target: T) => {
|
|
120
114
|
new (...args: any[]): {
|
|
121
115
|
middlewares: readonly never[];
|
|
122
116
|
};
|
|
123
117
|
} & T;
|
|
124
|
-
export declare function Declare(declare:
|
|
125
|
-
new (...args: any[]):
|
|
118
|
+
export declare function Declare(declare: CommandDeclareOptions): <T extends {
|
|
119
|
+
new (...args: any[]): object;
|
|
126
120
|
}>(target: T) => {
|
|
127
121
|
new (...args: any[]): {
|
|
128
122
|
name: string;
|
|
@@ -137,6 +131,6 @@ export declare function Declare(declare: DeclareOptions): <T extends {
|
|
|
137
131
|
guildId?: string[];
|
|
138
132
|
ignore?: IgnoreCommand;
|
|
139
133
|
aliases?: string[];
|
|
134
|
+
handler?: EntryPointCommandHandlerType;
|
|
140
135
|
};
|
|
141
136
|
} & T;
|
|
142
|
-
export {};
|
|
@@ -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,17 +87,18 @@ 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;
|
|
97
98
|
guildId;
|
|
98
99
|
ignore;
|
|
99
100
|
aliases;
|
|
101
|
+
handler;
|
|
100
102
|
constructor(...args) {
|
|
101
103
|
super(...args);
|
|
102
104
|
if ('description' in declare)
|
|
@@ -109,6 +111,8 @@ function Declare(declare) {
|
|
|
109
111
|
this.ignore = declare.ignore;
|
|
110
112
|
if ('aliases' in declare)
|
|
111
113
|
this.aliases = declare.aliases;
|
|
114
|
+
if ('handler' in declare)
|
|
115
|
+
this.handler = declare.handler;
|
|
112
116
|
// check if all properties are valid
|
|
113
117
|
}
|
|
114
118
|
};
|
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 } 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
|
};
|
|
@@ -18,6 +18,7 @@ export declare class HandleCommand {
|
|
|
18
18
|
autocomplete(interaction: AutocompleteInteraction, optionsResolver: OptionResolverStructure, command?: CommandAutocompleteOption): Promise<void>;
|
|
19
19
|
contextMenuMessage(command: ContextMenuCommand, interaction: MessageCommandInteraction, context: MenuCommandContext<MessageCommandInteraction>): Promise<any>;
|
|
20
20
|
contextMenuUser(command: ContextMenuCommand, interaction: UserCommandInteraction, context: MenuCommandContext<UserCommandInteraction>): Promise<any>;
|
|
21
|
+
entryPoint(command: EntryPointCommand, interaction: EntryPointInteraction, context: EntryPointContext): Promise<any>;
|
|
21
22
|
chatInput(command: Command | SubCommand, interaction: ChatInputCommandInteraction, resolver: OptionResolverStructure, context: CommandContext): Promise<any>;
|
|
22
23
|
modal(interaction: ModalSubmitInteraction): Promise<void>;
|
|
23
24
|
messageComponent(interaction: ComponentInteraction): Promise<void>;
|
|
@@ -30,20 +31,20 @@ export declare class HandleCommand {
|
|
|
30
31
|
getCommandFromContent(commandRaw: string[]): CommandFromContent;
|
|
31
32
|
makeResolver(...args: Parameters<(typeof Transformers)['OptionResolver']>): import("./optionresolver").OptionResolver;
|
|
32
33
|
getParentMessageCommand(rawParentName: string): Command | ContextMenuCommand | undefined;
|
|
33
|
-
getCommand<T extends Command | ContextMenuCommand>(data: {
|
|
34
|
+
getCommand<T extends Command | ContextMenuCommand | EntryPointCommand>(data: {
|
|
34
35
|
guild_id?: string;
|
|
35
36
|
name: string;
|
|
36
37
|
}): T | undefined;
|
|
37
38
|
checkPermissions(app: PermissionsBitField, bot: bigint): import("../common").PermissionStrings | undefined;
|
|
38
|
-
fetchChannel(_option: CommandOptionWithType, query: string): Promise<import("../types").APIChannel | null
|
|
39
|
-
fetchUser(_option: CommandOptionWithType, query: string): Promise<import("../types").APIUser | null
|
|
40
|
-
fetchMember(_option: CommandOptionWithType, query: string, guildId: string): Promise<import("../types").APIGuildMember | null
|
|
41
|
-
fetchRole(_option: CommandOptionWithType, query: string, guildId?: string): Promise<import("../types").APIRole | null
|
|
42
|
-
runGlobalMiddlewares(command: Command | ContextMenuCommand | SubCommand, context: CommandContext<{}, never> | MenuCommandContext<any>): Promise<false | {
|
|
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
|
+
runGlobalMiddlewares(command: Command | ContextMenuCommand | SubCommand | EntryPointCommand, context: CommandContext<{}, never> | MenuCommandContext<any> | EntryPointContext): Promise<false | {
|
|
43
44
|
error?: string;
|
|
44
45
|
pass?: boolean;
|
|
45
46
|
}>;
|
|
46
|
-
runMiddlewares(command: Command | ContextMenuCommand | SubCommand, context: CommandContext<{}, never> | MenuCommandContext<any>): Promise<false | {
|
|
47
|
+
runMiddlewares(command: Command | ContextMenuCommand | SubCommand | EntryPointCommand, context: CommandContext<{}, never> | MenuCommandContext<any> | EntryPointContext): Promise<false | {
|
|
47
48
|
error?: string;
|
|
48
49
|
pass?: boolean;
|
|
49
50
|
}>;
|