Files
dd-multitool/bot/commands/bonus.js
koneko 3bfd995e3a
All checks were successful
Deploy bot / build-and-deploy (push) Successful in 24s
kursadzija
2025-08-27 16:53:17 +02:00

41 lines
1.2 KiB
JavaScript

exports.name = "bonus";
exports.description =
":star: Sums and calculates bonus for player stat numbers.";
exports.usage =
"CLIENT_PREFIX:bonus <number> <number> [inf optional extra numbers]";
exports.example = "CLIENT_PREFIX:bonus 100 100";
exports.hidden = false;
exports.isAlias = false;
exports.run = (client, message, args) => {
let is1nan = false;
if (!args[0])
return message.channel.send(
"Not enough arguments, consult CLIENT_PREFIX:help.".replaceAll(
"CLIENT_PREFIX:",
client.prefix
)
);
args.forEach((arg) => {
if (isNaN(parseInt(arg))) {
is1nan = true;
}
arg = parseInt(arg);
});
if (is1nan)
return message.channel.send(
"You have provided invalid arguments to this command, please consult CLIENT_PREFIX:help.".replaceAll(
"CLIENT_PREFIX:",
client.prefix
)
);
let sum = 0;
args.forEach((arg) => {
if (arg > 2000) arg = 2000; // just dont bother for anything higher than 2000
sum += parseInt(arg);
});
sum--;
message.channel.send(
`Will reach ${sum}, ${Math.ceil(sum * 1.4)} with bonus.`
);
};