'Await component doesn't send OK
I would like to do a await message and list for my setWelcome but it does not send me Ok when I select in the Select menu and I do not know if it is good for the after
const embed = new MessageEmbed()
.setColor("#0099ff")
.setTitle("Configuration du message de bienvenue")
.setDescription("Veuillez choisir le type de bienvenue !")
const row = new MessageActionRow()
.addComponents(
new MessageSelectMenu()
.setCustomId('type')
.setPlaceholder('Choisir le type de bienvenue')
.addOptions([
{
label: 'image',
description: 'Le type de bienvenue sera une image',
value: 'image',
emoji: '🖼️'
},
{
label: 'message',
description: 'Le type de bienvenue sera un message',
value: 'message',
emoji: '📝'
},
]),
);
const message = await interaction.reply({ embeds: [embed], components: [row] })
const filter = i => {
return i.user.id === interaction.user.id;
};
interaction.channel.awaitMessageComponent({ filter, componentType: 'SELECT_MENU', time: 30000 })
.then(interaction => interaction.deferReply("Ok"))
.catch(err => console.log(`No interactions were collected.` + err));
}
}
Solution 1:[1]
You're using .deferReply() to reply a content, while .deferReply() has only 2 options: ephemeral and fetchReply.
interaction.channel.awaitMessageComponent({
filter,
componentType: 'SELECT_MENU',
time: 30000
})
.then((i) => i.reply({ content: 'ok' }))
.catch((e) => console.log(e));
.deferReply()sends a "Bot is thinking" message, which increases the application command's reply time from 3 seconds to 15 minutes.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Darshan B |
