Beep beep

This commit is contained in:
Daniel Odendahl Jr
2017-10-08 18:59:52 +00:00
parent 3ed9f7a423
commit 6a9d24cf87
18 changed files with 150 additions and 116 deletions
-29
View File
@@ -1,29 +0,0 @@
const { Command } = require('discord.js-commando');
const math = require('mathjs');
module.exports = class MathCommand extends Command {
constructor(client) {
super(client, {
name: 'math',
aliases: ['calculator', 'calculate', 'calc'],
group: 'num-edit',
memberName: 'math',
description: 'Calculates math expressions.',
args: [
{
key: 'expression',
prompt: 'What expression would you like to calculate?',
type: 'string'
}
]
});
}
run(msg, { expression }) {
try {
return msg.say(math.eval(expression).toString()).catch(() => msg.say('Invalid expression.'));
} catch (err) {
return msg.say('Invalid expression.');
}
}
};