Grade Command

This commit is contained in:
Daniel Odendahl Jr
2018-09-24 15:00:05 +00:00
parent 37abb0e7a9
commit 72485ecc27
4 changed files with 42 additions and 7 deletions
@@ -1,13 +1,13 @@
const Command = require('../../structures/Command');
const { above100, above92, above88, above80, below80 } = require('../../assets/json/final-grade-calculator');
module.exports = class FinalGradeCalculatorCommand extends Command {
module.exports = class FinalGradeCommand extends Command {
constructor(client) {
super(client, {
name: 'final-grade-calculator',
aliases: ['final-grade', 'roger-hub'],
name: 'final-grade',
aliases: ['final-grade-calculator', 'final-grade-calc', 'roger-hub'],
group: 'number-edit',
memberName: 'final-grade-calculator',
memberName: 'final-grade',
description: 'Determines the grade you need to make on your final to get your desired course grade.',
args: [
{
+34
View File
@@ -0,0 +1,34 @@
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...'}`);
}
};