2020-03-11 10:46:13 +00:00
|
|
|
exports.run = async (client, message, args) => {
|
2020-03-16 01:14:33 +00:00
|
|
|
|
2020-03-22 11:13:41 +00:00
|
|
|
var hearts = [
|
|
|
|
"❤️",
|
|
|
|
"🧡",
|
|
|
|
"💛",
|
|
|
|
"💚",
|
|
|
|
"💙",
|
|
|
|
"💜"
|
|
|
|
];
|
2020-03-16 01:14:33 +00:00
|
|
|
|
|
|
|
if(!args[0] || !args[1]) {
|
2020-03-22 11:13:41 +00:00
|
|
|
return message.channel.send(`<:error:466995152976871434> Please include at least two names.`)
|
2020-03-16 01:14:33 +00:00
|
|
|
}
|
2020-03-11 10:46:13 +00:00
|
|
|
|
2020-03-22 11:13:41 +00:00
|
|
|
let names = [];
|
2020-03-21 09:46:51 +00:00
|
|
|
let totalLength = 0;
|
|
|
|
|
|
|
|
for(let i = 0; i < args.length; i++) {
|
|
|
|
let arg = args[i];
|
2020-03-22 11:13:41 +00:00
|
|
|
let name = client.getUserFromMention(arg).username;
|
|
|
|
if(!name) {
|
|
|
|
name = arg;
|
|
|
|
};
|
|
|
|
names.push(name);
|
|
|
|
totalLength += arg.length;
|
2020-03-21 09:46:51 +00:00
|
|
|
}
|
|
|
|
|
2020-03-22 11:13:41 +00:00
|
|
|
let lengthPerName = Math.floor(totalLength / names.length);
|
2020-03-21 09:46:51 +00:00
|
|
|
|
|
|
|
let finalName = '';
|
|
|
|
|
|
|
|
let last = -1;
|
|
|
|
|
2020-03-22 11:13:41 +00:00
|
|
|
for(let i = 0; i < names.length; i++) {
|
|
|
|
let name = names[i];
|
|
|
|
let l = Math.min(lengthPerName, name.length);
|
2020-03-21 09:46:51 +00:00
|
|
|
|
2020-03-22 11:13:41 +00:00
|
|
|
let p = name.substr(last + 1, last + l);
|
2020-03-21 09:46:51 +00:00
|
|
|
|
|
|
|
console.log(p);
|
|
|
|
|
|
|
|
finalName = finalName + p;
|
2020-03-16 01:14:33 +00:00
|
|
|
|
2020-03-21 09:46:51 +00:00
|
|
|
last = last + l;
|
2020-03-16 01:14:33 +00:00
|
|
|
};
|
2020-03-11 10:46:13 +00:00
|
|
|
|
2020-03-21 09:46:51 +00:00
|
|
|
console.log(totalLength);
|
2020-03-22 11:13:41 +00:00
|
|
|
console.log(names.length);
|
|
|
|
console.log(lengthPerName);
|
2020-03-21 09:46:51 +00:00
|
|
|
console.log(finalName);
|
2020-03-11 10:46:13 +00:00
|
|
|
|
2020-03-22 11:13:41 +00:00
|
|
|
message.channel.send(`**Ship generator:**\n${hearts.random()} Ship name: \`${finalName}\`\n${hearts.random()} Compatibility rating:`)
|
2020-03-11 10:46:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
exports.conf = {
|
|
|
|
enabled: true,
|
2020-03-16 01:14:33 +00:00
|
|
|
guildOnly: true,
|
2020-03-11 10:46:13 +00:00
|
|
|
aliases: [],
|
|
|
|
permLevel: "User",
|
|
|
|
requiredPerms: []
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.help = {
|
|
|
|
name: "ship",
|
|
|
|
category: "Fun",
|
|
|
|
description: "Ship two people together <3",
|
|
|
|
usage: "ship name name2"
|
|
|
|
};
|
|
|
|
|