Error:
const collector = message.createReactionCollector({ filter, time: 15000 });
^
TypeError: message.createReactionCollector is not a function
Code:
module.exports = {
name: 'rules',
description: 'Server Rules',
permission: "ADMINISTRATOR",
/**
*
* @param {MessageReaction} message
*/
execute(message) {
const rulemebed = new MessageEmbed()
.setColor('#ffc7fe')
.setTitle('Server Rules')
.setDescription('Please click the check mark ✅ to verfiy that you read the rules and gain access to other channels')
.setFooter('Abusing loop holes will result in fair punishment ')
.addFields(
{name: '#1', value:'...',},
);
message.channel.send({ embeds: [rulemebed] }).then((sentMessage) => {
sentMessage.react("✅");
});
const filter = (reaction, user) => {
return reaction.emoji.name === '✅' && user.id === message.author.id;
};
const collector = message.createReactionCollector({ filter, time: 15000 });
collector.on('collect', async(reaction, user) => {
const role = await message.guild.roles.fetch("916861450281156678");
message.guild.members.fetch(user.id).then(member => {
member.roles.add(role);
member.roles.remove("916929706182459392");
});
});
}
}
The code works just fine until I added the reaction collector starting at line 25 The goal is to make it when someone clicks the emoji “✅” they will be givin a role. I’m using discord.js v13 and node.js v16.13.0