Skip to content

Commit

Permalink
Handlers need to pass client for non transformed interactions
Browse files Browse the repository at this point in the history
  • Loading branch information
Didas-git committed Sep 5, 2024
1 parent 69b5b49 commit da7eb17
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/handlers/src/advanced/application-command-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ type MapOptionType<T extends ApplicationCommandOptionType> = T extends Applicati

export type ApplicationCommandHandler<O extends Array<CommandOption>, U extends boolean> = U extends true
? (interaction: TransformedInteraction<ApplicationCommandData>) => Awaitable<unknown>
: (interaction: Interaction.ApplicationCommandInteractionStructure, options: Expand<ParseOptions<O>>) => Awaitable<unknown>;
: (client: Client, interaction: Interaction.ApplicationCommandInteractionStructure, options: Expand<ParseOptions<O>>) => Awaitable<unknown>;

export type ApplicationAutocompleteHandler<O extends Array<CommandOption>, U extends boolean> = U extends true
? (interaction: TransformedInteraction<AutocompleteData>) => Awaitable<unknown>
: (interaction: Interaction.ApplicationCommandInteractionStructure, options: Expand<ParseOptions<O>>) => Awaitable<unknown>;
: (client: Client, interaction: Interaction.ApplicationCommandInteractionStructure, options: Expand<ParseOptions<O>>) => Awaitable<unknown>;

interface CompiledCommand {
body: { command: string, autocomplete: string | null };
Expand Down Expand Up @@ -154,7 +154,7 @@ export class ApplicationCommandStore<U extends boolean> {
handlers.push(handler.auto_executor);
}

let strArgs = useTransformer ? "transformer(client, interaction)" : "interaction";
let strArgs = useTransformer ? "transformer(client, interaction)" : "client, interaction";
if (hasOptions && !useTransformer) strArgs += ", _obj";

return {
Expand Down

0 comments on commit da7eb17

Please sign in to comment.