nuxt-discord 0.0.17 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/README.md +249 -171
  2. package/dist/module.d.mts +146 -10
  3. package/dist/module.json +3 -3
  4. package/dist/module.mjs +1077 -348
  5. package/dist/runtime/acknowledgement.d.ts +11 -0
  6. package/dist/runtime/acknowledgement.js +156 -0
  7. package/dist/runtime/client/chat-theme.css +52 -0
  8. package/dist/runtime/client/components/ChatAvatar.d.vue.ts +6 -0
  9. package/dist/runtime/client/components/ChatAvatar.vue +11 -0
  10. package/dist/runtime/client/components/ChatAvatar.vue.d.ts +6 -0
  11. package/dist/runtime/client/components/CommandPicker.d.vue.ts +24 -0
  12. package/dist/runtime/client/components/CommandPicker.vue +67 -0
  13. package/dist/runtime/client/components/CommandPicker.vue.d.ts +24 -0
  14. package/dist/runtime/client/components/CommandReference.d.vue.ts +20 -0
  15. package/dist/runtime/client/components/CommandReference.vue +21 -0
  16. package/dist/runtime/client/components/CommandReference.vue.d.ts +20 -0
  17. package/dist/runtime/client/components/CommandTestBar.d.vue.ts +60 -0
  18. package/dist/runtime/client/components/CommandTestBar.vue +332 -0
  19. package/dist/runtime/client/components/CommandTestBar.vue.d.ts +60 -0
  20. package/dist/runtime/client/components/CommandTranscript.d.vue.ts +39 -0
  21. package/dist/runtime/client/components/CommandTranscript.vue +147 -0
  22. package/dist/runtime/client/components/CommandTranscript.vue.d.ts +39 -0
  23. package/dist/runtime/client/components/ProjectLogo.d.vue.ts +3 -0
  24. package/dist/runtime/client/components/ProjectLogo.vue +31 -0
  25. package/dist/runtime/client/components/ProjectLogo.vue.d.ts +3 -0
  26. package/dist/runtime/client/components/ReferenceContent.d.ts +26 -0
  27. package/dist/runtime/client/components/ReferenceContent.js +73 -0
  28. package/dist/runtime/client/components/TheHeader.d.vue.ts +3 -0
  29. package/dist/runtime/client/components/TheHeader.vue +53 -16
  30. package/dist/runtime/client/components/TheHeader.vue.d.ts +2 -2
  31. package/dist/runtime/client/components/appearance-select.d.ts +17 -0
  32. package/dist/runtime/client/components/appearance-select.js +15 -0
  33. package/dist/runtime/client/pages/activity.d.vue.ts +3 -0
  34. package/dist/runtime/client/pages/activity.vue +202 -0
  35. package/dist/runtime/client/pages/activity.vue.d.ts +3 -0
  36. package/dist/runtime/client/pages/context-menus.d.vue.ts +3 -0
  37. package/dist/runtime/client/pages/context-menus.vue +120 -0
  38. package/dist/runtime/client/pages/context-menus.vue.d.ts +3 -0
  39. package/dist/runtime/client/pages/listeners.d.vue.ts +3 -0
  40. package/dist/runtime/client/pages/listeners.vue +68 -0
  41. package/dist/runtime/client/pages/listeners.vue.d.ts +3 -0
  42. package/dist/runtime/client/pages/overview.d.vue.ts +3 -0
  43. package/dist/runtime/client/pages/overview.vue +280 -0
  44. package/dist/runtime/client/pages/overview.vue.d.ts +3 -0
  45. package/dist/runtime/client/pages/slash-commands.d.vue.ts +3 -0
  46. package/dist/runtime/client/pages/slash-commands.vue +185 -359
  47. package/dist/runtime/client/pages/slash-commands.vue.d.ts +2 -3
  48. package/dist/runtime/client/reference.css +46 -0
  49. package/dist/runtime/client/style.css +4 -1
  50. package/dist/runtime/client/useActivityLog.d.ts +7 -0
  51. package/dist/runtime/client/useActivityLog.js +76 -0
  52. package/dist/runtime/client/useCommandRegistry.d.ts +7 -0
  53. package/dist/runtime/client/useCommandRegistry.js +34 -0
  54. package/dist/runtime/client/useDashboardCatalog.d.ts +5 -0
  55. package/dist/runtime/client/useDashboardCatalog.js +9 -0
  56. package/dist/runtime/client/useDiscordCommandReference.d.ts +2 -0
  57. package/dist/runtime/client/useDiscordCommandReference.js +6 -0
  58. package/dist/runtime/dashboard/auth.d.ts +4 -0
  59. package/dist/runtime/dashboard/auth.js +55 -0
  60. package/dist/runtime/dashboard/oauth.d.ts +17 -0
  61. package/dist/runtime/dashboard/oauth.js +172 -0
  62. package/dist/runtime/dashboard/origin.d.ts +3 -0
  63. package/dist/runtime/dashboard/origin.js +15 -0
  64. package/dist/runtime/dashboard/permissions.d.ts +4 -0
  65. package/dist/runtime/dashboard/permissions.js +84 -0
  66. package/dist/runtime/dashboard/signin.d.ts +3 -0
  67. package/dist/runtime/dashboard/signin.js +42 -0
  68. package/dist/runtime/diagnostics.d.ts +4 -0
  69. package/dist/runtime/diagnostics.js +24 -0
  70. package/dist/runtime/discordInvocation.d.ts +14 -0
  71. package/dist/runtime/discordInvocation.js +28 -0
  72. package/dist/runtime/middleware.d.ts +1 -0
  73. package/dist/runtime/middleware.js +12 -0
  74. package/dist/runtime/reference/access.d.ts +6 -0
  75. package/dist/runtime/reference/access.js +143 -0
  76. package/dist/runtime/reference/catalog.d.ts +2 -0
  77. package/dist/runtime/reference/catalog.js +9 -0
  78. package/dist/runtime/reference/document.d.ts +2 -0
  79. package/dist/runtime/reference/document.js +22 -0
  80. package/dist/runtime/reference/hosted.d.ts +2 -0
  81. package/dist/runtime/reference/hosted.js +16 -0
  82. package/dist/runtime/reference/oauth.d.ts +2 -0
  83. package/dist/runtime/reference/oauth.js +4 -0
  84. package/dist/runtime/registration.d.ts +65 -0
  85. package/dist/runtime/registration.js +354 -0
  86. package/dist/runtime/server/api/discord/activity.get.d.ts +2 -0
  87. package/dist/runtime/server/api/discord/activity.get.js +6 -0
  88. package/dist/runtime/server/api/discord/catalog.get.d.ts +2 -0
  89. package/dist/runtime/server/api/discord/catalog.get.js +3 -0
  90. package/dist/runtime/server/api/discord/slash-command/autocomplete.post.d.ts +2 -0
  91. package/dist/runtime/server/api/discord/slash-command/autocomplete.post.js +14 -0
  92. package/dist/runtime/server/api/discord/slash-command/register.post.d.ts +1 -1
  93. package/dist/runtime/server/api/discord/slash-command/register.post.js +1 -1
  94. package/dist/runtime/server/api/discord/slash-command/remote-all.get.d.ts +1 -1
  95. package/dist/runtime/server/api/discord/slash-command/remote-diff.post.d.ts +1 -238
  96. package/dist/runtime/server/api/discord/slash-command/remote-diff.post.js +3 -1
  97. package/dist/runtime/server/api/discord/slash-command/test.post.d.ts +20 -0
  98. package/dist/runtime/server/api/discord/slash-command/test.post.js +19 -0
  99. package/dist/runtime/server/plugins/discord.js +95 -31
  100. package/dist/runtime/server/utils/client.d.ts +59 -246
  101. package/dist/runtime/server/utils/client.js +413 -451
  102. package/dist/runtime/server/utils/defineContextMenu.d.ts +49 -0
  103. package/dist/runtime/server/utils/defineContextMenu.js +12 -0
  104. package/dist/runtime/server/utils/defineListener.d.ts +24 -0
  105. package/dist/runtime/server/utils/defineListener.js +7 -0
  106. package/dist/runtime/server/utils/defineMiddleware.d.ts +29 -0
  107. package/dist/runtime/server/utils/defineMiddleware.js +24 -0
  108. package/dist/runtime/server/utils/describeCommand.d.ts +2 -0
  109. package/dist/runtime/server/utils/describeOption.d.ts +1 -1
  110. package/dist/runtime/server/utils/messageSender.d.ts +37 -0
  111. package/dist/runtime/server/utils/messageSender.js +149 -0
  112. package/dist/runtime/server/utils/middleware/cooldown.d.ts +1 -0
  113. package/dist/runtime/server/utils/middleware/cooldown.js +39 -0
  114. package/dist/runtime/server/utils/middleware/guildOnly.d.ts +1 -0
  115. package/dist/runtime/server/utils/middleware/guildOnly.js +6 -0
  116. package/dist/runtime/server/utils/middleware/ownerOnly.d.ts +1 -0
  117. package/dist/runtime/server/utils/middleware/ownerOnly.js +10 -0
  118. package/dist/runtime/server/utils/middleware/requireRole.d.ts +1 -0
  119. package/dist/runtime/server/utils/middleware/requireRole.js +15 -0
  120. package/dist/runtime/server/utils/reply.d.ts +13 -3
  121. package/dist/runtime/server/utils/reply.js +111 -162
  122. package/dist/runtime/server/utils/simulateInteraction.d.ts +20 -0
  123. package/dist/runtime/server/utils/simulateInteraction.js +127 -0
  124. package/dist/runtime/server/utils/useTextChannel.d.ts +56 -0
  125. package/dist/runtime/server/utils/useTextChannel.js +105 -0
  126. package/dist/types.d.mts +11 -1
  127. package/dist/types.d.ts +11 -1
  128. package/package.json +62 -44
  129. package/dist/runtime/client/components/TheHeader.css +0 -1
  130. package/dist/runtime/client/pages/slash-commands.css +0 -1
  131. package/dist/runtime/client/uno.config.d.ts +0 -2
  132. package/dist/runtime/client/uno.config.js +0 -10
