backport new ship command

This commit is contained in:
Emily 2020-04-30 14:11:02 +10:00
parent 0b8c4ec38d
commit 42df6b71c7

View file

@ -1,40 +1,54 @@
const Discord = require('discord.js')
exports.run = async (client, message, args) => { exports.run = async (client, message, args) => {
var rating = Math.floor(Math.random() * 100) + 1
var name, name1; var meter = ['▬', '▬', '▬', '▬', '▬', '▬', '▬', '▬', '▬']
var rating = Math.floor(Math.random() * 100) + 1;
var hearts = [ var hearts = [
"❤️", '❤️',
"🧡", '🧡',
"💛", '💛',
"💚", '💚',
"💙", '💙',
"💜" '💜'
]; ]
if(args.length < 2) { if (!args[0]) {
return message.channel.send(`<:error:466995152976871434> Please include two names/users.`) return message.channel.send(client.userError(exports, 'Missing argument, the `name1` argument is required!'))
} }
if(message.guild && message.mentions.members && message.mentions.members.size > 0) { if (!args[1]) {
name = message.mentions.members.first().displayName; return message.channel.send(client.userError(exports, 'Missing argument, the `name2` argument is required!'))
}; }
if(message.guild && message.mentions.members && message.mentions.members.size > 1) { const firstName = args[0]
name1 = message.mentions.members.last().displayName; const secondName = args[1]
};
if(!name) { const shipName = firstName.substr(0, firstName.length * 0.5) + secondName.substr(secondName.length * 0.5)
name = args[0];
};
if(!name1) { if (shipName.toLowerCase() === 'teily' || shipName.toLowerCase() === 'emrra') {
name1 = args[1]; rating = '100'
}; }
shipName = name.substr(0, client.intBetween(1,name.length))+name1.substr(client.intBetween(0,name1.length)); var pos = 0
var under = 9
while (pos < 10) {
if (rating < under) {
meter.splice(pos, 0, hearts.random())
break
}
pos++
under += 10
}
message.channel.send(`__**Ship Generator:**__\n${hearts.random()} Ship Name: \`${shipName}\`\n${hearts.random()} Compatibility rating: \`${rating}%\``) if (rating >= 99) {
}; meter.splice(9, 0, hearts.random())
}
const embed = new Discord.MessageEmbed()
embed.setTitle(`Original Names: ${firstName}, ${secondName}`)
embed.setColor(client.embedColour(message.guild))
embed.setDescription(`Ship Name: **${shipName}**\nCompatibility: **${rating}%**\n**[**${meter.join('')}**]**`)
message.channel.send(embed)
}
exports.conf = { exports.conf = {
enabled: true, enabled: true,
@ -48,6 +62,6 @@ exports.help = {
name: "ship", name: "ship",
category: "Fun", category: "Fun",
description: "Ship two people together <3", description: "Ship two people together <3",
usage: "ship [name/user] [name/user]" usage: "ship [name1] [name2]"
}; };