interaction collector discord.js collects all interactions that are executed after the collector declaration

Meaning: there is some content and a button in the response to the slash command. The task of the button is to delete the message. What we managed to do was to force the button to delete the message, but the problem is that not only the message in which the button is deleted, but also other messages.

const {
} = require('discord.js')
const {
} = require('@discordjs/builders')
const Color = 'RANDOM'
module.exports = {
    name: 'Name',
    data: new SlashCommandBuilder()
      .addStringOption(option => option.setName('choice')
        .addChoice('choice1', 'choice1')
        .addChoice('choice2', 'choice2')
        .addChoice('choice3', 'choice3') 
    async run(interaction) {
          const Embed = new MessageEmbed()
          const Btns = new MessageActionRow()
            .addComponents(new MessageButton()
              .setLabel('Удалить сообщение (Только автор или администратор)'))
            embeds: [Embed],
            components: [Btns]
          try {
            const collector ={
              time: 60000
            collector.on('collect', async i => {
          } catch (error) {


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Ok first of all, you should always add a filter to your component collector.
(How many items to collect, check if correct users used your component, …)

You should also have a real custom ID (like an UUID or something like that) because if there’s multiple calls of your command in the same channel then, your custom ID wouldn’t be custom anymore and could be collected by every collector running in the channel.

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x