Files
lilyissillyyy 46e7a9e244 Use globalName
2025-09-18 16:11:31 -04:00

39 lines
1.3 KiB
JavaScript

const Command = require('../../framework/Command');
const { MersenneTwister19937, integer } = require('random-js');
const { formatNumber } = require('../../util/Util');
const { LOVER_USER_ID } = process.env;
module.exports = class WorthCommand extends Command {
constructor(client) {
super(client, {
name: 'worth',
aliases: ['self-worth'],
group: 'random-seed',
description: 'Determines how much a user is worth.',
args: [
{
key: 'user',
type: 'user',
default: msg => msg.author
}
]
});
}
run(msg, { user }) {
const authorUser = user.id === msg.author.id;
const displayName = user.globalName || user.username;
if (user.id === this.client.user.id) return msg.reply('Me? I\'m worth $5/month. At least that\'s how much I cost.');
if (this.client.isOwner(user)) {
if (authorUser) return msg.reply('Infinity, you amazing owner! ❤');
return msg.reply(`${displayName}, as in my owner? Worthless. Absolutely worthless.`);
}
if (user.id === LOVER_USER_ID) {
return msg.reply(`${displayName} is worth more than anyone else on this Earth! ❤`);
}
const random = MersenneTwister19937.seed(user.id);
const worth = integer(0, 1000000)(random);
return msg.reply(`${authorUser ? 'You are' : `${displayName} is`} worth $${formatNumber(worth)}.`);
}
};