diff --git a/src/handler/events/interactionCreate.ts b/src/handler/events/interactionCreate.ts index 2d25e3f..a5a07e7 100644 --- a/src/handler/events/interactionCreate.ts +++ b/src/handler/events/interactionCreate.ts @@ -149,9 +149,7 @@ function autoCmpHandler(mod: Module | undefined, interaction: AutocompleteIntera filterCorrectModule(CommandType.Slash), concatMap(mod => { const choice = interaction.options.getFocused(true); - const selectedOption = mod.options?.find( - o => o.autocomplete && o.command.name === choice.name, - ); + const selectedOption = mod.options?.find(o => o.autocomplete && o.name === choice.name); if (selectedOption !== undefined && selectedOption.autocomplete) { return of( selectedOption.command.onEvent?.map(e => diff --git a/src/handler/plugins/plugin.ts b/src/handler/plugins/plugin.ts index 39752e2..4f9bc55 100644 --- a/src/handler/plugins/plugin.ts +++ b/src/handler/plugins/plugin.ts @@ -67,7 +67,6 @@ type ModuleNoPlugins = ValueOf<{ }>; //TODO: I WANT BETTER TYPINGS AHHHHHHHHHHHHHHH - export function sernModule(plugins: CommandPlugin[], mod: ModuleNoPlugins): Module { if (mod.type !== CommandType.Autocomplete) return { diff --git a/src/handler/structures/module.ts b/src/handler/structures/module.ts index dfbd116..f2165f1 100644 --- a/src/handler/structures/module.ts +++ b/src/handler/structures/module.ts @@ -111,7 +111,7 @@ export type ModalSubmitCommand = Override< export type AutocompleteCommand = Override< BaseModule, { - name : string, + name: string; type: CommandType.Autocomplete; onEvent?: EventPlugin[]; execute: (ctx: AutocompleteInteraction) => Awaitable; @@ -143,14 +143,16 @@ export type ModuleDefs = { [CommandType.Autocomplete]: AutocompleteCommand; }; -type OptionsData = +export type OptionsData = | Exclude | { - required?: boolean; + name: string; + description: string; autocomplete: true; + required?: boolean; type: | ApplicationCommandOptionType.String | ApplicationCommandOptionType.Number | ApplicationCommandOptionType.Integer; - command: AutocompleteCommand; + command: Omit; }; diff --git a/src/handler/structures/structxports.ts b/src/handler/structures/structxports.ts index a9fed98..9e544ec 100644 --- a/src/handler/structures/structxports.ts +++ b/src/handler/structures/structxports.ts @@ -1,6 +1,6 @@ import Context from './context'; -import type { BothCommand, Module, SlashCommand, TextCommand } from './module'; +import type { BothCommand, Module, SlashCommand, TextCommand, OptionsData } from './module'; import type Wrapper from './wrapper'; export * from './enums'; -export { Context, SlashCommand, TextCommand, BothCommand, Module, Wrapper }; +export { Context, SlashCommand, TextCommand, BothCommand, Module, Wrapper, OptionsData };