mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-17 08:17:35 +02:00
More uniform group names
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const math = require('mathjs');
|
||||
|
||||
module.exports = class MathCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'math',
|
||||
aliases: ['mathematics', 'solve'],
|
||||
group: 'edit-number',
|
||||
memberName: 'math',
|
||||
description: 'Evaluates a math expression.',
|
||||
credit: [
|
||||
{
|
||||
name: 'mathjs',
|
||||
url: 'https://mathjs.org/',
|
||||
reason: 'Expression Parser'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'expression',
|
||||
prompt: 'What expression do you want to evaluate?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { expression }) {
|
||||
try {
|
||||
const evaluated = math.evaluate(expression).toString();
|
||||
return msg.reply(evaluated).catch(() => msg.reply('Invalid expression.'));
|
||||
} catch {
|
||||
return msg.reply('Invalid expression.');
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user