mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-21 14:04:38 +02:00
Celestial object, list of unit types in help
This commit is contained in:
@@ -26,7 +26,8 @@ module.exports = class GravityCommand extends Command {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'planet',
|
key: 'planet',
|
||||||
prompt: `What planet do you want to use as the base? Either ${list(Object.keys(planets), 'or')}.`,
|
label: 'celestial object',
|
||||||
|
prompt: `What celestial object do you want to use? Either ${list(Object.keys(planets), 'or')}.`,
|
||||||
type: 'string',
|
type: 'string',
|
||||||
oneOf: Object.keys(planets),
|
oneOf: Object.keys(planets),
|
||||||
parse: planet => planet.toLowerCase()
|
parse: planet => planet.toLowerCase()
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const Command = require('../../structures/Command');
|
const Command = require('../../structures/Command');
|
||||||
const math = require('mathjs');
|
const math = require('mathjs');
|
||||||
|
const { stripIndents } = require('common-tags');
|
||||||
const { formatNumber } = require('../../util/Util');
|
const { formatNumber } = require('../../util/Util');
|
||||||
|
|
||||||
module.exports = class UnitsCommand extends Command {
|
module.exports = class UnitsCommand extends Command {
|
||||||
@@ -10,6 +11,7 @@ module.exports = class UnitsCommand extends Command {
|
|||||||
group: 'edit-number',
|
group: 'edit-number',
|
||||||
memberName: 'units',
|
memberName: 'units',
|
||||||
description: 'Converts units to/from other units.',
|
description: 'Converts units to/from other units.',
|
||||||
|
details: '**Units:** <https://mathjs.org/docs/datatypes/units.html#reference>',
|
||||||
credit: [
|
credit: [
|
||||||
{
|
{
|
||||||
name: 'mathjs',
|
name: 'mathjs',
|
||||||
@@ -44,7 +46,10 @@ module.exports = class UnitsCommand extends Command {
|
|||||||
const value = math.unit(amount, base).toNumber(target);
|
const value = math.unit(amount, base).toNumber(target);
|
||||||
return msg.say(`${formatNumber(amount)} ${base} is ${formatNumber(value)} ${target}.`);
|
return msg.say(`${formatNumber(amount)} ${base} is ${formatNumber(value)} ${target}.`);
|
||||||
} catch {
|
} 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>.
|
||||||
|
`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "121.0.1",
|
"version": "121.0.2",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user