Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module.exports = {
- name: 'reactionrole',
- description: "Sets up a reaction role message!",
- async execute(message, args, Discord, client) {
- const channel = 'verify';
- const yellowTeamRole = message.guild.roles.cache.find(role => role.name === "Verified");
- const blueTeamRole = message.guild.roles.cache.find(role => role.name === "UnVerified");
- const yellowTeamEmoji = ':white_check_mark:';
- const blueTeamEmoji = ':x:';
- let embed = new Discord.MessageEmbed()
- .setColor('#e42643')
- .setTitle('Do you accept the rules?')
- .setDescription('Choose if you do.\n\n'
- + `${yellowTeamEmoji} if you do accept.\n`
- + `${blueTeamEmoji} if you do not accept`);
- let messageEmbed = await message.channel.send(embed);
- messageEmbed.react(yellowTeamEmoji);
- messageEmbed.react(blueTeamEmoji);
- client.on('messageReactionAdd', async (reaction, user) => {
- if (reaction.message.partial) await reaction.message.fetch();
- if (reaction.partial) await reaction.fetch();
- if (user.bot) return;
- if (!reaction.message.guild) return;
- if (reaction.message.channel.id == channel) {
- if (reaction.emoji.name === yellowTeamEmoji) {
- await reaction.message.guild.members.cache.get(user.id).roles.add(yellowTeamRole);
- }
- if (reaction.emoji.name === blueTeamEmoji) {
- await reaction.message.guild.members.cache.get(user.id).roles.add(blueTeamRole);
- }
- } else {
- return;
- }
- });
- client.on('messageReactionRemove', async (reaction, user) => {
- if (reaction.message.partial) await reaction.message.fetch();
- if (reaction.partial) await reaction.fetch();
- if (user.bot) return;
- if (!reaction.message.guild) return;
- if (reaction.message.channel.id == channel) {
- if (reaction.emoji.name === yellowTeamEmoji) {
- await reaction.message.guild.members.cache.get(user.id).roles.remove(yellowTeamRole);
- }
- if (reaction.emoji.name === blueTeamEmoji) {
- await reaction.message.guild.members.cache.get(user.id).roles.remove(blueTeamRole);
- }
- } else {
- return;
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment