createMessageComponentCollector allow only opponent [email protected]


i’m try so hard for createMessageComponentCollector(MessageButton), But I don’t know what code would allow the opponent to be able to press it alone.

someone know, please help me!

Here my code:

        const filter = m => m.customId === 'accept' || 'decline' && m.author.id === member.id
        const collector = interaction.channel.createMessageComponentCollector({ filter: filter, max: 1, time: 30000 });

        collector.on('collect', async (m) => {
            if (m.customId === 'accept') {
                await m.deferUpdate();
                return await m.editReply({ content: `ACCEPT!`, embeds: [], components: [] });
            } else if (m.customId === 'decline') {
                await m.deferUpdate();
                return await m.editReply({ content: `DECLINE!`, embeds: [], components: [] });
            }
        });

Source: JavaSript – Stack Overflow

November 28, 2021
Category : News
Tags: discord.js | javascript

Leave a Reply

Your email address will not be published. Required fields are marked *

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.