mirror of
https://github.com/xHyroM/bun-discord-bot.git
synced 2024-11-10 01:08:07 +01:00
fix: some type issues in handleAutocomplete
This commit is contained in:
parent
0c5f2d21c1
commit
7e6f7b12ae
1 changed files with 5 additions and 4 deletions
|
@ -1,9 +1,9 @@
|
|||
import { Events, Interaction, ChatInputCommandInteraction, AutocompleteInteraction } from "discord.js";
|
||||
import { Events, Interaction, ChatInputCommandInteraction, AutocompleteInteraction, APIApplicationCommandSubcommandOption, APIApplicationCommandSubcommandGroupOption } from "discord.js";
|
||||
import { COMMANDS } from "../loaders/commands.ts";
|
||||
import { defineListener } from "../loaders/listeners.ts";
|
||||
import { InteractionCommandContext } from "../structs/context/CommandContext.ts";
|
||||
import { AutocompleteContext } from "../structs/context/AutocompleteContext.ts";
|
||||
import { StringOption } from "../structs/Command.ts";
|
||||
import { Option, StringOption } from "../structs/Command.ts";
|
||||
|
||||
defineListener({
|
||||
event: Events.InteractionCreate,
|
||||
|
@ -42,10 +42,11 @@ async function handleAutocomplete(interaction: AutocompleteInteraction) {
|
|||
let options = command.options;
|
||||
|
||||
if (interaction.options.getSubcommandGroup(false))
|
||||
options = options.find(o => o.name === interaction.options.getSubcommandGroup())?.options;
|
||||
options = (options.find(o => o.name === interaction.options.getSubcommandGroup()) as APIApplicationCommandSubcommandGroupOption)?.options as Option[];
|
||||
|
||||
if (interaction.options.getSubcommand(false))
|
||||
options = options.find(o => o.name === interaction.options.getSubcommand())?.options;
|
||||
options = (options.find(o => o.name === interaction.options.getSubcommand()) as APIApplicationCommandSubcommandOption)?.options as Option[];
|
||||
|
||||
|
||||
const focused = interaction.options.getFocused(true);
|
||||
const option = options.find(o => o.name === focused.name) as StringOption;
|
||||
|
|
Loading…
Reference in a new issue