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
+3 -2
View File
@@ -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.
@@ -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...'}`);
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "91.10.4",
"version": "91.11.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {