Browse Source

Attempt to fix adding role to bot instead of requester

master
Abheek Dhawan 4 years ago
parent
commit
e8cf61468e
  1. 8
      index.js

8
index.js

@ -303,13 +303,13 @@ async function roleRequest(message) {
} }
const verificationMessage = message.channel.send(`<@${message.author.id}> would like the **${role}** role. Are they worthy?`) const verificationMessage = message.channel.send(`<@${message.author.id}> would like the **${role}** role. Are they worthy?`)
.then(message => { .then(verificationMessage => {
message.react('👍'); verificationMessage.react('👍');
message.react('👎'); verificationMessage.react('👎');
const filter = (reaction, user) => { const filter = (reaction, user) => {
return ['👍', '👎'].includes(reaction.emoji.name) && message.guild.members.cache.get(user.id).hasPermission('ADMINISTRATOR') && !user.bot; return ['👍', '👎'].includes(reaction.emoji.name) && message.guild.members.cache.get(user.id).hasPermission('ADMINISTRATOR') && !user.bot;
}; };
message.awaitReactions(filter, { max: 1, time: 600000000, errors: ['time'] }) verificationMessage.awaitReactions(filter, { max: 1, time: 600000000, errors: ['time'] })
.then(userReaction => { .then(userReaction => {
const reaction = userReaction.first(); const reaction = userReaction.first();
if (reaction.emoji.name === '👍') { if (reaction.emoji.name === '👍') {

Loading…
Cancel
Save