fix: options resolver

This commit is contained in:
MARCROCK22 2024-05-09 14:35:34 -04:00
parent d72d6c0844
commit b5099a005e
3 changed files with 13 additions and 10 deletions

View File

@ -41,7 +41,7 @@ export async function onInteractionCreate(
body.guild_id,
body.data.resolved as ContextOptionsResolved,
);
const interaction = new AutocompleteInteraction(self, body, __reply);
const interaction = new AutocompleteInteraction(self, body, optionsResolver, __reply);
const command = optionsResolver.getAutocomplete();
// idc, is a YOU problem

View File

@ -9,7 +9,7 @@ import {
} from './client/base';
import type { ClientNameEvents, EventContext } from './events';
import { isCloudfareWorker } from './common';
export { Logger, PermissionStrings } from './common';
export { Logger, PermissionStrings, Watcher } from './common';
//
export { Collection, LimitedCollection } from './collection';
//

View File

@ -216,7 +216,7 @@ export class BaseInteraction<
static from(client: UsingClient, gateway: GatewayInteractionCreateDispatchData, __reply?: __InternalReplyFunction) {
switch (gateway.type) {
case InteractionType.ApplicationCommandAutocomplete:
return new AutocompleteInteraction(client, gateway, __reply);
return new AutocompleteInteraction(client, gateway, undefined, __reply);
// biome-ignore lint/suspicious/noFallthroughSwitchClause: bad interaction between biome and ts-server
case InteractionType.ApplicationCommand:
switch (gateway.data.type) {
@ -299,16 +299,19 @@ export class AutocompleteInteraction<FromGuild extends boolean = boolean> extend
constructor(
client: UsingClient,
interaction: APIApplicationCommandAutocompleteInteraction,
resolver?: OptionResolver,
protected __reply?: __InternalReplyFunction,
) {
super(client, interaction);
this.options = new OptionResolver(
client,
interaction.data.options,
undefined,
interaction.guild_id,
interaction.data.resolved as ContextOptionsResolved,
);
this.options =
resolver ??
new OptionResolver(
client,
interaction.data.options,
undefined,
interaction.guild_id,
interaction.data.resolved as ContextOptionsResolved,
);
}
getInput() {