From f87c2834665f5f836ecbbdb5fd7645d95499f4f5 Mon Sep 17 00:00:00 2001 From: FLGX Date: Thu, 19 Mar 2020 11:50:30 +0100 Subject: [PATCH] a --- src/commands/ship1.js | 70 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 src/commands/ship1.js diff --git a/src/commands/ship1.js b/src/commands/ship1.js new file mode 100644 index 0000000..39d2621 --- /dev/null +++ b/src/commands/ship1.js @@ -0,0 +1,70 @@ +const request = require('request') +exports.run = async (client, message, args) => { + + + //NOT FINISHED + + if(!args[0] || !args[1]) { + return message.channel.send(`<:error:466995152976871434> Please include two users`) + } + message.channel.startTyping(); + + var user = client.getUserFromMention(args[0]) + var user2 = client.getUserFromMention(args[1]) + + if (!user) { + let users; + users = client.searchForMembers(message.guild, args[0]); + if (users.length > 1) + return message.channel.send( + "<:error:466995152976871434> Found multiple users! 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].user; + }; + + if (!user2) { + let users; + users = client.searchForMembers(message.guild, args[1]); + if (users.length > 1) + return message.channel.send( + "<:error:466995152976871434> Found multiple users! 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!" + ); + user2 = users[0].user; + }; + + var first = user.username.slice(0, secondLength - 1) + var second = user2.username.slice(secondLength) + + try { + var attachment = new Discord.MessageAttachment(`https://api.alexflipnote.dev/ship?user=${user.avatarURL({format: "png"})}&user2=${user2.avatarURL({format: "png"})}`) + message.channel.send(`Your ship name is **${first+second}!**`, attachment) + message.channel.stopTyping(); + } catch(err) { + message.channel.send(`<:error:466995152976871434> API error: ${err}`); + message.channel.stopTyping(); + }; +}; + +exports.conf = { + enabled: true, + guildOnly: true, + aliases: [], + permLevel: "User", + requiredPerms: [] +}; + +exports.help = { + name: "ship1", + category: "Fun", + description: "Ship two people together <3", + usage: "ship1 name name2" +}; +