CollectorMessage

Hello, I don't understand why my collector isn't working. If someone could help me that would be great!
10 Replies
d.js toolkit
d.js toolkit8mo 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!
ITcomputing
ITcomputingOP8mo ago
PS : I don't have error in console
Carved
Carved8mo ago
await collector2.on('collect', async i3 => {
console.log("collector2 triggered");
console.log("Received custom ID:", i3.customId);

if (i3.customId === 'activate_logs') {
console.log("Activation button clicked");
await logConfig_model.findOneAndUpdate(
{ guildId: interaction.guild.id },
{ state: "on", logs: [] },
{ upsert: true }
);
await i3.reply({ content: "Activé", ephemeral: true });
} else if (i3.customId === 'desactivate_logs') {
console.log("Deactivation button clicked");

}
});
await collector2.on('collect', async i3 => {
console.log("collector2 triggered");
console.log("Received custom ID:", i3.customId);

if (i3.customId === 'activate_logs') {
console.log("Activation button clicked");
await logConfig_model.findOneAndUpdate(
{ guildId: interaction.guild.id },
{ state: "on", logs: [] },
{ upsert: true }
);
await i3.reply({ content: "Activé", ephemeral: true });
} else if (i3.customId === 'desactivate_logs') {
console.log("Deactivation button clicked");

}
});
try it
ITcomputing
ITcomputingOP8mo ago
No, still no error in the console. I really don't understand
Carved
Carved8mo ago
can u explain what are u coding ?
ITcomputing
ITcomputingOP8mo ago
A command to configure a log system
Carved
Carved8mo ago
hmm for what you need collector explain everything maybe i can help u ! .
ITcomputing
ITcomputingOP8mo ago
Well, Collector 2 has to collect the interaction on the buttons to activate or deactivate the system. But the collector gets nothing
Carved
Carved8mo ago
const filter2 = i2 => (i2.customId === 'activate_logs' || i2.customId === 'desactivate_logs') && i2.isButton() && i2.user.id === user.id;
const filter2 = i2 => (i2.customId === 'activate_logs' || i2.customId === 'desactivate_logs') && i2.isButton() && i2.user.id === user.id;
collector2.on('collect', async i3 => {
console.log("Button interaction collected:", i3.customId);
// Rest of your code
});
collector2.on('collect', async i3 => {
console.log("Button interaction collected:", i3.customId);
// Rest of your code
});
try to add this try them!
ITcomputing
ITcomputingOP8mo ago
No, no response from console.log
Want results from more Discord servers?
Add your server