Files
xiao/commands/number-edit/grade.js
T
Daniel Odendahl Jr 72485ecc27 Grade Command
2018-09-24 15:00:05 +00:00

35 lines
854 B
JavaScript

const Command = require('../../structures/Command');
module.exports = class GradeCommand extends Command {
constructor(client) {
super(client, {
name: 'grade',
aliases: ['grade-calculator', 'grade-calc'],
group: 'number-edit',
memberName: 'grade',
description: 'Determines your grade on an assignment on an 100-point scale.',
args: [
{
key: 'earned',
label: 'points earned',
prompt: 'How many points did you get?',
type: 'integer',
min: 0
},
{
key: 'total',
label: 'total points',
prompt: 'How many points are available to recieve?',
type: 'integer',
min: 0
}
]
});
}
run(msg, { earned, total }) {
const score = Math.round((earned / total) * 100);
return msg.reply(`Your score is a **${score}%**${score >= 70 ? '! Nice job!' : '... Too bad...'}`);
}
};