Browse Source

Fix all role request issues

master
Abheek Dhawan 4 years ago
parent
commit
aa920b65b6
  1. 5
      index.js

5
index.js

@ -35,18 +35,19 @@ async function roleRequest(message) {
message.react('👍'); message.react('👍');
message.react('👎'); message.react('👎');
const filter = (reaction, member) => { const filter = (reaction, member) => {
return ['👍', '👎'].includes(reaction.emoji.name) && message.guild.cache.members.get(user.id).hasPermission('ADMINISTRATOR'); return ['👍', '👎'].includes(reaction.emoji.name) && message.guild.members.cache.get(user.id).hasPermission('ADMINISTRATOR');
}; };
message.awaitReactions(filter, { max: 1, time: 600000000, errors: ['time'] }) message.awaitReactions(filter, { max: 1, time: 600000000, errors: ['time'] })
.then(userReaction => { .then(userReaction => {
const reaction = userReaction.first(); const reaction = userReaction.first();
if (reaction.emoji === '👍') { if (reaction.emoji === '👍') {
message.reply("wow I guess you ARE worthy! ||mods must be real mistaken||");
if (role === 'reader') { if (role === 'reader') {
message.member.roles.add(readerRole).catch(console.error); message.member.roles.add(readerRole).catch(console.error);
} else if (role === 'writer') { } else if (role === 'writer') {
message.member.roles.add(writerRole).catch(console.error); message.member.roles.add(writerRole).catch(console.error);
} else if (role === 'spectator' || role === 'spec') { } else if (role === 'spectator' || role === 'spec') {
message.member.roles.add(writerRole).catch(console.error); message.member.roles.add(specRole).catch(console.error);
} }
} else { } else {
message.reply("I guess you won't be getting that role!"); message.reply("I guess you won't be getting that role!");

Loading…
Cancel
Save