mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-21 14:04:38 +02:00
Rule of the internet, better units
This commit is contained in:
@@ -33,8 +33,8 @@ module.exports = class UnitsCommand extends Command {
|
||||
|
||||
run(msg, { base, target, amount }) {
|
||||
try {
|
||||
const value = math.unit(amount, base).to(target).toString();
|
||||
return msg.say(value);
|
||||
const value = math.unit(amount, base).toNumber(target);
|
||||
return msg.say(`${amount} ${base} is ${value} ${target}.`);
|
||||
} catch (err) {
|
||||
return msg.say('Either an invalid unit type was provided or the unit types do not match.');
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const rules = require('../../assets/json/rule-of-the-internet');
|
||||
|
||||
module.exports = class RuleOfTheInternetCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'rule-of-the-internet',
|
||||
aliases: ['rules-of-the-internet', 'internet-rule', 'rule'],
|
||||
group: 'search',
|
||||
memberName: 'rule-of-the-internet',
|
||||
description: 'Responds with a rule of the internet.',
|
||||
args: [
|
||||
{
|
||||
key: 'rule',
|
||||
prompt: 'Which rule would you like to view?',
|
||||
type: 'integer',
|
||||
default: '',
|
||||
min: 1,
|
||||
max: rules.length
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { rule }) {
|
||||
if (!rule) return msg.say({ files: ['https://i.imgur.com/vGw29EQ.jpg'] });
|
||||
return msg.say(`**Rule #${rule}**: ${rules[rule - 1]}`);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user