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.guild_id,
body.data.resolved as ContextOptionsResolved, body.data.resolved as ContextOptionsResolved,
); );
const interaction = new AutocompleteInteraction(self, body, __reply); const interaction = new AutocompleteInteraction(self, body, optionsResolver, __reply);
const command = optionsResolver.getAutocomplete(); const command = optionsResolver.getAutocomplete();
// idc, is a YOU problem // idc, is a YOU problem

View File

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

View File

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