discord.js icon indicating copy to clipboard operation
discord.js copied to clipboard

can't create message collector on ephemeral response without fetching.

Open imranbarbhuiya opened this issue 3 years ago • 5 comments
trafficstars

Which package is this bug report for?

discord.js

Issue description

InteractionCollector isn't collecting interaction when used along with an ephemeral button interaction reply without fetching. If I fetch the reply or remove ephemeral then it works fine.

Code sample

client.on('interactionCreate', async (interaction) => {
    if (!interaction.isButton()) {
      return;
    }

    const msg = await interaction.reply({
      content: 'test',
      components: [
        new ActionRowBuilder<MessageActionRowComponentBuilder>().addComponents([
          new ButtonBuilder()
            .setCustomId('test')
            .setLabel('test')
            .setStyle(ButtonStyle.Primary),
        ]),
      ],
      ephemeral: true,
    });

    msg
      .createMessageComponentCollector({
        componentType: ComponentType.Button,
      })
      .on('collect', (btn) => {
        console.log(btn.customId);
      });
  });
}

Package version

v14

Node.js version

v16.15.0

Operating system

Windows

Priority this issue should have

Low (slightly annoying)

Which partials do you have configured?

Not applicable (subpackage bug)

Which gateway intents are you subscribing to?

Not applicable (subpackage bug)

I have tested this issue on a development release

68d5169

imranbarbhuiya avatar Jun 02 '22 16:06 imranbarbhuiya

I cannot reproduce. Sample code:

client.on('interactionCreate', async (interaction) => {
    if (!interaction.isChatInputCommand()) {
      return;
    }

    const msg = await interaction.reply({
      content: 'test',
      components: [
        new ActionRowBuilder<MessageActionRowComponentBuilder>().addComponents([
          new ButtonBuilder()
            .setCustomId('test')
            .setLabel('test')
            .setStyle(ButtonStyle.Primary),
        ]),
      ],
      ephemeral: true,
    });

    msg
      .createMessageComponentCollector({
        componentType: ComponentType.Button,
      })
      .on('collect', (btn) => {
        console.log(btn.customId);
      });
  });
}

suneettipirneni avatar Jun 03 '22 02:06 suneettipirneni

@imranbarbhuiya are you still able to reproduce this? Does the sample above work for you?

kyranet avatar Jun 04 '22 21:06 kyranet

We talked on discord I'm able to reproduce it now. The issue is with replying with message components, still looking through to see if this is possible to fix.

suneettipirneni avatar Jun 04 '22 21:06 suneettipirneni

Is this going to be fixed? I have the same issue - can repro

Edit: using autoFetch fixed it, still annoying

migue802 avatar Jan 10 '23 10:01 migue802