2020-03-26 04:31:32 +00:00
|
|
|
const API = require('nekos.life');
|
|
|
|
const {sfw} = new API();
|
|
|
|
exports.run = async (client, message, args) => {
|
|
|
|
if(!args[0]) {
|
2020-03-26 14:09:53 +00:00
|
|
|
return message.channel.send(`<:error:466995152976871434> You didn't say who you wanted to slap! Usage: \`${client.commands.get(`slap`).help.usage}\``)
|
2020-03-26 04:31:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
var people = "";
|
|
|
|
|
|
|
|
for (var i = 0; i < args.length; i++) {
|
|
|
|
var user = client.getUserFromMention(args[i])
|
|
|
|
if (user) {
|
|
|
|
user = message.guild.members.cache.get(user.id).displayName;
|
|
|
|
} else {
|
|
|
|
users = client.searchForMembers(message.guild, args[i]);
|
|
|
|
if (users.length > 1)
|
|
|
|
return message.channel.send(
|
|
|
|
"<:error:466995152976871434> Found multiple users for `" + args[i] + "`, Please be more specific or mention the user instead."
|
|
|
|
);
|
|
|
|
else if (users.length == 0)
|
|
|
|
return message.channel.send(
|
|
|
|
"<:error:466995152976871434> That user doesn't seem to exist. Try again!"
|
|
|
|
);
|
|
|
|
user = users[0].displayName;
|
|
|
|
};
|
|
|
|
if(i+1 == args.length && args.length > 1) {
|
|
|
|
people += `**and** ${user}!`
|
|
|
|
} else if(args.length < 2) {
|
|
|
|
people += `${user}!`;
|
|
|
|
} else if(args.length == 2 && i == 0) {
|
|
|
|
people += `${user} `;
|
|
|
|
} else {
|
|
|
|
people += `${user}, `;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message.channel.startTyping();
|
|
|
|
try {
|
|
|
|
sfw.slap().then((json) => {
|
|
|
|
embed = new Discord.MessageEmbed();
|
|
|
|
embed.setImage(json.url)
|
|
|
|
embed.setColor(client.embedColour(message));
|
|
|
|
embed.setDescription(`**${message.guild.members.cache.get(message.author.id).displayName}** slapped **${people}**`)
|
|
|
|
message.channel.send(embed)
|
|
|
|
message.channel.stopTyping();
|
|
|
|
});
|
|
|
|
} catch (err) {
|
|
|
|
client.logger.error("slap.js: " + err);
|
|
|
|
message.channel.send(`<:error:466995152976871434> An error has occurred: ${err}`)
|
|
|
|
message.channel.stopTyping();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.conf = {
|
|
|
|
enabled: true,
|
|
|
|
guildOnly: true,
|
|
|
|
aliases: [],
|
|
|
|
permLevel: "User",
|
|
|
|
requiredPerms: ["EMBED_LINKS"]
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.help = {
|
|
|
|
name: "slap",
|
|
|
|
category: "Action",
|
|
|
|
description: "Slap someone >:3",
|
|
|
|
usage: "slap [@user/user] (you can slap as many people as you want!)"
|
|
|
|
};
|