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) => {
var name, name1;
var rating = Math.floor(Math.random() * 100) + 1;
var rating = Math.floor(Math.random() * 100) + 1
var meter = ['▬', '▬', '▬', '▬', '▬', '▬', '▬', '▬', '▬']
var hearts = [
"❤️",
"🧡",
"💛",
"💚",
"💙",
"💜"
];
'❤️',
'🧡',
'💛',
'💚',
'💙',
'💜'
]
if(args.length < 2) {
return message.channel.send(`<:error:466995152976871434> Please include two names/users.`)
if (!args[0]) {
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) {
name = message.mentions.members.first().displayName;
};
if (!args[1]) {
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) {
name1 = message.mentions.members.last().displayName;
};
const firstName = args[0]
const secondName = args[1]
if(!name) {
name = args[0];
};
const shipName = firstName.substr(0, firstName.length * 0.5) + secondName.substr(secondName.length * 0.5)
if(!name1) {
name1 = args[1];
};
if (shipName.toLowerCase() === 'teily' || shipName.toLowerCase() === 'emrra') {
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 = {
enabled: true,
@ -48,6 +62,6 @@ exports.help = {
name: "ship",
category: "Fun",
description: "Ship two people together <3",
usage: "ship [name/user] [name/user]"
usage: "ship [name1] [name2]"
};