Celestial object, list of unit types in help

This commit is contained in:
Dragon Fire
2020-11-24 17:08:49 -05:00
parent 2075ec2b91
commit 103a66b2e0
3 changed files with 9 additions and 3 deletions
+6 -1
View File
@@ -1,5 +1,6 @@
const Command = require('../../structures/Command');
const math = require('mathjs');
const { stripIndents } = require('common-tags');
const { formatNumber } = require('../../util/Util');
module.exports = class UnitsCommand extends Command {
@@ -10,6 +11,7 @@ module.exports = class UnitsCommand extends Command {
group: 'edit-number',
memberName: 'units',
description: 'Converts units to/from other units.',
details: '**Units:** <https://mathjs.org/docs/datatypes/units.html#reference>',
credit: [
{
name: 'mathjs',
@@ -44,7 +46,10 @@ module.exports = class UnitsCommand extends Command {
const value = math.unit(amount, base).toNumber(target);
return msg.say(`${formatNumber(amount)} ${base} is ${formatNumber(value)} ${target}.`);
} catch {
return msg.say('Either an invalid unit type was provided or the unit types do not match.');
return msg.say(stripIndents`
Either an invalid unit type was provided or the unit types do not match.
For a list of units, see <https://mathjs.org/docs/datatypes/units.html#reference>.
`);
}
}
};