Files
xiao/commands/analyze/ship.js
T
2018-11-03 18:21:19 +00:00

39 lines
1.1 KiB
JavaScript

const Command = require('../../structures/Command');
const Random = require('random-js');
module.exports = class ShipCommand extends Command {
constructor(client) {
super(client, {
name: 'ship',
group: 'analyze',
memberName: 'ship',
description: 'Ships two users together.',
args: [
{
key: 'first',
label: 'first user',
prompt: 'Who is the first user in the ship?',
type: 'user'
},
{
key: 'second',
label: 'second user',
prompt: 'Who is the second user in the ship?',
type: 'user',
default: msg => msg.author
}
]
});
}
run(msg, { first, second }) {
if (first.id === second.id) return msg.reply('Shipping someone with themselves would be pretty weird.');
const botText = first.id === this.client.user.id || second.id === this.client.user.id
? '\nBut you\'re still rejected. Sorry.'
: '';
const random = new Random(Random.engines.mt19937().seed(Math.abs(first.id - second.id)));
const level = random.integer(0, 100);
return msg.say(`${first.username} and ${second.username} have a compatability of... **${level}%**!${botText}`);
}
};