Autocomplete Command not sending update

Not too sure how to explain it exactly however, I have a command with multiple Autocomplete options, therefore I have added in a "key" option so they can select what specific key they are wanting. /config reset key:string value:AutocompleteString Here is an extract from my code(the portion responsible for AutocompleteInteractions for this specific command):
async ({ interaction, client }) => {
if (!interaction.guild) return;
const focusedValue = interaction.options.getFocused();

const group = interaction.options.getSubcommandGroup(true);
const command = interaction.options.getSubcommand(true);

const guild_config = await getGuildConfig(interaction.guild.id)

if (group == 'reset' && command == 'one') {
const key = interaction.options.getString('key', true);
let _options: string[] = [];

switch (key) {
case 'disabled-buttons': _options = guild_config.disabled_buttons; break;
case 'color': _options = guild_config.custom_colours.map(x => x.name); break;
case 'restricted-channels':
let _chans: string[] = [];
for (const channel of guild_config.restricted_channels) {
try {
const _chan = await client.channels.fetch(channel) as TextChannel;
_chans.push(_chan.name);
} catch (error) { }
}
_options = _chans;
break;
}
async ({ interaction, client }) => {
if (!interaction.guild) return;
const focusedValue = interaction.options.getFocused();

const group = interaction.options.getSubcommandGroup(true);
const command = interaction.options.getSubcommand(true);

const guild_config = await getGuildConfig(interaction.guild.id)

if (group == 'reset' && command == 'one') {
const key = interaction.options.getString('key', true);
let _options: string[] = [];

switch (key) {
case 'disabled-buttons': _options = guild_config.disabled_buttons; break;
case 'color': _options = guild_config.custom_colours.map(x => x.name); break;
case 'restricted-channels':
let _chans: string[] = [];
for (const channel of guild_config.restricted_channels) {
try {
const _chan = await client.channels.fetch(channel) as TextChannel;
_chans.push(_chan.name);
} catch (error) { }
}
_options = _chans;
break;
}
Here is a gif demonstrating what I am meaning: https://i.imgur.com/bu90n92.gif Versions: [email protected] [email protected]
Imgur
3 Replies
d.js toolkit
d.js toolkit16mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
oxi
oxiOP16mo ago
Is there anything I can do to resolve this or is this just a limitation of how Autocomplete Interactions work on discord? And as you can see from the second gif, if I go through it as a new command, it changes the value and works as intended: https://i.imgur.com/Sd672cV.gif
Imgur
oxi
oxiOP16mo ago
Yeah got the same answer in Discord API discord too. That's what I've done, thanks @qjuh !
Want results from more Discord servers?
Add your server