2023-06-25 02:32:56 +00:00
|
|
|
import { AutocompleteInteraction, CacheType } from 'discord.js';
|
2023-07-11 19:54:57 +00:00
|
|
|
import { commands } from '..';
|
2023-06-25 02:32:56 +00:00
|
|
|
|
2023-08-04 18:24:20 +00:00
|
|
|
export default async function handleAutocomplete(
|
2023-06-25 02:32:56 +00:00
|
|
|
interaction: AutocompleteInteraction<CacheType>,
|
|
|
|
|
) {
|
2023-08-04 18:24:20 +00:00
|
|
|
const command = (await commands)[interaction.commandName];
|
2023-06-25 02:32:56 +00:00
|
|
|
|
|
|
|
|
if (!command) {
|
|
|
|
|
console.error(`No command matching ${interaction.commandName} was found.`);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (command.autocomplete) command.autocomplete(interaction);
|
|
|
|
|
}
|