Browse Source

Use embed for role verification

master
Abheek Dhawan 4 years ago
parent
commit
f6e59d290e
  1. 18
      index.js

18
index.js

@ -302,14 +302,20 @@ async function roleRequest(message) {
return; return;
} }
const verificationMessage = message.channel.send(`<@${message.author.id}> would like the **${role}** role. Are they worthy?`) const verificationEmbed = new Discord.MessageEmbed()
.then(verificationMessage => { .setTitle(`\`${message.author.tag}\` would like the **${role}** role. Are they worthy?`)
verificationMessage.react('👍'); .setDescription("React to this message to verify")
verificationMessage.react('👎'); .setThumbnail(member.user.avatarURL())
.setColor("fda172")
.setTimestamp();
message.channel.send(verificationEmbed)
.then(verificationEmbed => {
verificationEmbed.react('👍');
verificationEmbed.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;
}; };
verificationMessage.awaitReactions(filter, { max: 1, time: 600000000, errors: ['time'] }) verificationEmbed.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 === '👍') {
@ -317,7 +323,7 @@ async function roleRequest(message) {
} else { } else {
message.reply("I guess you won't be getting that role!"); message.reply("I guess you won't be getting that role!");
} }
}).catch(verificationMessage => { verificationMessage.edit("TIMEOUT") }); }).catch(verificationEmbed => { verificationEmbed.edit("TIMEOUT") });
}).catch(console.error); }).catch(console.error);
}); });
} }

Loading…
Cancel
Save