diff --git a/README.md b/README.md index 4b58710a..ca48b52d 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Xiao is a Discord bot coded in JavaScript with The bot is no longer available for invite. You can self-host the bot, or use her on the [home server](https://discord.gg/sbMe32W). -## Commands (316) +## Commands (317) ### Utility: * **eval:** Executes JavaScript code. @@ -343,7 +343,8 @@ on the [home server](https://discord.gg/sbMe32W). * **character-count:** Responds with the character count of text. * **currency:** Converts currency from one currency to another. -* **final-grade-calculator:** Determines the grade you need to make on your final to get your desired course grade. +* **grade:** Determines your grade on an assignment on an 100-point scale. +* **final-grade:** Determines the grade you need to make on your final to get your desired course grade. * **gravity:** Determines weight on another planet. * **math:** Evaluates a math expression. * **prime:** Determines if a number is a prime number. diff --git a/commands/number-edit/final-grade-calculator.js b/commands/number-edit/final-grade.js similarity index 89% rename from commands/number-edit/final-grade-calculator.js rename to commands/number-edit/final-grade.js index c1206616..490866ba 100644 --- a/commands/number-edit/final-grade-calculator.js +++ b/commands/number-edit/final-grade.js @@ -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: [ { diff --git a/commands/number-edit/grade.js b/commands/number-edit/grade.js new file mode 100644 index 00000000..465aa718 --- /dev/null +++ b/commands/number-edit/grade.js @@ -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...'}`); + } +}; diff --git a/package.json b/package.json index 4d02ff49..bc5ba3c5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "91.10.4", + "version": "91.11.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {