Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module.exports = {
- name: "color_role",
- description: "Setup color role reaction message and reactions",
- async execute(message, args, Discord, client) {
- const channel = "811706365558128721";
- const amberRole = message.guild.roles.cache.find(
- (role) => role.name === "Amber"
- );
- const blueRole = message.guild.roles.cache.find(
- (role) => role.name === "Blue"
- );
- const cyanRole = message.guild.roles.cache.find(
- (role) => role.name === "Cyan"
- );
- const greenRole = message.guild.roles.cache.find(
- (role) => role.name === "Green"
- );
- const pinkRole = message.guild.roles.cache.find(
- (role) => role.name === "Pink"
- );
- const purpleRole = message.guild.roles.cache.find(
- (role) => role.name === "Purple"
- );
- const redRole = message.guild.roles.cache.find(
- (role) => role.name === "Red"
- );
- const deepOrangeRole = message.guild.roles.cache.find(
- (role) => role.name === "DeepOrange"
- );
- const brownRole = message.guild.roles.cache.find(
- (role) => role.name === "Brown"
- );
- const deepPurpleRole = message.guild.roles.cache.find(
- (role) => role.name === "DeepPurple"
- );
- const indigoRole = message.guild.roles.cache.find(
- (role) => role.name === "Indigo"
- );
- const lightBlueRole = message.guild.roles.cache.find(
- (role) => role.name === "LightBlue"
- );
- const tealRole = message.guild.roles.cache.find(
- (role) => role.name === "Teal"
- );
- const lightGreenRole = message.guild.roles.cache.find(
- (role) => role.name === "LightGreen"
- );
- const limeRole = message.guild.roles.cache.find(
- (role) => role.name === "Lime"
- );
- const yellowRole = message.guild.roles.cache.find(
- (role) => role.name === "Yellow"
- );
- const orangeRole = message.guild.roles.cache.find(
- (role) => role.name === "Orange"
- );
- const amberEmoji = "811153480969617469";
- const blueEmoji = "811153495092363315";
- const cyanEmoji = "811153522854199317";
- const greenEmoji = "811153563714846741";
- const pinkEmoji = "811153647089352705";
- const purpleEmoji = "811153657365790750";
- const redEmoji = "811148706610675723";
- const deepOrangeEmoji = "811153537143930920";
- const brownEmoji = "811153510661750824";
- const deepPurpleEmoji = "811153551937765416";
- const indigoEmoji = "811153575102513203";
- const lightBlueEmoji = "811153587404668928";
- const tealEmoji = "811153679822094397";
- const lightGreenEmoji = "811153604982734879";
- const limeEmoji = "811153617158537256";
- const yellowEmoji = "811153690316242964";
- const orangeEmoji = "811153632619397122";
- let embed = new Discord.MessageEmbed()
- .setColor("#e42643")
- .setTitle("Color Role Reaction")
- .setDescription(
- "React to this message with the color emotes below to get a role based on that color. If you want to remove that color role then just click on that same emote again."
- );
- let messageEmbed = await message.channel.send(embed);
- let messageId = embed.id;
- messageEmbed.react(amberEmoji);
- messageEmbed.react(blueEmoji);
- messageEmbed.react(cyanEmoji);
- messageEmbed.react(greenEmoji);
- messageEmbed.react(pinkEmoji);
- messageEmbed.react(purpleEmoji);
- messageEmbed.react(redEmoji);
- messageEmbed.react(deepOrangeEmoji);
- messageEmbed.react(brownEmoji);
- messageEmbed.react(deepPurpleEmoji);
- messageEmbed.react(indigoEmoji);
- messageEmbed.react(lightBlueEmoji);
- messageEmbed.react(tealEmoji);
- messageEmbed.react(lightGreenEmoji);
- messageEmbed.react(limeEmoji);
- messageEmbed.react(yellowEmoji);
- messageEmbed.react(orangeEmoji);
- 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.messsage.id == embed.id) {
- if (reaction.emoji.id === amberEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.add(amberRole);
- }
- if (reaction.emoji.id === blueEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.add(blueRole);
- }
- if (reaction.emoji.id === cyanEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.add(cyanRole);
- }
- if (reaction.emoji.id === greenEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.add(greenRole);
- }
- if (reaction.emoji.id === pinkEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.add(pinkRole);
- }
- if (reaction.emoji.id === purpleEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.add(purpleRole);
- }
- if (reaction.emoji.id === redEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.add(redRole);
- }
- if (reaction.emoji.id === deepOrangeEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.add(deepOrangeRole);
- }
- if (reaction.emoji.id === brownEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.add(brownRole);
- }
- if (reaction.emoji.id === deepPurpleEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.add(deepPurpleRole);
- }
- if (reaction.emoji.id === indigoEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.add(indigoRole);
- }
- if (reaction.emoji.id === lightBlueEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.add(lightBlueRole);
- }
- if (reaction.emoji.id === tealEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.add(tealRole);
- }
- if (reaction.emoji.id === lightGreenEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.add(lightGreenRole);
- }
- if (reaction.emoji.id === limeEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.add(limeRole);
- }
- if (reaction.emoji.id === yellowEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.add(yellowRole);
- }
- if (reaction.emoji.id === orangeEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.add(orangeRole);
- }
- }
- } 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.id === amberEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.remove(amberRole);
- }
- if (reaction.emoji.id === blueEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.remove(blueRole);
- }
- if (reaction.emoji.id === cyanEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.remove(cyanRole);
- }
- if (reaction.emoji.id === greenEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.remove(greenRole);
- }
- if (reaction.emoji.id === pinkEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.remove(pinkRole);
- }
- if (reaction.emoji.id === purpleEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.remove(purpleRole);
- }
- if (reaction.emoji.id === redEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.remove(redRole);
- }
- if (reaction.emoji.id === deepOrangeEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.remove(deepOrangeRole);
- }
- if (reaction.emoji.id === brownEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.remove(brownRole);
- }
- if (reaction.emoji.id === deepPurpleEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.remove(deepPurpleRole);
- }
- if (reaction.emoji.id === indigoEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.remove(indigoRole);
- }
- if (reaction.emoji.id === lightBlueEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.remove(lightBlueRole);
- }
- if (reaction.emoji.id === tealEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.remove(tealRole);
- }
- if (reaction.emoji.id === lightGreenEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.remove(lightGreenRole);
- }
- if (reaction.emoji.id === limeEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.remove(limeRole);
- }
- if (reaction.emoji.id === yellowEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.remove(yellowRole);
- }
- if (reaction.emoji.id === orangeEmoji) {
- await reaction.message.guild.members.cache
- .get(user.id)
- .roles.remove(orangeRole);
- }
- } else {
- return;
- }
- });
- },
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement