nuxt-discord 0.0.16 → 0.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -252,11 +252,11 @@ Here's what's planned for future releases:
252
252
  - [ ] Attachment type
253
253
  - [ ] Better JSDocs support JSDoc comments
254
254
  - [ ] Localization support
255
- - [ ] File-based subcommands
255
+ - [x] File-based subcommands
256
256
  - [x] Auto-complete API
257
257
  - [ ] Guild-specific commands
258
258
  - [ ] Nuxt-devtools integration
259
- - [ ] Unit tests
259
+ - [ ] Unit tests (WIP)
260
260
 
261
261
  ### Web Interface Enhancements
262
262
 
package/dist/module.d.mts CHANGED
@@ -117,13 +117,32 @@ interface SlashCommand {
117
117
  options: (SlashCommandOption & {
118
118
  varname: string;
119
119
  })[];
120
+ parents: [];
121
+ subcommands: (SlashCommandSubcommand | SlashCommandSubcommandGroup)[];
120
122
  }
121
- interface SlashCommandRuntime extends SlashCommand {
123
+ interface SlashCommandSubcommandGroup extends Omit<SlashCommand, 'subcommands' | 'parents'> {
124
+ parents: [string];
125
+ subcommands: SlashCommandSubcommand[];
126
+ }
127
+ interface SlashCommandSubcommand extends Omit<SlashCommand, 'subcommands' | 'parents'> {
128
+ parents: [string] | [string, string];
129
+ subcommands: [];
130
+ }
131
+ interface SlashCommandRuntime extends Omit<SlashCommand, 'subcommands'> {
122
132
  /** if execute is not defined load must be defined */
123
133
  load?: () => Promise<Pick<SlashCommandRuntime, 'execute' | 'optionMacros'>>;
124
134
  execute?: (...args: (SlashCommandOptionType | undefined)[]) => SlashCommandReturnType;
125
135
  id?: string;
126
136
  optionMacros?: Record<string, DescribeOptionOptions>;
137
+ subcommands?: (SlashCommandSubcommandRuntime | SlashCommandSubcommandGroupRuntime)[];
138
+ }
139
+ interface SlashCommandSubcommandGroupRuntime extends Omit<SlashCommandRuntime, 'subcommands' | 'parents'> {
140
+ parents: [string];
141
+ subcommands?: SlashCommandSubcommandRuntime[];
142
+ }
143
+ interface SlashCommandSubcommandRuntime extends Omit<SlashCommandRuntime, 'subcommands' | 'parents'> {
144
+ parents: [string] | [string, string];
145
+ subcommands?: [];
127
146
  }
128
147
  interface NuxtDiscordContext {
129
148
  nuxt: nuxt_schema.Nuxt;
@@ -139,4 +158,4 @@ interface NuxtDiscordContext {
139
158
  declare const _default: _nuxt_schema.NuxtModule<NuxtDiscordOptions, NuxtDiscordOptions, false>;
140
159
 
141
160
  export { _default as default, slashCommandOptionTypeIdentifiers, typeIdentifierToEnum };
142
- export type { DiscordRuntimeConfig, NuxtDiscordContext, NuxtDiscordOptions, SlashCommand, SlashCommandBooleanOption, SlashCommandCustomReturnHandler, SlashCommandIntegerOption, SlashCommandNumberOption, SlashCommandOption, SlashCommandOptionBase, SlashCommandOptionType, SlashCommandOptionTypeIdentifier, SlashCommandReturnType, SlashCommandRuntime, SlashCommandStringOption, integer };
161
+ export type { DiscordRuntimeConfig, NuxtDiscordContext, NuxtDiscordOptions, SlashCommand, SlashCommandBooleanOption, SlashCommandCustomReturnHandler, SlashCommandIntegerOption, SlashCommandNumberOption, SlashCommandOption, SlashCommandOptionBase, SlashCommandOptionType, SlashCommandOptionTypeIdentifier, SlashCommandReturnType, SlashCommandRuntime, SlashCommandStringOption, SlashCommandSubcommand, SlashCommandSubcommandGroup, SlashCommandSubcommandGroupRuntime, SlashCommandSubcommandRuntime, integer };
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-discord",
3
3
  "configKey": "discord",
4
- "version": "0.0.16",
4
+ "version": "0.0.17",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.1",
7
7
  "unbuild": "3.5.0"
package/dist/module.mjs CHANGED
@@ -158,6 +158,7 @@ function collectSlashCommands(ctx) {
158
158
  ctx.slashCommands.push(command);
159
159
  }
160
160
  }
161
+ processSubcommands(ctx);
161
162
  }
162
163
  function processCommandFile(ctx, file) {
163
164
  const sourceFile = ts.createSourceFile(
@@ -176,6 +177,7 @@ function processCommandFile(ctx, file) {
176
177
  const command = {
177
178
  path: file,
178
179
  options: [],
180
+ subcommands: [],
179
181
  name
180
182
  };
181
183
  if ((ts.isFunctionDeclaration(commandDefinition) || ts.isFunctionExpression(commandDefinition)) && !!commandDefinition.name && ts.isIdentifier(commandDefinition.name) && commandDefinition.name.escapedText) {
@@ -298,8 +300,56 @@ function processCommandFile(ctx, file) {
298
300
  if (outOfRangMacroCalls.length > 0) {
299
301
  ctx.logger.warn(`Macros in file ${file} must be called at the top of the file`);
300
302
  }
303
+ const commandsDir = ctx.resolve.root(ctx.options.dir, "commands");
304
+ const parents = path.relative(commandsDir, file).split(path.sep).slice(0, -1);
305
+ if (parents.length > 2) {
306
+ ctx.logger.warn(`Only 2 levels of subcommand nesting are supported, see https://discord.com/developers/docs/interactions/application-commands#subcommands-and-subcommand-groups`);
307
+ return;
308
+ } else if (parents.length === 1) {
309
+ command.parents = [
310
+ path.resolve(commandsDir, `${parents[0]}.ts`)
311
+ ];
312
+ } else if (parents.length === 2) {
313
+ command.parents = [
314
+ path.resolve(commandsDir, `${parents[0]}.ts`),
315
+ path.resolve(commandsDir, parents[0], `${parents[1]}.ts`)
316
+ ];
317
+ } else {
318
+ command.parents = [];
319
+ }
301
320
  return command;
302
321
  }
322
+ function processSubcommands(ctx) {
323
+ for (let i = 0; i < 2; i++) {
324
+ const done = [];
325
+ ctx.slashCommands.forEach((command, i2) => {
326
+ if (command.parents.length > 0) {
327
+ const rootCommand = ctx.slashCommands.find((c) => c.path === command.parents[0]);
328
+ if (rootCommand) {
329
+ if (command.parents.length === 1) {
330
+ done.unshift(i2);
331
+ rootCommand.subcommands.push(command);
332
+ } else {
333
+ const subcommandGroup = rootCommand.subcommands.find(
334
+ (c) => c.path === command.parents[1]
335
+ );
336
+ if (subcommandGroup) {
337
+ done.unshift(i2);
338
+ subcommandGroup.subcommands.push(command);
339
+ }
340
+ }
341
+ }
342
+ }
343
+ });
344
+ done.forEach((i2) => ctx.slashCommands.splice(i2, 1));
345
+ }
346
+ const notProcessed = ctx.slashCommands.filter((c) => c.parents.length > 0);
347
+ for (const command of notProcessed) {
348
+ ctx.logger.warn(`Slash command ${command.name} is not processed, please create dummy parent command files:
349
+ ${command.parents.map((p) => ` - ${p}`).join("\n")}`);
350
+ }
351
+ ctx.slashCommands = ctx.slashCommands.filter((c) => c.parents.length === 0);
352
+ }
303
353
  function extractCommandDefinition(sourceFile) {
304
354
  let commandDefinition;
305
355
  ts.forEachChild(sourceFile, (node) => {
@@ -642,8 +692,9 @@ async function generateDynamicCommandBuild(file, config, ctx) {
642
692
  ]
643
693
  });
644
694
  const { output } = await bundle.generate({ ...config.output, sourcemap: false });
645
- fs.mkdirSync(path.join(ctx.nuxt.options.buildDir, "discord", "commands"), { recursive: true });
646
- fs.writeFileSync(file.replace(ctx.resolve.root(ctx.nuxt.options.rootDir), ctx.nuxt.options.buildDir).replace(".ts", ".mjs"), output[0].code, { encoding: "utf-8", flush: true });
695
+ const outputFilePath = file.replace(ctx.resolve.root(ctx.nuxt.options.rootDir), ctx.nuxt.options.buildDir).replace(".ts", ".mjs");
696
+ fs.mkdirSync(path.dirname(outputFilePath), { recursive: true });
697
+ fs.writeFileSync(outputFilePath, output[0].code, { encoding: "utf-8", flush: true });
647
698
  } catch (error) {
648
699
  ctx.logger.error(`Error processing command file ${file}:`, error);
649
700
  return;
@@ -690,6 +741,11 @@ declare module 'discord/slashCommands' {
690
741
  export default slashCommands
691
742
  }
692
743
 
744
+ declare module '#build/discord/slashCommands' {
745
+ declare const slashCommands: import('nuxt-discord').SlashCommand[]
746
+ export default slashCommands
747
+ }
748
+
693
749
  type integer = import('nuxt-discord').integer
694
750
 
695
751
  declare global {
@@ -720,23 +776,33 @@ declare global {
720
776
  });
721
777
  }
722
778
  function getSlashCommandTemplateContent(ctx, commandRuntime) {
723
- const imports = commandRuntime ? ctx.slashCommands.map(({ path }) => {
724
- const name = genSafeVariableName(path);
725
- return { name, code: genImport(path, [{ name: "default", as: name }]) };
726
- }) : [];
779
+ const imports = commandRuntime ? Object.fromEntries(ctx.slashCommands.flatMap(
780
+ function getImports(cmd) {
781
+ const name = genSafeVariableName(cmd.path);
782
+ return [
783
+ [cmd.path, { name, code: genImport(cmd.path, [{ name: "default", as: name }]) }],
784
+ ..."subcommands" in cmd ? cmd.subcommands.flatMap(getImports) : []
785
+ ];
786
+ }
787
+ )) : {};
727
788
  return [
728
- ...imports.map(({ code }) => code),
789
+ ...Object.values(imports).map(({ code }) => code),
729
790
  `export default [
730
- ${ctx.slashCommands.map(({ options, ...rest }, i) => ` {
791
+ ${ctx.slashCommands.map((cmd) => genCommandObject(cmd)).join(",\n")}]`
792
+ ].join("\n");
793
+ function genCommandObject({
794
+ options,
795
+ parents,
796
+ subcommands,
797
+ ...rest
798
+ }) {
799
+ return ` {
731
800
  ${Object.entries(rest).map(([key, value]) => `${key}: ${genString(value)}`).join(",\n ")},
732
-
733
801
  options: ${genArrayFromRaw(options, void 0, { preserveTypes: true })},
734
- ${commandRuntime ? `
735
- ...${imports[i].name},
736
- ` : ""}
737
- },
738
- `).join("")}]`
739
- ].join("\n");
802
+ ${subcommands.length > 0 ? `subcommands: [${subcommands.map(genCommandObject).join(",")}],` : ""}
803
+ ${commandRuntime ? `...${imports[rest.path].name},` : ""}
804
+ }`;
805
+ }
740
806
  }
741
807
 
742
808
  const module = defineNuxtModule({
@@ -1 +1 @@
1
- @supports ((-webkit-hyphens:none) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--un-border-opacity:100%;--un-divide-opacity:100%;--un-text-opacity:100%;--un-space-y-reverse:initial}}@property --un-text-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@property --un-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --un-border-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@property --un-inset-ring-color{syntax:"*";inherits:false}@property --un-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-inset-shadow-color{syntax:"*";inherits:false}@property --un-ring-color{syntax:"*";inherits:false}@property --un-ring-inset{syntax:"*";inherits:false}@property --un-ring-offset-color{syntax:"*";inherits:false}@property --un-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --un-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-shadow-color{syntax:"*";inherits:false}@property --un-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --un-divide-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}:host,:root{--spacing:0.25rem;--fontWeight-bold:700;--default-transition-timingFunction:cubic-bezier(0.4,0,0.2,1);--default-transition-duration:150ms;--fontWeight-semibold:600;--fontWeight-medium:500;--colors-gray-900:oklch(21% 0.034 264.665);--colors-gray-600:oklch(44.6% 0.03 256.802);--colors-gray-700:oklch(37.3% 0.034 259.733);--colors-gray-500:oklch(55.1% 0.027 264.364);--colors-gray-400:oklch(70.7% 0.022 261.325);--text-3xl-fontSize:1.875rem;--text-3xl-lineHeight:2.25rem;--text-sm-fontSize:0.875rem;--text-sm-lineHeight:1.25rem;--text-lg-fontSize:1.125rem;--text-lg-lineHeight:1.75rem;--text-xs-fontSize:0.75rem;--text-xs-lineHeight:1rem;--text-2xl-fontSize:1.5rem;--text-2xl-lineHeight:2rem;--colors-white:#fff;--colors-gray-200:oklch(92.8% 0.006 264.531);--colors-gray-300:oklch(87.2% 0.01 258.338)}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.text-3xl{font-size:var(--text-3xl-fontSize);line-height:var(--un-leading,var(--text-3xl-lineHeight))}.text-lg{font-size:var(--text-lg-fontSize);line-height:var(--un-leading,var(--text-lg-lineHeight))}.text-sm{font-size:var(--text-sm-fontSize);line-height:var(--un-leading,var(--text-sm-lineHeight))}.text-xs{font-size:var(--text-xs-fontSize);line-height:var(--un-leading,var(--text-xs-lineHeight))}.dark .dark\:text-gray-200{color:color-mix(in srgb,var(--colors-gray-200) var(--un-text-opacity),transparent)}.dark .dark\:text-gray-300{color:color-mix(in srgb,var(--colors-gray-300) var(--un-text-opacity),transparent)}.dark .dark\:text-gray-400,.text-gray-400{color:color-mix(in srgb,var(--colors-gray-400) var(--un-text-opacity),transparent)}.dark .dark\:text-white{color:color-mix(in srgb,var(--colors-white) var(--un-text-opacity),transparent)}.text-\[var\(--ui-error\)\]\!{color:color-mix(in oklab,var(--ui-error) var(--un-text-opacity),transparent)!important}.text-gray-500{color:color-mix(in srgb,var(--colors-gray-500) var(--un-text-opacity),transparent)}.text-gray-600{color:color-mix(in srgb,var(--colors-gray-600) var(--un-text-opacity),transparent)}.text-gray-700{color:color-mix(in srgb,var(--colors-gray-700) var(--un-text-opacity),transparent)}.text-gray-900{color:color-mix(in srgb,var(--colors-gray-900) var(--un-text-opacity),transparent)}.font-bold{--un-font-weight:var(--fontWeight-bold);font-weight:var(--fontWeight-bold)}.font-medium{--un-font-weight:var(--fontWeight-medium);font-weight:var(--fontWeight-medium)}.font-semibold{--un-font-weight:var(--fontWeight-semibold);font-weight:var(--fontWeight-semibold)}.mx-auto{margin-inline:auto}.my-6{margin-block:calc(var(--spacing)*6)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-16{margin-bottom:calc(var(--spacing)*16)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mt-4{margin-top:calc(var(--spacing)*4)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-12{padding-block:calc(var(--spacing)*12)}.pt-2{padding-top:calc(var(--spacing)*2)}.text-center{text-align:center}.outline{outline-style:var(--un-outline-style);outline-width:1px}.border{border-width:1px}.border-\[var\(--ui-error\)\]\/50,.divide-\[var\(--ui-error\)\]\/50>:not(:last-child){border-color:color-mix(in oklab,var(--ui-error) 50%,transparent)}.border-\[var\(--ui-neutral\)\]\/50,.divide-\[var\(--ui-neutral\)\]\/50>:not(:last-child){border-color:color-mix(in oklab,var(--ui-neutral) 50%,transparent)}.border-\[var\(--ui-secondary\)\]\/50,.divide-\[var\(--ui-secondary\)\]\/50>:not(:last-child){border-color:color-mix(in oklab,var(--ui-secondary) 50%,transparent)}.border-\[var\(--ui-warning\)\]\/50,.divide-\[var\(--ui-warning\)\]\/50>:not(:last-child){border-color:color-mix(in oklab,var(--ui-warning) 50%,transparent)}.border-dashed{--un-border-style:dashed;border-style:dashed}.flex{display:flex}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.grid{display:grid}.h-12{height:calc(var(--spacing)*12)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.w-12{width:calc(var(--spacing)*12)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-full{width:100%}.hover\:cursor-pointer:hover{cursor:pointer}.disabled\:hover\:cursor-not-allowed:hover:disabled{cursor:not-allowed}.ring-0{--un-ring-shadow:var(--un-ring-inset,) 0 0 0 calc(var(--un-ring-offset-width)) var(--un-ring-color,currentColor);box-shadow:var(--un-inset-shadow),var(--un-inset-ring-shadow),var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.transition-shadow{transition-duration:var(--un-duration,var(--default-transition-duration));transition-property:box-shadow;transition-timing-function:var(--un-ease,var(--default-transition-timingFunction))}.duration-200{--un-duration:200ms;transition-duration:.2s}.items-center{align-items:center}.justify-between{justify-content:space-between}.overflow-hidden{overflow:hidden}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.space-y-1>:not(:last-child){--un-space-y-reverse:0;margin-block-end:calc(var(--spacing)*1*(1 - var(--un-space-y-reverse)));margin-block-start:calc(var(--spacing)*1*var(--un-space-y-reverse))}.divide-dashed>:not(:last-child){border-style:dashed}@supports (color:color-mix(in lab,red,red)){.dark .dark\:text-gray-200{color:color-mix(in oklab,var(--colors-gray-200) var(--un-text-opacity),transparent)}.dark .dark\:text-gray-300{color:color-mix(in oklab,var(--colors-gray-300) var(--un-text-opacity),transparent)}.dark .dark\:text-gray-400{color:color-mix(in oklab,var(--colors-gray-400) var(--un-text-opacity),transparent)}.dark .dark\:text-white{color:color-mix(in oklab,var(--colors-white) var(--un-text-opacity),transparent)}.text-gray-400{color:color-mix(in oklab,var(--colors-gray-400) var(--un-text-opacity),transparent)}.text-gray-500{color:color-mix(in oklab,var(--colors-gray-500) var(--un-text-opacity),transparent)}.text-gray-600{color:color-mix(in oklab,var(--colors-gray-600) var(--un-text-opacity),transparent)}.text-gray-700{color:color-mix(in oklab,var(--colors-gray-700) var(--un-text-opacity),transparent)}.text-gray-900{color:color-mix(in oklab,var(--colors-gray-900) var(--un-text-opacity),transparent)}}@media (min-width:40rem){.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width:64rem){.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}
1
+ @supports ((-webkit-hyphens:none) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--un-border-opacity:100%;--un-divide-opacity:100%;--un-text-opacity:100%;--un-space-y-reverse:initial}}@property --un-text-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@property --un-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --un-border-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@property --un-inset-ring-color{syntax:"*";inherits:false}@property --un-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-inset-shadow-color{syntax:"*";inherits:false}@property --un-ring-color{syntax:"*";inherits:false}@property --un-ring-inset{syntax:"*";inherits:false}@property --un-ring-offset-color{syntax:"*";inherits:false}@property --un-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --un-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-shadow-color{syntax:"*";inherits:false}@property --un-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --un-divide-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}:host,:root{--spacing:0.25rem;--fontWeight-bold:700;--default-transition-timingFunction:cubic-bezier(0.4,0,0.2,1);--default-transition-duration:150ms;--fontWeight-semibold:600;--fontWeight-medium:500;--colors-gray-900:oklch(21% 0.034 264.665);--colors-gray-600:oklch(44.6% 0.03 256.802);--colors-gray-700:oklch(37.3% 0.034 259.733);--colors-gray-500:oklch(55.1% 0.027 264.364);--colors-gray-400:oklch(70.7% 0.022 261.325);--text-3xl-fontSize:1.875rem;--text-3xl-lineHeight:2.25rem;--text-sm-fontSize:0.875rem;--text-sm-lineHeight:1.25rem;--text-lg-fontSize:1.125rem;--text-lg-lineHeight:1.75rem;--text-xs-fontSize:0.75rem;--text-xs-lineHeight:1rem;--text-2xl-fontSize:1.5rem;--text-2xl-lineHeight:2rem;--colors-white:#fff;--colors-gray-200:oklch(92.8% 0.006 264.531);--colors-gray-300:oklch(87.2% 0.01 258.338)}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.text-3xl{font-size:var(--text-3xl-fontSize);line-height:var(--un-leading,var(--text-3xl-lineHeight))}.text-lg{font-size:var(--text-lg-fontSize);line-height:var(--un-leading,var(--text-lg-lineHeight))}.text-sm{font-size:var(--text-sm-fontSize);line-height:var(--un-leading,var(--text-sm-lineHeight))}.text-xs{font-size:var(--text-xs-fontSize);line-height:var(--un-leading,var(--text-xs-lineHeight))}.dark .dark\:text-gray-200{color:color-mix(in srgb,var(--colors-gray-200) var(--un-text-opacity),transparent)}.dark .dark\:text-gray-300{color:color-mix(in srgb,var(--colors-gray-300) var(--un-text-opacity),transparent)}.dark .dark\:text-gray-400,.text-gray-400{color:color-mix(in srgb,var(--colors-gray-400) var(--un-text-opacity),transparent)}.dark .dark\:text-white{color:color-mix(in srgb,var(--colors-white) var(--un-text-opacity),transparent)}.text-\[var\(--ui-error\)\]\!{color:color-mix(in oklab,var(--ui-error) var(--un-text-opacity),transparent)!important}.text-gray-500{color:color-mix(in srgb,var(--colors-gray-500) var(--un-text-opacity),transparent)}.text-gray-600{color:color-mix(in srgb,var(--colors-gray-600) var(--un-text-opacity),transparent)}.text-gray-700{color:color-mix(in srgb,var(--colors-gray-700) var(--un-text-opacity),transparent)}.text-gray-900{color:color-mix(in srgb,var(--colors-gray-900) var(--un-text-opacity),transparent)}.font-bold{--un-font-weight:var(--fontWeight-bold);font-weight:var(--fontWeight-bold)}.font-medium{--un-font-weight:var(--fontWeight-medium);font-weight:var(--fontWeight-medium)}.font-semibold{--un-font-weight:var(--fontWeight-semibold);font-weight:var(--fontWeight-semibold)}.mx-auto{margin-inline:auto}.my-0\.75{margin-block:calc(var(--spacing)*.75)}.my-6{margin-block:calc(var(--spacing)*6)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-16{margin-bottom:calc(var(--spacing)*16)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mt-4{margin-top:calc(var(--spacing)*4)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-12{padding-block:calc(var(--spacing)*12)}.pt-2{padding-top:calc(var(--spacing)*2)}.text-center{text-align:center}.outline{outline-style:var(--un-outline-style);outline-width:1px}.border{border-width:1px}.border-\[var\(--ui-error\)\]\/50,.divide-\[var\(--ui-error\)\]\/50>:not(:last-child){border-color:color-mix(in oklab,var(--ui-error) 50%,transparent)}.border-\[var\(--ui-neutral\)\]\/50,.divide-\[var\(--ui-neutral\)\]\/50>:not(:last-child){border-color:color-mix(in oklab,var(--ui-neutral) 50%,transparent)}.border-\[var\(--ui-secondary\)\]\/50,.divide-\[var\(--ui-secondary\)\]\/50>:not(:last-child){border-color:color-mix(in oklab,var(--ui-secondary) 50%,transparent)}.border-\[var\(--ui-warning\)\]\/50,.divide-\[var\(--ui-warning\)\]\/50>:not(:last-child){border-color:color-mix(in oklab,var(--ui-warning) 50%,transparent)}.border-dashed{--un-border-style:dashed;border-style:dashed}.flex{display:flex}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.grid{display:grid}.size-6{height:calc(var(--spacing)*6);width:calc(var(--spacing)*6)}.h-12{height:calc(var(--spacing)*12)}.h-4{height:calc(var(--spacing)*4)}.w-12{width:calc(var(--spacing)*12)}.w-4{width:calc(var(--spacing)*4)}.w-full{width:100%}.hover\:cursor-pointer:hover{cursor:pointer}.disabled\:hover\:cursor-not-allowed:hover:disabled{cursor:not-allowed}.ring-0{--un-ring-shadow:var(--un-ring-inset,) 0 0 0 calc(var(--un-ring-offset-width)) var(--un-ring-color,currentColor);box-shadow:var(--un-inset-shadow),var(--un-inset-ring-shadow),var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.transition-shadow{transition-duration:var(--un-duration,var(--default-transition-duration));transition-property:box-shadow;transition-timing-function:var(--un-ease,var(--default-transition-timingFunction))}.duration-200{--un-duration:200ms;transition-duration:.2s}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-between{justify-content:space-between}.overflow-hidden{overflow:hidden}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.space-y-1>:not(:last-child){--un-space-y-reverse:0;margin-block-end:calc(var(--spacing)*1*(1 - var(--un-space-y-reverse)));margin-block-start:calc(var(--spacing)*1*var(--un-space-y-reverse))}.divide-dashed>:not(:last-child){border-style:dashed}@supports (color:color-mix(in lab,red,red)){.dark .dark\:text-gray-200{color:color-mix(in oklab,var(--colors-gray-200) var(--un-text-opacity),transparent)}.dark .dark\:text-gray-300{color:color-mix(in oklab,var(--colors-gray-300) var(--un-text-opacity),transparent)}.dark .dark\:text-gray-400{color:color-mix(in oklab,var(--colors-gray-400) var(--un-text-opacity),transparent)}.dark .dark\:text-white{color:color-mix(in oklab,var(--colors-white) var(--un-text-opacity),transparent)}.text-gray-400{color:color-mix(in oklab,var(--colors-gray-400) var(--un-text-opacity),transparent)}.text-gray-500{color:color-mix(in oklab,var(--colors-gray-500) var(--un-text-opacity),transparent)}.text-gray-600{color:color-mix(in oklab,var(--colors-gray-600) var(--un-text-opacity),transparent)}.text-gray-700{color:color-mix(in oklab,var(--colors-gray-700) var(--un-text-opacity),transparent)}.text-gray-900{color:color-mix(in oklab,var(--colors-gray-900) var(--un-text-opacity),transparent)}}@media (min-width:40rem){.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width:64rem){.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}
@@ -1,4 +1,5 @@
1
1
  <script setup>
2
+ import slashCommands from "#build/discord/slashCommands";
2
3
  import { computed, ref, useFetch, useRuntimeConfig, watchEffect } from "#imports";
3
4
  import { useWebSocket } from "@vueuse/core";
4
5
  import TheHeader from "../components/TheHeader.vue";
@@ -69,7 +70,7 @@ function getRemoteId(command) {
69
70
  }
70
71
  return void 0;
71
72
  }
72
- const commands = ref([]);
73
+ const commands = ref(slashCommands);
73
74
  const {
74
75
  data: diff,
75
76
  refresh: refreshDiff
@@ -77,9 +78,6 @@ const {
77
78
  "/api/discord/slash-command/remote-diff",
78
79
  {
79
80
  method: "post",
80
- body: {
81
- commands
82
- },
83
81
  immediate: import.meta.dev
84
82
  }
85
83
  );
@@ -267,9 +265,9 @@ const statusClasses = {
267
265
  >
268
266
  <template #header>
269
267
  <div class="flex items-center justify-between">
270
- <div class="flex gap-3 items-center">
271
- <UIcon name="i-heroicons-command-line" class="text-primary-500 h-5 w-5" />
272
- <div>
268
+ <div class="flex gap-3 items-start">
269
+ <UIcon name="i-heroicons-command-line" class="text-primary-500 my-0.75 size-6" />
270
+ <div class="flex flex-col gap-1 items-start">
273
271
  <h3
274
272
  class="text-lg text-gray-700 font-semibold dark:text-gray-200"
275
273
  :class="command.status === 'conflict' && 'text-[var(--ui-error)]!'"
@@ -280,7 +278,14 @@ const statusClasses = {
280
278
  {{ command.description }}
281
279
  </p>
282
280
  <UBadge
283
- v-if="command.options.length > 0"
281
+ v-if="'subcommands' in command && (command.subcommands?.length ?? 0) > 0"
282
+ :label="`${command.subcommands.length} subcommand${command.subcommands.length === 1 ? '' : 's'}`"
283
+ variant="soft"
284
+ color="info"
285
+ size="sm"
286
+ />
287
+ <UBadge
288
+ v-else-if="command.options.length > 0"
284
289
  :label="`${command.options.length} option${command.options.length === 1 ? '' : 's'}`"
285
290
  variant="soft"
286
291
  color="neutral"
@@ -1,20 +1,239 @@
1
- import type { APIApplicationCommand } from 'discord.js';
2
- import type { SlashCommand, SlashCommandRuntime } from '../../../../../types.js';
3
- declare const _default: import("h3").EventHandler<{
4
- body?: {
5
- commands?: SlashCommand[];
6
- };
7
- }, Promise<{
8
- added: SlashCommandRuntime[];
9
- removed: APIApplicationCommand[];
1
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<{
2
+ added: (import("../../../../../types.js").SlashCommandRuntime | import("../../../../../types.js").SlashCommandSubcommandRuntime | import("../../../../../types.js").SlashCommandSubcommandGroupRuntime)[];
3
+ removed: ({
4
+ name: string;
5
+ subcommands: never[];
6
+ options?: import("discord.js").APIApplicationCommandBasicOption[];
7
+ type: import("discord.js").ApplicationCommandOptionType.Subcommand;
8
+ name_localizations?: import("discord.js").LocalizationMap | null;
9
+ description: string;
10
+ description_localizations?: import("discord.js").LocalizationMap | null;
11
+ required?: boolean;
12
+ } | {
13
+ name: string;
14
+ subcommands: {
15
+ name: string;
16
+ subcommands: never[];
17
+ options?: import("discord.js").APIApplicationCommandBasicOption[];
18
+ type: import("discord.js").ApplicationCommandOptionType.Subcommand;
19
+ name_localizations?: import("discord.js").LocalizationMap | null;
20
+ description: string;
21
+ description_localizations?: import("discord.js").LocalizationMap | null;
22
+ required?: boolean;
23
+ }[];
24
+ options?: import("discord.js").APIApplicationCommandSubcommandOption[];
25
+ type: import("discord.js").ApplicationCommandOptionType.SubcommandGroup;
26
+ name_localizations?: import("discord.js").LocalizationMap | null;
27
+ description: string;
28
+ description_localizations?: import("discord.js").LocalizationMap | null;
29
+ required?: boolean;
30
+ } | {
31
+ subcommands: ({
32
+ name: string;
33
+ subcommands: never[];
34
+ options?: import("discord.js").APIApplicationCommandBasicOption[];
35
+ type: import("discord.js").ApplicationCommandOptionType.Subcommand;
36
+ name_localizations?: import("discord.js").LocalizationMap | null;
37
+ description: string;
38
+ description_localizations?: import("discord.js").LocalizationMap | null;
39
+ required?: boolean;
40
+ } | {
41
+ name: string;
42
+ subcommands: {
43
+ name: string;
44
+ subcommands: never[];
45
+ options?: import("discord.js").APIApplicationCommandBasicOption[];
46
+ type: import("discord.js").ApplicationCommandOptionType.Subcommand;
47
+ name_localizations?: import("discord.js").LocalizationMap | null;
48
+ description: string;
49
+ description_localizations?: import("discord.js").LocalizationMap | null;
50
+ required?: boolean;
51
+ }[];
52
+ options?: import("discord.js").APIApplicationCommandSubcommandOption[];
53
+ type: import("discord.js").ApplicationCommandOptionType.SubcommandGroup;
54
+ name_localizations?: import("discord.js").LocalizationMap | null;
55
+ description: string;
56
+ description_localizations?: import("discord.js").LocalizationMap | null;
57
+ required?: boolean;
58
+ })[];
59
+ id: import("discord.js").Snowflake;
60
+ type: import("discord.js").ApplicationCommandType;
61
+ application_id: import("discord.js").Snowflake;
62
+ guild_id?: import("discord.js").Snowflake;
63
+ name: string;
64
+ name_localizations?: import("discord.js").LocalizationMap | null;
65
+ name_localized?: string;
66
+ description: string;
67
+ description_localizations?: import("discord.js").LocalizationMap | null;
68
+ description_localized?: string;
69
+ options?: import("discord.js").APIApplicationCommandOption[];
70
+ default_member_permissions: import("discord.js").Permissions | null;
71
+ dm_permission?: boolean;
72
+ default_permission?: boolean;
73
+ nsfw?: boolean;
74
+ integration_types?: import("discord.js").ApplicationIntegrationType[];
75
+ contexts?: import("discord.js").InteractionContextType[] | null;
76
+ version: import("discord.js").Snowflake;
77
+ handler?: import("discord.js").EntryPointCommandHandlerType;
78
+ })[];
10
79
  changed: {
11
- local: SlashCommandRuntime;
12
- remote: APIApplicationCommand;
80
+ local: import("../../../../../types.js").SlashCommandRuntime | import("../../../../../types.js").SlashCommandSubcommandRuntime | import("../../../../../types.js").SlashCommandSubcommandGroupRuntime;
81
+ remote: {
82
+ name: string;
83
+ subcommands: never[];
84
+ options?: import("discord.js").APIApplicationCommandBasicOption[];
85
+ type: import("discord.js").ApplicationCommandOptionType.Subcommand;
86
+ name_localizations?: import("discord.js").LocalizationMap | null;
87
+ description: string;
88
+ description_localizations?: import("discord.js").LocalizationMap | null;
89
+ required?: boolean;
90
+ } | {
91
+ name: string;
92
+ subcommands: {
93
+ name: string;
94
+ subcommands: never[];
95
+ options?: import("discord.js").APIApplicationCommandBasicOption[];
96
+ type: import("discord.js").ApplicationCommandOptionType.Subcommand;
97
+ name_localizations?: import("discord.js").LocalizationMap | null;
98
+ description: string;
99
+ description_localizations?: import("discord.js").LocalizationMap | null;
100
+ required?: boolean;
101
+ }[];
102
+ options?: import("discord.js").APIApplicationCommandSubcommandOption[];
103
+ type: import("discord.js").ApplicationCommandOptionType.SubcommandGroup;
104
+ name_localizations?: import("discord.js").LocalizationMap | null;
105
+ description: string;
106
+ description_localizations?: import("discord.js").LocalizationMap | null;
107
+ required?: boolean;
108
+ } | {
109
+ subcommands: ({
110
+ name: string;
111
+ subcommands: never[];
112
+ options?: import("discord.js").APIApplicationCommandBasicOption[];
113
+ type: import("discord.js").ApplicationCommandOptionType.Subcommand;
114
+ name_localizations?: import("discord.js").LocalizationMap | null;
115
+ description: string;
116
+ description_localizations?: import("discord.js").LocalizationMap | null;
117
+ required?: boolean;
118
+ } | {
119
+ name: string;
120
+ subcommands: {
121
+ name: string;
122
+ subcommands: never[];
123
+ options?: import("discord.js").APIApplicationCommandBasicOption[];
124
+ type: import("discord.js").ApplicationCommandOptionType.Subcommand;
125
+ name_localizations?: import("discord.js").LocalizationMap | null;
126
+ description: string;
127
+ description_localizations?: import("discord.js").LocalizationMap | null;
128
+ required?: boolean;
129
+ }[];
130
+ options?: import("discord.js").APIApplicationCommandSubcommandOption[];
131
+ type: import("discord.js").ApplicationCommandOptionType.SubcommandGroup;
132
+ name_localizations?: import("discord.js").LocalizationMap | null;
133
+ description: string;
134
+ description_localizations?: import("discord.js").LocalizationMap | null;
135
+ required?: boolean;
136
+ })[];
137
+ id: import("discord.js").Snowflake;
138
+ type: import("discord.js").ApplicationCommandType;
139
+ application_id: import("discord.js").Snowflake;
140
+ guild_id?: import("discord.js").Snowflake;
141
+ name: string;
142
+ name_localizations?: import("discord.js").LocalizationMap | null;
143
+ name_localized?: string;
144
+ description: string;
145
+ description_localizations?: import("discord.js").LocalizationMap | null;
146
+ description_localized?: string;
147
+ options?: import("discord.js").APIApplicationCommandOption[];
148
+ default_member_permissions: import("discord.js").Permissions | null;
149
+ dm_permission?: boolean;
150
+ default_permission?: boolean;
151
+ nsfw?: boolean;
152
+ integration_types?: import("discord.js").ApplicationIntegrationType[];
153
+ contexts?: import("discord.js").InteractionContextType[] | null;
154
+ version: import("discord.js").Snowflake;
155
+ handler?: import("discord.js").EntryPointCommandHandlerType;
156
+ };
13
157
  }[];
14
158
  synced: {
15
- local: SlashCommandRuntime;
16
- remote: APIApplicationCommand;
159
+ local: import("../../../../../types.js").SlashCommandRuntime | import("../../../../../types.js").SlashCommandSubcommandRuntime | import("../../../../../types.js").SlashCommandSubcommandGroupRuntime;
160
+ remote: {
161
+ name: string;
162
+ subcommands: never[];
163
+ options?: import("discord.js").APIApplicationCommandBasicOption[];
164
+ type: import("discord.js").ApplicationCommandOptionType.Subcommand;
165
+ name_localizations?: import("discord.js").LocalizationMap | null;
166
+ description: string;
167
+ description_localizations?: import("discord.js").LocalizationMap | null;
168
+ required?: boolean;
169
+ } | {
170
+ name: string;
171
+ subcommands: {
172
+ name: string;
173
+ subcommands: never[];
174
+ options?: import("discord.js").APIApplicationCommandBasicOption[];
175
+ type: import("discord.js").ApplicationCommandOptionType.Subcommand;
176
+ name_localizations?: import("discord.js").LocalizationMap | null;
177
+ description: string;
178
+ description_localizations?: import("discord.js").LocalizationMap | null;
179
+ required?: boolean;
180
+ }[];
181
+ options?: import("discord.js").APIApplicationCommandSubcommandOption[];
182
+ type: import("discord.js").ApplicationCommandOptionType.SubcommandGroup;
183
+ name_localizations?: import("discord.js").LocalizationMap | null;
184
+ description: string;
185
+ description_localizations?: import("discord.js").LocalizationMap | null;
186
+ required?: boolean;
187
+ } | {
188
+ subcommands: ({
189
+ name: string;
190
+ subcommands: never[];
191
+ options?: import("discord.js").APIApplicationCommandBasicOption[];
192
+ type: import("discord.js").ApplicationCommandOptionType.Subcommand;
193
+ name_localizations?: import("discord.js").LocalizationMap | null;
194
+ description: string;
195
+ description_localizations?: import("discord.js").LocalizationMap | null;
196
+ required?: boolean;
197
+ } | {
198
+ name: string;
199
+ subcommands: {
200
+ name: string;
201
+ subcommands: never[];
202
+ options?: import("discord.js").APIApplicationCommandBasicOption[];
203
+ type: import("discord.js").ApplicationCommandOptionType.Subcommand;
204
+ name_localizations?: import("discord.js").LocalizationMap | null;
205
+ description: string;
206
+ description_localizations?: import("discord.js").LocalizationMap | null;
207
+ required?: boolean;
208
+ }[];
209
+ options?: import("discord.js").APIApplicationCommandSubcommandOption[];
210
+ type: import("discord.js").ApplicationCommandOptionType.SubcommandGroup;
211
+ name_localizations?: import("discord.js").LocalizationMap | null;
212
+ description: string;
213
+ description_localizations?: import("discord.js").LocalizationMap | null;
214
+ required?: boolean;
215
+ })[];
216
+ id: import("discord.js").Snowflake;
217
+ type: import("discord.js").ApplicationCommandType;
218
+ application_id: import("discord.js").Snowflake;
219
+ guild_id?: import("discord.js").Snowflake;
220
+ name: string;
221
+ name_localizations?: import("discord.js").LocalizationMap | null;
222
+ name_localized?: string;
223
+ description: string;
224
+ description_localizations?: import("discord.js").LocalizationMap | null;
225
+ description_localized?: string;
226
+ options?: import("discord.js").APIApplicationCommandOption[];
227
+ default_member_permissions: import("discord.js").Permissions | null;
228
+ dm_permission?: boolean;
229
+ default_permission?: boolean;
230
+ nsfw?: boolean;
231
+ integration_types?: import("discord.js").ApplicationIntegrationType[];
232
+ contexts?: import("discord.js").InteractionContextType[] | null;
233
+ version: import("discord.js").Snowflake;
234
+ handler?: import("discord.js").EntryPointCommandHandlerType;
235
+ };
17
236
  }[];
18
- conflict: SlashCommandRuntime[];
237
+ conflict: (import("../../../../../types.js").SlashCommandRuntime | import("../../../../../types.js").SlashCommandSubcommandRuntime | import("../../../../../types.js").SlashCommandSubcommandGroupRuntime)[];
19
238
  }>>;
20
239
  export default _default;
@@ -19,7 +19,7 @@ export default defineNitroPlugin(async (nitro) => {
19
19
  for (const cmd of data.commands) {
20
20
  const runtimeCommand = cmd;
21
21
  const buildPath = cmd.path.replace(runtimeConfig.discord.rootDir, runtimeConfig.discord.buildDir).replace(/\.ts$/, ".mjs");
22
- const existingCommand = slashCommands.find((c) => c.path === cmd.path);
22
+ const existingCommand = client.getSlashCommands().find((c) => c.path === cmd.path);
23
23
  if (fs.existsSync(buildPath)) {
24
24
  const lastModified = fs.statSync(buildPath).mtimeMs;
25
25
  runtimeCommand.load = () => import(`${buildPath}?${lastModified}`).then((m) => m.default);
@@ -1,6 +1,6 @@
1
- import type { APIApplicationCommand, ChatInputCommandInteraction, CommandInteraction, RESTGetAPIApplicationCommandsResult, RESTPutAPIApplicationCommandsResult } from 'discord.js';
2
- import type { NuxtDiscordOptions, SlashCommandRuntime } from '../../../types.js';
3
- import { Client as InternalClient } from 'discord.js';
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';
4
4
  export interface DiscordClientErrorBase {
5
5
  type: string;
6
6
  client: DiscordClient;
@@ -45,18 +45,243 @@ export declare class DiscordClient {
45
45
  getSlashCommand(name: string): SlashCommandRuntime | undefined;
46
46
  getRemoteSlashCommands(): Promise<RESTGetAPIApplicationCommandsResult>;
47
47
  diffRemoteSlashCommands(localCommands?: SlashCommandRuntime[], forceRefresh?: boolean): Promise<{
48
- added: SlashCommandRuntime[];
49
- removed: APIApplicationCommand[];
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
+ })[];
50
125
  changed: {
51
- local: SlashCommandRuntime;
52
- remote: APIApplicationCommand;
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
+ };
53
203
  }[];
54
204
  synced: {
55
- local: SlashCommandRuntime;
56
- remote: APIApplicationCommand;
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
+ };
57
282
  }[];
58
- conflict: SlashCommandRuntime[];
283
+ conflict: (SlashCommandRuntime | SlashCommandSubcommandRuntime | SlashCommandSubcommandGroupRuntime)[];
59
284
  }>;
60
- registerSlashCommands(): Promise<RESTPutAPIApplicationCommandsResult | PromiseSettledResult<APIApplicationCommand>[]>;
285
+ registerSlashCommands(): Promise<RESTPutAPIApplicationCommandsResult | PromiseSettledResult<import("discord.js").APIApplicationCommand>[]>;
61
286
  }
62
287
  export declare function isPromise(value: any): value is Promise<unknown>;
@@ -1,5 +1,5 @@
1
1
  import process from "node:process";
2
- import { ApplicationCommandOptionType, Events, Client as InternalClient, REST, Routes, SlashCommandBuilder } from "discord.js";
2
+ import { ApplicationCommandOptionType, Events, Client as InternalClient, REST, Routes, SlashCommandBuilder, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from "discord.js";
3
3
  import { useNitroApp } from "nitropack/runtime";
4
4
  import { effectScope, isRef } from "vue";
5
5
  import { logger } from "../../logger.js";
@@ -53,7 +53,27 @@ export class DiscordClient {
53
53
  return;
54
54
  }
55
55
  const commandName = interaction.commandName;
56
- const command = this.#slashCommands.find((cmd) => cmd.name === commandName);
56
+ let command = this.#slashCommands.find((cmd) => cmd.name === commandName);
57
+ if (!command) {
58
+ logger.warn(`Unknown slash command: ${commandName}`);
59
+ this.#nitro.hooks.callHook("discord:client:error", {
60
+ type: "UnknownSlashCommandError",
61
+ client: this,
62
+ interaction
63
+ });
64
+ return;
65
+ }
66
+ if (command.subcommands != null && (command.subcommands?.length ?? 0) > 0) {
67
+ const group = interaction.options.getSubcommandGroup(false);
68
+ const subcommand = interaction.options.getSubcommand(false);
69
+ if (group && subcommand) {
70
+ command = command.subcommands.find((subcmd) => subcmd.name === group)?.subcommands?.find((subcmd) => subcmd.name === subcommand);
71
+ } else if (subcommand) {
72
+ command = command.subcommands.find((subcmd) => subcmd.name === subcommand);
73
+ } else {
74
+ logger.warn(`Unknown slash command subcommand: ${commandName} ${group ?? ""} ${subcommand}`);
75
+ }
76
+ }
57
77
  if (!command) {
58
78
  logger.warn(`Unknown slash command: ${commandName}`);
59
79
  this.#nitro.hooks.callHook("discord:client:error", {
@@ -266,67 +286,84 @@ export class DiscordClient {
266
286
  const choices = await autocompleteFunction(focusedOption.value, interaction);
267
287
  await interaction.respond(choices);
268
288
  }
269
- #getSlashCommandBuilder(command) {
270
- const builder = new SlashCommandBuilder().setName(command.name).setDescription(command.description);
271
- for (const option of command.options) {
272
- switch (option.type) {
273
- case ApplicationCommandOptionType.String:
274
- builder.addStringOption((opt) => {
275
- opt.setName(option.name).setRequired(option.required);
276
- if (option.description.length > 0)
277
- opt = opt.setDescription(option.description);
278
- if (option.minLength)
279
- opt = opt.setMinLength(option.minLength);
280
- if (option.maxLength)
281
- opt = opt.setMaxLength(option.maxLength);
282
- if (option.choices)
283
- opt = opt.addChoices(...option.choices);
284
- if (option.hasAutocomplete) {
285
- opt = opt.setAutocomplete(true);
286
- }
287
- return opt;
288
- });
289
- break;
290
- case ApplicationCommandOptionType.Integer:
291
- builder.addIntegerOption((opt) => {
292
- opt.setName(option.name).setRequired(option.required);
293
- if (option.description.length > 0)
294
- opt = opt.setDescription(option.description);
295
- if (option.min)
296
- opt = opt.setMinValue(option.min);
297
- if (option.max)
298
- opt = opt.setMaxValue(option.max);
299
- if (option.choices)
300
- opt = opt.addChoices(...option.choices);
301
- if (option.hasAutocomplete)
302
- opt = opt.setAutocomplete(true);
303
- return opt;
304
- });
305
- break;
306
- case ApplicationCommandOptionType.Number:
307
- builder.addNumberOption((opt) => {
308
- opt.setName(option.name).setRequired(option.required);
309
- if (option.description.length > 0)
310
- opt = opt.setDescription(option.description);
311
- if (option.min)
312
- opt = opt.setMinValue(option.min);
313
- if (option.max)
314
- opt = opt.setMaxValue(option.max);
315
- if (option.choices)
316
- opt = opt.addChoices(...option.choices);
317
- if (option.hasAutocomplete)
318
- opt = opt.setAutocomplete(true);
319
- return opt;
320
- });
321
- break;
322
- case ApplicationCommandOptionType.Boolean:
323
- builder.addBooleanOption((opt) => {
324
- opt.setName(option.name).setRequired(option.required);
325
- if (option.description.length > 0)
326
- opt = opt.setDescription(option.description);
327
- return opt;
328
- });
329
- break;
289
+ #getSlashCommandBuilder(command, builder) {
290
+ builder ??= new SlashCommandBuilder();
291
+ builder.setName(command.name).setDescription(command.description);
292
+ if (command.subcommands != null && command.subcommands.length > 0) {
293
+ for (const subcommand of command.subcommands) {
294
+ if (builder instanceof SlashCommandBuilder) {
295
+ if ("subcommands" in subcommand && (subcommand.subcommands?.length ?? 0) > 0) {
296
+ builder.addSubcommandGroup((subcommandGroupBuilder) => this.#getSlashCommandBuilder(subcommand, subcommandGroupBuilder));
297
+ } else {
298
+ builder.addSubcommand((subcommandBuilder) => this.#getSlashCommandBuilder(subcommand, subcommandBuilder));
299
+ }
300
+ } else if (builder instanceof SlashCommandSubcommandGroupBuilder) {
301
+ builder.addSubcommand((subcommandBuilder) => this.#getSlashCommandBuilder(subcommand, subcommandBuilder));
302
+ } else {
303
+ throw new TypeError(`Unexpected builder type: ${builder.constructor.name}`);
304
+ }
305
+ }
306
+ } else if (builder instanceof SlashCommandBuilder || builder instanceof SlashCommandSubcommandBuilder) {
307
+ for (const option of command.options) {
308
+ switch (option.type) {
309
+ case ApplicationCommandOptionType.String:
310
+ builder.addStringOption((opt) => {
311
+ opt.setName(option.name).setRequired(option.required);
312
+ if (option.description.length > 0)
313
+ opt = opt.setDescription(option.description);
314
+ if (option.minLength)
315
+ opt = opt.setMinLength(option.minLength);
316
+ if (option.maxLength)
317
+ opt = opt.setMaxLength(option.maxLength);
318
+ if (option.choices)
319
+ opt = opt.addChoices(...option.choices);
320
+ if (option.hasAutocomplete) {
321
+ opt = opt.setAutocomplete(true);
322
+ }
323
+ return opt;
324
+ });
325
+ break;
326
+ case ApplicationCommandOptionType.Integer:
327
+ builder.addIntegerOption((opt) => {
328
+ opt.setName(option.name).setRequired(option.required);
329
+ if (option.description.length > 0)
330
+ opt = opt.setDescription(option.description);
331
+ if (option.min)
332
+ opt = opt.setMinValue(option.min);
333
+ if (option.max)
334
+ opt = opt.setMaxValue(option.max);
335
+ if (option.choices)
336
+ opt = opt.addChoices(...option.choices);
337
+ if (option.hasAutocomplete)
338
+ opt = opt.setAutocomplete(true);
339
+ return opt;
340
+ });
341
+ break;
342
+ case ApplicationCommandOptionType.Number:
343
+ builder.addNumberOption((opt) => {
344
+ opt.setName(option.name).setRequired(option.required);
345
+ if (option.description.length > 0)
346
+ opt = opt.setDescription(option.description);
347
+ if (option.min)
348
+ opt = opt.setMinValue(option.min);
349
+ if (option.max)
350
+ opt = opt.setMaxValue(option.max);
351
+ if (option.choices)
352
+ opt = opt.addChoices(...option.choices);
353
+ if (option.hasAutocomplete)
354
+ opt = opt.setAutocomplete(true);
355
+ return opt;
356
+ });
357
+ break;
358
+ case ApplicationCommandOptionType.Boolean:
359
+ builder.addBooleanOption((opt) => {
360
+ opt.setName(option.name).setRequired(option.required);
361
+ if (option.description.length > 0)
362
+ opt = opt.setDescription(option.description);
363
+ return opt;
364
+ });
365
+ break;
366
+ }
330
367
  }
331
368
  }
332
369
  return builder;
@@ -341,23 +378,61 @@ export class DiscordClient {
341
378
  await this.getRemoteSlashCommands();
342
379
  }
343
380
  const remoteCommands = this.#cachedRemoteSlashCommands;
344
- const nameToCommands = localCommands.reduce((acc, command) => {
381
+ const flattenedRemoteCommands = remoteCommands.flatMap((cmd) => {
382
+ const subcommands = cmd.options?.flatMap((option) => {
383
+ const name = `${cmd.name} ${option.name}`;
384
+ if (option.type === ApplicationCommandOptionType.Subcommand) {
385
+ return [{ ...option, name, subcommands: [] }];
386
+ } else if (option.type === ApplicationCommandOptionType.SubcommandGroup) {
387
+ const subcommands2 = option.options?.flatMap((suboption) => {
388
+ return suboption.type === ApplicationCommandOptionType.Subcommand ? [{ ...suboption, name: `${name} ${suboption.name}`, subcommands: [] }] : [];
389
+ }) ?? [];
390
+ return [
391
+ { ...option, name, subcommands: subcommands2 },
392
+ ...subcommands2
393
+ ];
394
+ }
395
+ return [];
396
+ }) ?? [];
397
+ return [
398
+ { ...cmd, subcommands },
399
+ ...subcommands
400
+ ];
401
+ });
402
+ const flattenedLocalCommands = localCommands.flatMap(
403
+ (cmd) => [
404
+ cmd,
405
+ ...cmd.subcommands?.flatMap((subcmd) => {
406
+ const name = `${cmd.name} ${subcmd.name}`;
407
+ return [
408
+ { ...subcmd, name },
409
+ ...subcmd.subcommands?.map((subsubcmd) => ({ ...subsubcmd, name: `${name} ${subsubcmd.name}` })) ?? []
410
+ ];
411
+ }) ?? []
412
+ ]
413
+ );
414
+ const nameToCommands = flattenedLocalCommands.reduce((acc, command) => {
345
415
  (acc[command.name] ??= []).push(command);
346
416
  return acc;
347
417
  }, {});
348
- return localCommands.reduce((acc, command) => {
349
- const remoteCommand = remoteCommands.find((cmd) => cmd.name === command.name);
418
+ return flattenedLocalCommands.reduce((acc, command) => {
350
419
  if (nameToCommands[command.name].length > 1) {
351
420
  acc.conflict.push(command);
352
- } else if (!remoteCommand) {
421
+ return acc;
422
+ }
423
+ const remoteCommand = flattenedRemoteCommands.find((cmd) => cmd.name === command.name);
424
+ if (!remoteCommand) {
353
425
  acc.added.push(command);
354
- } else if (!propsEqual(command, remoteCommand, [
355
- "description"
356
- /* TODO: more */
357
- ]) || (command.options?.length ?? 0) !== (remoteCommand.options?.length ?? 0) || (remoteCommand.options ?? []).some((opt, i) => !optionEqual(command.options[i], opt))) {
426
+ } else if (
427
+ // if some properties are different
428
+ !propsEqual(command, remoteCommand, [
429
+ "description"
430
+ /* TODO: more */
431
+ ]) || !((command.subcommands?.length ?? 0) > 0 && remoteCommand.subcommands.length > 0) && ((command.options?.length ?? 0) !== (remoteCommand.options?.length ?? 0) || (remoteCommand.options ?? []).some((opt, i) => !optionEqual(command.options[i], opt)))
432
+ ) {
358
433
  acc.changed.push({ local: command, remote: remoteCommand });
359
434
  } else {
360
- if (remoteCommand.id && !command.id) {
435
+ if ("id" in remoteCommand && !command.id) {
361
436
  command.id = remoteCommand.id;
362
437
  }
363
438
  acc.synced.push({ local: command, remote: remoteCommand });
@@ -365,7 +440,7 @@ export class DiscordClient {
365
440
  return acc;
366
441
  }, {
367
442
  added: [],
368
- removed: remoteCommands.filter(({ name }) => !localCommands.some((cmd) => cmd.name === name)),
443
+ removed: flattenedRemoteCommands.filter(({ name }) => !(name in nameToCommands)),
369
444
  changed: [],
370
445
  synced: [],
371
446
  conflict: []
@@ -378,7 +453,7 @@ export class DiscordClient {
378
453
  return [];
379
454
  }
380
455
  this.#cachedRemoteSlashCommands = null;
381
- if (diff.added.length > 0 || diff.removed.length > 0 || diff.changed.length > 2) {
456
+ if (true) {
382
457
  try {
383
458
  const result = await this.#rest.put(
384
459
  Routes.applicationCommands(this.#clientId),
@@ -402,6 +477,8 @@ export class DiscordClient {
402
477
  } else {
403
478
  const results = await Promise.allSettled(
404
479
  diff.changed.map((command) => {
480
+ if (!("id" in command.remote))
481
+ return Promise.reject(new Error(`Remote command ${command.local.name} does not have an ID`));
405
482
  logger.log(`Updating slash command: ${command.local.name}`);
406
483
  const builder = this.#getSlashCommandBuilder(command.local);
407
484
  return this.#rest.patch(
package/dist/types.d.mts CHANGED
@@ -6,4 +6,4 @@ export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<
6
6
 
7
7
  export { default, type slashCommandOptionTypeIdentifiers, type typeIdentifierToEnum } from './module.mjs'
8
8
 
9
- export { type DiscordRuntimeConfig, type NuxtDiscordContext, type NuxtDiscordOptions, type SlashCommand, type SlashCommandBooleanOption, type SlashCommandCustomReturnHandler, type SlashCommandIntegerOption, type SlashCommandNumberOption, type SlashCommandOption, type SlashCommandOptionBase, type SlashCommandOptionType, type SlashCommandOptionTypeIdentifier, type SlashCommandReturnType, type SlashCommandRuntime, type SlashCommandStringOption, type integer } from './module.mjs'
9
+ export { type DiscordRuntimeConfig, type NuxtDiscordContext, type NuxtDiscordOptions, type SlashCommand, type SlashCommandBooleanOption, type SlashCommandCustomReturnHandler, type SlashCommandIntegerOption, type SlashCommandNumberOption, type SlashCommandOption, type SlashCommandOptionBase, type SlashCommandOptionType, type SlashCommandOptionTypeIdentifier, type SlashCommandReturnType, type SlashCommandRuntime, type SlashCommandStringOption, type SlashCommandSubcommand, type SlashCommandSubcommandGroup, type SlashCommandSubcommandGroupRuntime, type SlashCommandSubcommandRuntime, type integer } from './module.mjs'
package/dist/types.d.ts CHANGED
@@ -6,4 +6,4 @@ export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<
6
6
 
7
7
  export { default, type slashCommandOptionTypeIdentifiers, type typeIdentifierToEnum } from './module.mjs'
8
8
 
9
- export { type DiscordRuntimeConfig, type NuxtDiscordContext, type NuxtDiscordOptions, type SlashCommand, type SlashCommandBooleanOption, type SlashCommandCustomReturnHandler, type SlashCommandIntegerOption, type SlashCommandNumberOption, type SlashCommandOption, type SlashCommandOptionBase, type SlashCommandOptionType, type SlashCommandOptionTypeIdentifier, type SlashCommandReturnType, type SlashCommandRuntime, type SlashCommandStringOption, type integer } from './module.mjs'
9
+ export { type DiscordRuntimeConfig, type NuxtDiscordContext, type NuxtDiscordOptions, type SlashCommand, type SlashCommandBooleanOption, type SlashCommandCustomReturnHandler, type SlashCommandIntegerOption, type SlashCommandNumberOption, type SlashCommandOption, type SlashCommandOptionBase, type SlashCommandOptionType, type SlashCommandOptionTypeIdentifier, type SlashCommandReturnType, type SlashCommandRuntime, type SlashCommandStringOption, type SlashCommandSubcommand, type SlashCommandSubcommandGroup, type SlashCommandSubcommandGroupRuntime, type SlashCommandSubcommandRuntime, type integer } from './module.mjs'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-discord",
3
3
  "type": "module",
4
- "version": "0.0.16",
4
+ "version": "0.0.17",
5
5
  "description": "A Nuxt module for building Discord bots",
6
6
  "author": "Jize Zou <jeffzou2001@gmail.com> (https://github.com/zojize)",
7
7
  "license": "MIT",
@@ -81,7 +81,7 @@
81
81
  },
82
82
  "scripts": {
83
83
  "dev": "pnpm run dev:prepare && nuxi dev playground",
84
- "dev:debug": "pnpm run dev:prepare && NODE_OPTIONS='--inspect' nuxi dev playground",
84
+ "dev:debug": "pnpm run dev:prepare && node --inspect ./node_modules/nuxt/bin/nuxt.mjs dev playground --no-fork",
85
85
  "dev:build": "nuxi build playground",
86
86
  "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
87
87
  "release": "pnpm run lint && pnpm run test && pnpm run prepack && changelogen --release && pnpm publish && git push --follow-tags",