@@ -0,0 +1,20 @@
1
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<{
2
+ ok: boolean;
3
+ command: string;
4
+ error: string;
5
+ replies?: undefined;
6
+ notices?: undefined;
7
+ response?: undefined;
8
+ responses?: undefined;
9
+ ephemeral?: undefined;
10
+ } | {
11
+ ok: boolean;
12
+ error: string | undefined;
13
+ command: string;
14
+ replies: import("../../../utils/simulateInteraction.js").RecordedReply[];
15
+ notices: string[];
16
+ response: string | undefined;
17
+ responses: string[];
18
+ ephemeral: boolean;
19
+ }>>;
20
+ export default _default;
@@ -0,0 +1,19 @@
1
+ import { defineEventHandler, readBody } from "h3";
2
+ import { simulateInteraction } from "../../../utils/simulateInteraction.js";
3
+ import { useDiscordClient } from "../../../utils/useDiscordClient.js";
4
+ export default defineEventHandler(async (event) => {
5
+ const body = await readBody(event);
6
+ if (!body?.name)
7
+ return { ok: false, command: "", error: "Missing command name" };
8
+ const { ok, error, replies, notices } = await simulateInteraction(useDiscordClient(), body);
9
+ return {
10
+ ok,
11
+ error,
12
+ command: body.name,
13
+ replies,
14
+ notices,
15
+ response: replies[0]?.content,
16
+ responses: replies.map((message) => message.content),
17
+ ephemeral: replies[0]?.ephemeral ?? false
18
+ };
19
+ });
@@ -1,49 +1,113 @@
1
- import fs from "node:fs";
1
+ import { join } from "node:path";
2
+ import process from "node:process";
3
+ import { pathToFileURL } from "node:url";
4
+ import { Events } from "discord.js";
5
+ import contextMenus from "discord/contextMenus";
6
+ import listeners from "discord/listeners";
2
7
  import slashCommands from "discord/slashCommands";
