Browse Source

Use promise for kick

master
Abheek Dhawan 4 years ago
parent
commit
fb86d7992d
  1. 10
      index.js

10
index.js

@ -192,13 +192,14 @@ async function kick(message) {
.setThumbnail(member.user.avatarURL())
.setColor("fda172")
.setTimestamp();
message.channel.send(verificationEmbed).catch(console.error);
message.react('👍');
message.react('👎');
message.channel.send(verificationEmbed)
.then( verificationEmbed => {
verificationEmbed.react('👍');
verificationEmbed.react('👎');
const filter = (reaction, user) => {
return ['👍', '👎'].includes(reaction.emoji.name) && message.guild.members.cache.get(user.id).hasPermission('ADMINISTRATOR') && !user.bot;
};
message.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })
verificationEmbed.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })
.then(userReaction => {
const reaction = userReaction.first();
if (reaction.emoji.name === '👍') {
@ -207,6 +208,7 @@ async function kick(message) {
message.reply(`phew! ${member}'s safe!`);
}
}).catch(verificationEmbed => { verificationEmbed.edit("TIMEOUT") });
}).catch(console.error);
}
async function helpMessage(message) {

Loading…
Cancel
Save