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: [] });
}
});
I found the code
const filter = m => m.customId === 'accept' || 'decline' && m.member.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: [] });
}
});
const filter = m => m.customId === 'accept' || 'decline' && m.author.id === member.id
m.author.id use for djs@v12,
but for djs@v13 use m.member.id