mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
34 lines
1.0 KiB
JavaScript
34 lines
1.0 KiB
JavaScript
const Command = require('../../framework/Command');
|
|
const { MersenneTwister19937, integer } = require('random-js');
|
|
|
|
module.exports = class IQCommand extends Command {
|
|
constructor(client) {
|
|
super(client, {
|
|
name: 'iq',
|
|
aliases: ['intelligence-quotient'],
|
|
group: 'random-seed',
|
|
memberName: 'iq',
|
|
description: 'Determines a user\'s IQ.',
|
|
args: [
|
|
{
|
|
key: 'user',
|
|
type: 'user',
|
|
default: msg => msg.author
|
|
}
|
|
]
|
|
});
|
|
}
|
|
|
|
run(msg, { user }) {
|
|
const authorUser = user.id === msg.author.id;
|
|
if (user.id === this.client.user.id) return msg.reply('Me? My IQ score is off the charts!');
|
|
if (this.client.isOwner(user)) {
|
|
if (authorUser) return msg.reply('Only someone of the highest IQ could make a bot as amazing as me! ❤');
|
|
return msg.reply(`${user.username}, as in my owner? Yeah... Not the sharpest tool in the shed.`);
|
|
}
|
|
const random = MersenneTwister19937.seed(user.id);
|
|
const score = integer(20, 170)(random);
|
|
return msg.reply(`${authorUser ? 'Your' : `${user.username}'s`} IQ score is ${score}.`);
|
|
}
|
|
};
|