Browse Source

Try different name for awaitReactions animated emoji

master
Abheek Dhawan 4 years ago
parent
commit
1e937808cb
  1. 16
      index.js

16
index.js

@ -310,12 +310,12 @@ async function addRole(message) {
verificationEmbed.react('<a:anim_check:827985495295655988>'); verificationEmbed.react('<a:anim_check:827985495295655988>');
verificationEmbed.react('👎'); verificationEmbed.react('👎');
const filter = (reaction, user) => { const filter = (reaction, user) => {
return ['<a:anim_check:827985495295655988>', '👎'].includes(reaction.emoji.name) && message.guild.members.cache.get(user.id).hasPermission('ADMINISTRATOR') && !user.bot; return ['anim_check', '👎'].includes(reaction.emoji.name) && message.guild.members.cache.get(user.id).hasPermission('ADMINISTRATOR') && !user.bot;
}; };
verificationEmbed.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 === '<a:anim_check:827985495295655988>') { if (reaction.emoji.name === 'anim_check') {
member.roles.add(role).then(message.reply(`${member.user} has been given the **${role}** role!`)).catch(() => { message.reply("It seems I don't have permissions to give that role, as it's likely above me :(") }); member.roles.add(role).then(message.reply(`${member.user} has been given the **${role}** role!`)).catch(() => { message.reply("It seems I don't have permissions to give that role, as it's likely above me :(") });
} else { } else {
message.reply("I guess you won't be getting that role!"); message.reply("I guess you won't be getting that role!");
@ -362,12 +362,12 @@ async function ban(message) {
verificationEmbed.react('<a:anim_check:827985495295655988>'); verificationEmbed.react('<a:anim_check:827985495295655988>');
verificationEmbed.react('👎'); verificationEmbed.react('👎');
const filter = (reaction, user) => { const filter = (reaction, user) => {
return ['<a:anim_check:827985495295655988>', '👎'].includes(reaction.emoji.name) && message.guild.members.cache.get(user.id).hasPermission('ADMINISTRATOR') && !user.bot; return ['anim_check', '👎'].includes(reaction.emoji.name) && message.guild.members.cache.get(user.id).hasPermission('ADMINISTRATOR') && !user.bot;
}; };
verificationEmbed.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] }) verificationEmbed.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })
.then(userReaction => { .then(userReaction => {
const reaction = userReaction.first(); const reaction = userReaction.first();
if (reaction.emoji.name === '<a:anim_check:827985495295655988>') { if (reaction.emoji.name === 'anim_check') {
message.guild.members.ban(member.user).then(user => message.reply(`<@${user.id}> has been banned!`)).catch(() => message.channel.send(`Unfortunately, I don't have the ability to ban ${member.user.username}, likely because their role is higher than mine.`)); message.guild.members.ban(member.user).then(user => message.reply(`<@${user.id}> has been banned!`)).catch(() => message.channel.send(`Unfortunately, I don't have the ability to ban ${member.user.username}, likely because their role is higher than mine.`));
} else { } else {
message.reply(`phew! ${member}'s safe!`); message.reply(`phew! ${member}'s safe!`);
@ -414,12 +414,12 @@ async function kick(message) {
verificationEmbed.react('<a:anim_check:827985495295655988>'); verificationEmbed.react('<a:anim_check:827985495295655988>');
verificationEmbed.react('👎'); verificationEmbed.react('👎');
const filter = (reaction, user) => { const filter = (reaction, user) => {
return ['<a:anim_check:827985495295655988>', '👎'].includes(reaction.emoji.name) && message.guild.members.cache.get(user.id).hasPermission('ADMINISTRATOR') && !user.bot; return ['anim_check', '👎'].includes(reaction.emoji.name) && message.guild.members.cache.get(user.id).hasPermission('ADMINISTRATOR') && !user.bot;
}; };
verificationEmbed.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] }) verificationEmbed.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })
.then(userReaction => { .then(userReaction => {
const reaction = userReaction.first(); const reaction = userReaction.first();
if (reaction.emoji.name === '<a:anim_check:827985495295655988>') { if (reaction.emoji.name === 'anim_check') {
member.kick().then(user => message.reply(`<@${user.id}> has been kicked!`)).catch(() => message.channel.send(`Unfortunately, I don't have the ability to kick ${member.user.username}, likely because their role is higher than mine.`)); member.kick().then(user => message.reply(`<@${user.id}> has been kicked!`)).catch(() => message.channel.send(`Unfortunately, I don't have the ability to kick ${member.user.username}, likely because their role is higher than mine.`));
} else { } else {
message.reply(`phew! ${member}'s safe!`); message.reply(`phew! ${member}'s safe!`);
@ -527,12 +527,12 @@ async function roleRequest(message) {
verificationEmbed.react('<a:anim_check:827985495295655988>'); verificationEmbed.react('<a:anim_check:827985495295655988>');
verificationEmbed.react('👎'); verificationEmbed.react('👎');
const filter = (reaction, user) => { const filter = (reaction, user) => {
return ['<a:anim_check:827985495295655988>', '👎'].includes(reaction.emoji.name) && message.guild.members.cache.get(user.id).hasPermission('ADMINISTRATOR') && !user.bot; return ['anim_check', '👎'].includes(reaction.emoji.name) && message.guild.members.cache.get(user.id).hasPermission('ADMINISTRATOR') && !user.bot;
}; };
verificationEmbed.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 === '<a:anim_check:827985495295655988>') { if (reaction.emoji.name === 'anim_check') {
message.member.roles.add(role).then(message.reply("wow I guess you ARE worthy! ||mods must be real mistaken||")).catch(() => { message.reply("It seems I don't have permissions to give that role, as it's likely above me :(") }); message.member.roles.add(role).then(message.reply("wow I guess you ARE worthy! ||mods must be real mistaken||")).catch(() => { message.reply("It seems I don't have permissions to give that role, as it's likely above me :(") });
} 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