diff --git a/README.md b/README.md index dccad399..bf1c6568 100644 --- a/README.md +++ b/README.md @@ -1389,7 +1389,6 @@ here. * give-flower ([Original "Rune Factory 4" Game](http://www.runefactory4.com/index1.html)) * xiao ([Images, Original "Rune Factory 4" Game](http://www.runefactory4.com/index1.html)) - [mathjs](https://mathjs.org/) - * math (Expression Parser) * units (Expression Parser) - [Mattel](https://www.mattel.com/en-us) * 8-ball ([Original Concept](https://www.mattelgames.com/games/en-us/kids/magic-8-ball)) diff --git a/commands/edit-number/math.js b/commands/edit-number/math.js index 53fe1dd6..a04ca1d9 100644 --- a/commands/edit-number/math.js +++ b/commands/edit-number/math.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const math = require('mathjs'); +const { Parser } = require('expr-eval'); module.exports = class MathCommand extends Command { constructor(client) { @@ -9,13 +9,6 @@ module.exports = class MathCommand extends Command { group: 'edit-number', memberName: 'math', description: 'Evaluates a math expression.', - credit: [ - { - name: 'mathjs', - url: 'https://mathjs.org/', - reason: 'Expression Parser' - } - ], args: [ { key: 'expression', @@ -27,8 +20,8 @@ module.exports = class MathCommand extends Command { } run(msg, { expression }) { - try { - const evaluated = math.evaluate(expression).toString(); + try { + const evaluated = Parser.evaluate(expression).toString(); return msg.reply(evaluated).catch(() => msg.reply('Invalid expression.')); } catch { return msg.reply('Invalid expression.'); diff --git a/package.json b/package.json index 74f06a69..bc0e7dce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "123.6.1", + "version": "124.0.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": { @@ -45,6 +45,7 @@ "discord.js-commando": "github:discordjs/Commando", "dotenv": "^8.2.0", "eslint": "^7.15.0", + "expr-eval": "^2.0.2", "gifencoder": "^2.0.1", "gm": "^1.23.1", "html-entities": "^1.3.1",