3
8
  import { defineNitroPlugin, useRuntimeConfig } from "nitropack/runtime";
4
- import { logger } from "../../logger.js";
9
+ import { logDiscordFailure } from "../../diagnostics.js";
5
10
  import { DiscordClient } from "../utils/client.js";
6
11
  export default defineNitroPlugin(async (nitro) => {
12
+ if (import.meta.prerender)
13
+ return;
7
14
  const runtimeConfig = useRuntimeConfig();
8
- const client = new DiscordClient();
15
+ if (!runtimeConfig.discord.autoStart && (!process.env.DISCORD_TOKEN || !process.env.DISCORD_CLIENT_ID))
16
+ return;
17
+ let closed = false;
18
+ function fail(message, error) {
19
+ logDiscordFailure(message, error);
20
+ if (!import.meta.dev && runtimeConfig.discord.autoStart && !closed)
21
+ process.exit(1);
22
+ }
23
+ let client;
24
+ try {
25
+ client = new DiscordClient();
26
+ } catch (error) {
27
+ fail("Failed to initialize Discord client:", error);
28
+ return;
29
+ }
30
+ ;
9
31
  globalThis[Symbol.for("discord-client")] = client;
10
- if ("wsUrl" in (runtimeConfig.public.discord ?? {}) && typeof runtimeConfig.public.discord.wsUrl === "string") {
11
- const socket = new WebSocket(runtimeConfig.public.discord.wsUrl);
32
+ const publicDiscord = runtimeConfig.public.discord;
33
+ if (import.meta.dev && publicDiscord?.wsUrl) {
34
+ let scheduleSync = function() {
35
+ if (!sync || closed)
36
+ return;
37
+ clearTimeout(syncTimer);
38
+ syncTimer = setTimeout(() => {
39
+ void client.syncCommandRegistrations({ changedOnly: true }).then((results) => {
40
+ if (results.length && socket.readyState === WebSocket.OPEN)
41
+ socket.send(JSON.stringify({ event: "registration-updated" }));
42
+ }).catch((error) => logDiscordFailure("Command sync failed:", error));
43
+ }, sync.debounce ?? 1e3);
44
+ };
45
+ const socket = new WebSocket(publicDiscord.wsUrl);
46
+ client.onActivity((entry) => {
47
+ try {
48
+ socket.send(JSON.stringify({ event: "activity", entry }));
49
+ } catch {
50
+ }
51
+ });
12
52
  socket.addEventListener("error", (error) => {
13
- console.error("WebSocket error:", error);
53
+ logDiscordFailure("Dashboard WebSocket error:", error);
14
54
  });
55
+ let syncTimer;
56
+ const sync = runtimeConfig.discord.sync;
57
+ let requested = 0;
58
+ socket.addEventListener("open", () => socket.send(JSON.stringify({ event: "command-revision" })));
15
59
  socket.addEventListener("message", async (event) => {
16
60
  const data = JSON.parse(event.data);
17
- if (data.event === "full-update") {
18
- const commands = [];
19
- for (const cmd of data.commands) {
20
- const runtimeCommand = cmd;
21
- const buildPath = cmd.path.replace(runtimeConfig.discord.rootDir, runtimeConfig.discord.buildDir).replace(/\.ts$/, ".mjs");
22
- const existingCommand = client.getSlashCommands().find((c) => c.path === cmd.path);
23
- if (fs.existsSync(buildPath)) {
24
- const lastModified = fs.statSync(buildPath).mtimeMs;
25
- runtimeCommand.load = () => import(`${buildPath}?${lastModified}`).then((m) => m.default);
26
- } else if (existingCommand) {
27
- runtimeCommand.execute = existingCommand.execute;
28
- } else {
29
- logger.error(`Unable to dynamically load slash command at ${cmd.path}`);
30
- continue;
31
- }
32
- commands.push(runtimeCommand);
61
+ if (data.event !== "command-revision" || !Number.isSafeInteger(data.revision) || data.revision <= requested)
62
+ return;
63
+ const revision = requested = data.revision;
64
+ const url = pathToFileURL(join(runtimeConfig.discord.buildDir, "discord/hmr", String(revision), "commands.mjs"));
65
+ try {
66
+ const { default: commands } = await import(url.href);
67
+ if (revision === requested) {
68
+ client.clearSlashCommands();
69
+ client.addSlashCommands(commands);
70
+ scheduleSync();
33
71
  }
34
- client.clearSlashCommands();
35
- client.addSlashCommands(commands);
36
- } else {
37
- socket.send(JSON.stringify({ event: "full-update" }));
72
+ } catch (error) {
73
+ logDiscordFailure("Could not load updated slash commands:", error);
38
74
  }
39
75
  });
40
- nitro.hooks.hook("close", () => socket.close());
76
+ nitro.hooks.hook("close", () => {
77
+ closed = true;
78
+ clearTimeout(syncTimer);
79
+ socket.close();
80
+ });
41
81
  }
42
82
  client.addSlashCommands(slashCommands);
43
- if (runtimeConfig.discord.sync) {
44
- await client.registerSlashCommands();
45
- }
83
+ client.addContextMenus(contextMenus);
84
+ client.registerListeners(listeners);
85
+ nitro.hooks.hook("close", () => {
86
+ closed = true;
87
+ return client.stop();
88
+ });
89
+ await Promise.resolve();
90
+ if (closed)
91
+ return;
46
92
  if (runtimeConfig.discord.autoStart) {
47
- await client.start(runtimeConfig.discord.client);
93
+ try {
94
+ await client.start(runtimeConfig.discord.client);
95
+ const gateway = client.internalClient;
96
+ gateway?.on(Events.ShardDisconnect, (event, shard) => {
97
+ if (client.internalClient === gateway && !closed)
98
+ fail(`Discord shard ${shard} disconnected and cannot reconnect. Close code: ${event.code}`);
99
+ });
100
+ } catch (error) {
101
+ if (!closed)
102
+ fail("Failed to start Discord client:", error);
103
+ return;
104
+ }
105
+ }
106
+ if (!closed && runtimeConfig.discord.sync) {
107
+ try {
108
+ await client.syncCommandRegistrations();
109
+ } catch (error) {
110
+ logDiscordFailure("Command sync failed:", error);
111
+ }
48
112
  }
49
113
  });
@@ -1,6 +1,8 @@
1
- import type { APIApplicationCommandOption, ChatInputCommandInteraction, CommandInteraction, RESTGetAPIApplicationCommandsResult, RESTPutAPIApplicationCommandsResult } from 'discord.js';
2
- import type { NuxtDiscordOptions, SlashCommandRuntime, SlashCommandSubcommandGroupRuntime, SlashCommandSubcommandRuntime } from '../../../types.js';
3
- import { ApplicationCommandOptionType, Client as InternalClient } from 'discord.js';
1
+ import type { ChatInputCommandInteraction, CommandInteraction, Interaction, TextBasedChannel } from 'discord.js';
2
+ import type { MiddlewareEntry, NuxtDiscordOptions, SlashCommandRuntime, SlashCommandSubcommandRuntime } from '../../../types.js';
3
+ import type { ContextMenuDefinition } from './defineContextMenu.js';
4
+ import type { ListenerDefinition } from './defineListener.js';
5
+ import { Client as InternalClient } from 'discord.js';
4
6
  export interface DiscordClientErrorBase {
5
7
  type: string;
6
8
  client: DiscordClient;
@@ -26,262 +28,73 @@ export interface SlashCommandRegistrationError extends DiscordClientErrorBase {
26
28
  error: unknown;
27
29
  command?: SlashCommandRuntime;
28
30
  }
29
- export type DiscordClientError = UnknownSlashCommandError | MissingRequiredOptionError | SlashCommandExecutionError | SlashCommandRegistrationError;
31
+ export interface MiddlewareDeniedError extends DiscordClientErrorBase {
32
+ type: 'MiddlewareDeniedError';
33
+ interaction: Interaction;
34
+ middleware: string;
35
+ reason: string;
36
+ identifier?: string;
37
+ }
38
+ export type DiscordClientError = UnknownSlashCommandError | MissingRequiredOptionError | SlashCommandExecutionError | SlashCommandRegistrationError | MiddlewareDeniedError;
39
+ export interface ActivityLogEntry {
40
+ id: number;
41
+ timestamp: number;
42
+ type: 'command' | 'context-menu' | 'autocomplete' | 'error' | 'listener';
43
+ name: string;
44
+ userId?: string;
45
+ userName?: string;
46
+ guildId?: string;
47
+ guildName?: string;
48
+ channelId?: string;
49
+ duration?: number;
50
+ status: 'ok' | 'denied' | 'error';
51
+ detail?: string;
52
+ }
53
+ export interface DispatchResult {
54
+ status: ActivityLogEntry['status'];
55
+ detail?: string;
56
+ dispose: () => void;
57
+ }
30
58
  export declare function useInteraction(): ChatInputCommandInteraction | null;
59
+ export declare function setCurrentChannel(channel: TextBasedChannel | null): void;
60
+ export declare function getCurrentChannel(): TextBasedChannel | null;
31
61
  export declare class DiscordClient {
32
62
  #private;
33
63
  get internalClient(): InternalClient<boolean> | null;
34
64
  constructor();
35
65
  start(options: NuxtDiscordOptions['client']): Promise<undefined>;
66
+ registerListeners(listeners: ListenerDefinition[]): void;
67
+ addContextMenus(menus: (ContextMenuDefinition & {
68
+ name: string;
69
+ })[]): void;
70
+ getContextMenus(): (ContextMenuDefinition & {
71
+ name: string;
72
+ middleware?: string[];
73
+ middlewareEntries?: MiddlewareEntry[];
74
+ })[];
75
+ dispatchInteraction(interaction: Interaction, options?: {
76
+ simulation?: boolean;
77
+ }): Promise<DispatchResult>;
78
+ resolveSlashCommand(name: string, group?: string | null, leaf?: string | null, commandGuildId?: string | null): SlashCommandRuntime | SlashCommandSubcommandRuntime | undefined;
79
+ onActivity(callback: (entry: ActivityLogEntry) => void): void;
80
+ getActivityLog(): ActivityLogEntry[];
36
81
  stop(): Promise<void>;
37
82
  startScope(): void;
38
83
  stopScope(): void;
39
84
  isReady(): boolean;
40
85
  addSlashCommand(command: SlashCommandRuntime): void;
41
86
  addSlashCommands(commands: SlashCommandRuntime[]): void;
42
- removeSlashCommand(name: string): void;
87
+ removeSlashCommand(name: string, commandGuildId?: string | null): void;
43
88
  clearSlashCommands(): void;
44
89
  getSlashCommands(): SlashCommandRuntime[];
45
- getSlashCommand(name: string): SlashCommandRuntime | undefined;
46
- getRemoteSlashCommands(): Promise<RESTGetAPIApplicationCommandsResult>;
47
- diffRemoteSlashCommands(localCommands?: SlashCommandRuntime[], forceRefresh?: boolean): Promise<{
48
- added: (SlashCommandRuntime | SlashCommandSubcommandRuntime | SlashCommandSubcommandGroupRuntime)[];
49
- removed: ({
50
- name: string;
51
- subcommands: never[];
52
- options?: import("discord.js").APIApplicationCommandBasicOption[];
53
- type: ApplicationCommandOptionType.Subcommand;
54
- name_localizations?: import("discord.js").LocalizationMap | null;
55
- description: string;
56
- description_localizations?: import("discord.js").LocalizationMap | null;
57
- required?: boolean;
58
- } | {
59
- name: string;
60
- subcommands: {
61
- name: string;
62
- subcommands: never[];
63
- options?: import("discord.js").APIApplicationCommandBasicOption[];
64
- type: ApplicationCommandOptionType.Subcommand;
65
- name_localizations?: import("discord.js").LocalizationMap | null;
66
- description: string;
67
- description_localizations?: import("discord.js").LocalizationMap | null;
68
- required?: boolean;
69
- }[];
70
- options?: import("discord.js").APIApplicationCommandSubcommandOption[];
71
- type: ApplicationCommandOptionType.SubcommandGroup;
72
- name_localizations?: import("discord.js").LocalizationMap | null;
73
- description: string;
74
- description_localizations?: import("discord.js").LocalizationMap | null;
75
- required?: boolean;
76
- } | {
77
- subcommands: ({
78
- name: string;
79
- subcommands: never[];
80
- options?: import("discord.js").APIApplicationCommandBasicOption[];
81
- type: ApplicationCommandOptionType.Subcommand;
82
- name_localizations?: import("discord.js").LocalizationMap | null;
83
- description: string;
84
- description_localizations?: import("discord.js").LocalizationMap | null;
85
- required?: boolean;
86
- } | {
87
- name: string;
88
- subcommands: {
89
- name: string;
90
- subcommands: never[];
91
- options?: import("discord.js").APIApplicationCommandBasicOption[];
92
- type: ApplicationCommandOptionType.Subcommand;
93
- name_localizations?: import("discord.js").LocalizationMap | null;
94
- description: string;
95
- description_localizations?: import("discord.js").LocalizationMap | null;
96
- required?: boolean;
97
- }[];
98
- options?: import("discord.js").APIApplicationCommandSubcommandOption[];
99
- type: ApplicationCommandOptionType.SubcommandGroup;
100
- name_localizations?: import("discord.js").LocalizationMap | null;
101
- description: string;
102
- description_localizations?: import("discord.js").LocalizationMap | null;
103
- required?: boolean;
104
- })[];
105
- id: import("discord.js").Snowflake;
106
- type: import("discord.js").ApplicationCommandType;
107
- application_id: import("discord.js").Snowflake;
108
- guild_id?: import("discord.js").Snowflake;
109
- name: string;
110
- name_localizations?: import("discord.js").LocalizationMap | null;
111
- name_localized?: string;
112
- description: string;
113
- description_localizations?: import("discord.js").LocalizationMap | null;
114
- description_localized?: string;
115
- options?: APIApplicationCommandOption[];
116
- default_member_permissions: import("discord.js").Permissions | null;
117
- dm_permission?: boolean;
118
- default_permission?: boolean;
119
- nsfw?: boolean;
120
- integration_types?: import("discord.js").ApplicationIntegrationType[];
121
- contexts?: import("discord.js").InteractionContextType[] | null;
122
- version: import("discord.js").Snowflake;
123
- handler?: import("discord.js").EntryPointCommandHandlerType;
124
- })[];
125
- changed: {
126
- local: SlashCommandRuntime | SlashCommandSubcommandRuntime | SlashCommandSubcommandGroupRuntime;
127
- remote: {
128
- name: string;
129
- subcommands: never[];
130
- options?: import("discord.js").APIApplicationCommandBasicOption[];
131
- type: ApplicationCommandOptionType.Subcommand;
132
- name_localizations?: import("discord.js").LocalizationMap | null;
133
- description: string;
134
- description_localizations?: import("discord.js").LocalizationMap | null;
135
- required?: boolean;
136
- } | {
137
- name: string;
138
- subcommands: {
139
- name: string;
140
- subcommands: never[];
141
- options?: import("discord.js").APIApplicationCommandBasicOption[];
142
- type: ApplicationCommandOptionType.Subcommand;
143
- name_localizations?: import("discord.js").LocalizationMap | null;
144
- description: string;
145
- description_localizations?: import("discord.js").LocalizationMap | null;
146
- required?: boolean;
147
- }[];
148
- options?: import("discord.js").APIApplicationCommandSubcommandOption[];
149
- type: ApplicationCommandOptionType.SubcommandGroup;
150
- name_localizations?: import("discord.js").LocalizationMap | null;
151
- description: string;
152
- description_localizations?: import("discord.js").LocalizationMap | null;
153
- required?: boolean;
154
- } | {
155
- subcommands: ({
156
- name: string;
157
- subcommands: never[];
158
- options?: import("discord.js").APIApplicationCommandBasicOption[];
159
- type: ApplicationCommandOptionType.Subcommand;
160
- name_localizations?: import("discord.js").LocalizationMap | null;
161
- description: string;
162
- description_localizations?: import("discord.js").LocalizationMap | null;
163
- required?: boolean;
164
- } | {
165
- name: string;
166
- subcommands: {
167
- name: string;
168
- subcommands: never[];
169
- options?: import("discord.js").APIApplicationCommandBasicOption[];
170
- type: ApplicationCommandOptionType.Subcommand;
171
- name_localizations?: import("discord.js").LocalizationMap | null;
172
- description: string;
173
- description_localizations?: import("discord.js").LocalizationMap | null;
174
- required?: boolean;
175
- }[];
176
- options?: import("discord.js").APIApplicationCommandSubcommandOption[];
177
- type: ApplicationCommandOptionType.SubcommandGroup;
178
- name_localizations?: import("discord.js").LocalizationMap | null;
179
- description: string;
180
- description_localizations?: import("discord.js").LocalizationMap | null;
181
- required?: boolean;
182
- })[];
183
- id: import("discord.js").Snowflake;
184
- type: import("discord.js").ApplicationCommandType;
185
- application_id: import("discord.js").Snowflake;
186
- guild_id?: import("discord.js").Snowflake;
187
- name: string;
188
- name_localizations?: import("discord.js").LocalizationMap | null;
189
- name_localized?: string;
190
- description: string;
191
- description_localizations?: import("discord.js").LocalizationMap | null;
192
- description_localized?: string;
193
- options?: APIApplicationCommandOption[];
194
- default_member_permissions: import("discord.js").Permissions | null;
195
- dm_permission?: boolean;
196
- default_permission?: boolean;
197
- nsfw?: boolean;
198
- integration_types?: import("discord.js").ApplicationIntegrationType[];
199
- contexts?: import("discord.js").InteractionContextType[] | null;
200
- version: import("discord.js").Snowflake;
201
- handler?: import("discord.js").EntryPointCommandHandlerType;
202
- };
203
- }[];
204
- synced: {
205
- local: SlashCommandRuntime | SlashCommandSubcommandRuntime | SlashCommandSubcommandGroupRuntime;
206
- remote: {
207
- name: string;
208
- subcommands: never[];
209
- options?: import("discord.js").APIApplicationCommandBasicOption[];
210
- type: ApplicationCommandOptionType.Subcommand;
211
- name_localizations?: import("discord.js").LocalizationMap | null;
212
- description: string;
213
- description_localizations?: import("discord.js").LocalizationMap | null;
214
- required?: boolean;
215
- } | {
216
- name: string;
217
- subcommands: {
218
- name: string;
219
- subcommands: never[];
220
- options?: import("discord.js").APIApplicationCommandBasicOption[];
221
- type: ApplicationCommandOptionType.Subcommand;
222
- name_localizations?: import("discord.js").LocalizationMap | null;
223
- description: string;
224
- description_localizations?: import("discord.js").LocalizationMap | null;
225
- required?: boolean;
226
- }[];
227
- options?: import("discord.js").APIApplicationCommandSubcommandOption[];
228
- type: ApplicationCommandOptionType.SubcommandGroup;
229
- name_localizations?: import("discord.js").LocalizationMap | null;
230
- description: string;
231
- description_localizations?: import("discord.js").LocalizationMap | null;
232
- required?: boolean;
233
- } | {
234
- subcommands: ({
235
- name: string;
236
- subcommands: never[];
237
- options?: import("discord.js").APIApplicationCommandBasicOption[];
238
- type: ApplicationCommandOptionType.Subcommand;
239
- name_localizations?: import("discord.js").LocalizationMap | null;
240
- description: string;
241
- description_localizations?: import("discord.js").LocalizationMap | null;
242
- required?: boolean;
243
- } | {
244
- name: string;
245
- subcommands: {
246
- name: string;
247
- subcommands: never[];
248
- options?: import("discord.js").APIApplicationCommandBasicOption[];
249
- type: ApplicationCommandOptionType.Subcommand;
250
- name_localizations?: import("discord.js").LocalizationMap | null;
251
- description: string;
252
- description_localizations?: import("discord.js").LocalizationMap | null;
253
- required?: boolean;
254
- }[];
255
- options?: import("discord.js").APIApplicationCommandSubcommandOption[];
256
- type: ApplicationCommandOptionType.SubcommandGroup;
257
- name_localizations?: import("discord.js").LocalizationMap | null;
258
- description: string;
259
- description_localizations?: import("discord.js").LocalizationMap | null;
260
- required?: boolean;
261
- })[];
262
- id: import("discord.js").Snowflake;
263
- type: import("discord.js").ApplicationCommandType;
264
- application_id: import("discord.js").Snowflake;
265
- guild_id?: import("discord.js").Snowflake;
266
- name: string;
267
- name_localizations?: import("discord.js").LocalizationMap | null;
268
- name_localized?: string;
269
- description: string;
270
- description_localizations?: import("discord.js").LocalizationMap | null;
271
- description_localized?: string;
272
- options?: APIApplicationCommandOption[];
273
- default_member_permissions: import("discord.js").Permissions | null;
274
- dm_permission?: boolean;
275
- default_permission?: boolean;
276
- nsfw?: boolean;
277
- integration_types?: import("discord.js").ApplicationIntegrationType[];
278
- contexts?: import("discord.js").InteractionContextType[] | null;
279
- version: import("discord.js").Snowflake;
280
- handler?: import("discord.js").EntryPointCommandHandlerType;
281
- };
282
- }[];
283
- conflict: (SlashCommandRuntime | SlashCommandSubcommandRuntime | SlashCommandSubcommandGroupRuntime)[];
284
- }>;
285
- registerSlashCommands(): Promise<RESTPutAPIApplicationCommandsResult | PromiseSettledResult<import("discord.js").APIApplicationCommand>[]>;
90
+ getSlashCommand(name: string, commandGuildId?: string | null): SlashCommandRuntime | undefined;
91
+ static DISCORD_TOKEN_LIFETIME: number;
92
+ getRemoteSlashCommands(): Promise<import("discord.js").APIApplicationCommand[]>;
93
+ diffRemoteSlashCommands(commands?: SlashCommandRuntime[], _forceRefresh?: boolean): Promise<import("../../registration.js").RegistrationDiff>;
94
+ syncCommandRegistrations(options?: {
95
+ changedOnly?: boolean;
96
+ guilds?: string[];
97
+ }): Promise<import("../../registration.js").RegistrationResult[]>;
98
+ registerSlashCommands(guilds?: string[]): Promise<import("discord.js").APIApplicationCommand[]>;
286
99
  }
287
100
  export declare function isPromise(value: any): value is Promise<unknown>;