Files
xiao/commands/edit-number/tax.js
T
Dragon Fire 3a0606eff0 Fix lint
2020-04-19 16:27:51 -04:00

33 lines
723 B
JavaScript

const Command = require('../../structures/Command');
const { formatNumber } = require('../../util/Util');
module.exports = class TaxCommand extends Command {
constructor(client) {
super(client, {
name: 'tax',
group: 'edit-number',
memberName: 'tax',
description: 'Determines the total cost of something plus tax.',
args: [
{
key: 'rate',
prompt: 'What is the tax rate (in %)?',
type: 'integer',
max: 100,
min: 0
},
{
key: 'amount',
prompt: 'How much money should be converted?',
type: 'float'
}
]
});
}
run(msg, { rate, amount }) {
const result = amount + ((rate / 100) * amount);
return msg.reply(`$${formatNumber(result, 2)}`);
}
};