awaitMessageComponent not working on server but works locally...
So, I have the following code that has been running for months....
const collectorFilter = i => {
return selectionInteraction.user.id === interaction.user.id;
}
const confirmation = await roleSelectionMessage.awaitMessageComponent({ filter: collectorFilter, time: 60000 });
if (confirmation.customId === 'mySelectMenu') {
// do more stuff here
}
well that await component decided to not work on my linux server it has been running for months, if I run the bot on my machine it responds normally, anyone has any ideas as to what to look?
If anyone is curious am using the 14.8.0 version... could that be the cause?
thanks
9 Replies
- 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!djs v 14.8.0 and node 18.18.0
Your filter doesn't make sense without further context because you're not using the i variable at all in the filter function
Any particular reason you are using an outdated version of the library?
already removed the filter and it doesn't work
honestly no idea what happened but opened and closed vscode and now locally that awaitComponent isn't working in both places on my machine and on the server
and i updated to the latest didscordjs version 14.14.1
and still same error
but doesn't make sense since it was working before
all my selectMenus that have an await compoenent stopped working
Show the full code
try {
// await interaction.deferReply({ ephemeral: true });
const userFlagged = JSON.parse(args[0]);
// const userName = args[1];
//const tokenAddress = interaction.options.getString('token-address');
const selectMenu = new StringSelectMenuBuilder().setCustomId('flag-user-options').setPlaceholder('Select reason');
selectMenu.addOptions({
label: 'Spamming Links',
emoji: { name: '🚩' },
value: 'spamming-links',
}),
selectMenu.addOptions({
label: 'Impersonating Admins',
emoji: { name: '💀' },
value: 'impersonating-admins',
});
const warningEmbed = new EmbedBuilder()
.setTitle('Flag user')
.setColor('Yellow');
warningEmbed.setDescription(
Chose bellow the reason why you want to flag user **${userFlagged.userName}**.
);
const row = new ActionRowBuilder().addComponents(selectMenu);
const flagSelection = await interaction.reply({ embeds: [warningEmbed], components: [row], ephemeral: true });
try {
const confirmation = await flagSelection.awaitMessageComponent({ time: 60000 });
if (confirmation.customId === 'flag-user-options') {
const reason = confirmation.values[0];
const confirmationEmbed = new EmbedBuilder()
formating looks horrible here
but bassicaly that confirmation inside the try catch, never responds, is like it doesn't even register the interactionCodeblocks:
```js
const Discord = require("discord.js");
// further code
```
becomes
Inline Code:
`console.log('inline!');` becomes
console.log('inline!');
add
fetchReply: true
to your reply optionsdude, wtf! This worked!
how? since when?