How do I use autocompleteRun on subcommands?

^ As the title says. I can't seem to figure out how subcommands can have autocompleteRun implemented. I'm not too worried about duplicates, since there is only one subcommand that uses autocomplete.
Solution:
Doesn't matter. You still just do ```ts public override autocompleteRun(interaction: AutocompleteInteraction) { const subcommand = interaction.options.getSubcommand(); if (subcommand.name === 'the subcommand with autocomplete') {...
T
thad404d ago
Yeah, but that's for an InteractionHandler, right? Is it possible to use autocompleteRun in a subcommand class without creating a separate InteractionHandler in a different file?
Solution
F
Favna404d ago
Doesn't matter. You still just do
public override autocompleteRun(interaction: AutocompleteInteraction) {
const subcommand = interaction.options.getSubcommand();
if (subcommand.name === 'the subcommand with autocomplete') {
if (interaction.options.getFocused() === 'the option with subcommand') {
// do stuff for the specific option
}
}
}
public override autocompleteRun(interaction: AutocompleteInteraction) {
const subcommand = interaction.options.getSubcommand();
if (subcommand.name === 'the subcommand with autocomplete') {
if (interaction.options.getFocused() === 'the option with subcommand') {
// do stuff for the specific option
}
}
}
T
thad404d ago
Ah, ok, that works - thanks
Want results from more Discord servers?
Add your server
More Posts
Message editing fails even though message can be fetchedWhenever I want to edit an ephemeral message I get the following error: ```js [ERROR] Encountered erProblem with ephemeral messagesI currently have a command which sends a button, problem is, once the button is pressed, I can't remIs recommend have split autocomplete handlersI want know is recommend have split handler such as characterAutocomplete & itemsAutocomplete.Error serverHow can I solve this error ? ``` Error [ERR_SERVER_ALREADY_LISTEN]: Listen method has been called mQuick question regarding application descriptionsHow does one link an application command in the description of an app? Looks like a mention syntax, What typescript version to use?Since the most recent announcement in #Announcements recommends that I should not use typescript verHow to get subcommand name from interaction object?I ~~am~~ will be having multiple commands which have their own sub commands (3 sub command per parenHow do I listen for reactions on all messages in a channel?doing discord bot dev after a long time. i wanted to listen for message reactions on every message iMessageCreate Event isn't workingThis is the first listener Im creating I've read the documentation 50 times imo and checked out the How big is the difference between xyz.cache.get() and await xzy.fetch()?fetch returns the cached thing aswell if it exists, so except the Promise difference i see not reallNOT WORK SAPPHIREwhy not work bot commands?Throwing on unhandled interactionHey, I just wanted to quickly check this idea - If I assign a listener to interaction create and theReply During CooldownCan I make the bot reply with the remaining time of cooldown delay ?messageUpdate event not Triggering```ts import { Listener } from '@sapphire/framework'; import type { Message } from 'discord.js'; exp'"discord.js"' has no exported member named 'WebhookEditMessageOptions'. Did you mean 'WebhookFetchMError: '"discord.js"' has no exported member named 'WebhookEditMessageOptions'. Did you mean 'WebhooMonoreposDoes Sapphire work and play nice with monorepos?