mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-05 22:01:54 +02:00
31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
const commando = require('discord.js-commando');
|
|
const romanNumeralConverter = require('roman-numeral-converter-mmxvi');
|
|
|
|
module.exports = class RomanCommand extends commando.Command {
|
|
constructor(Client) {
|
|
super(Client, {
|
|
name: 'roman',
|
|
group: 'numedit',
|
|
memberName: 'roman',
|
|
description: 'Converts numbers to Roman Numerals. (;roman 2)',
|
|
examples: [';roman 2'],
|
|
args: [{
|
|
key: 'number',
|
|
prompt: 'What do you want to convert to Roman?',
|
|
type: 'integer'
|
|
}]
|
|
});
|
|
}
|
|
|
|
run(message, args) {
|
|
if (message.channel.type !== 'dm') {
|
|
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
|
}
|
|
console.log(`[Command] ${message.content}`);
|
|
let numberToRoman = args.number;
|
|
let romanInterger = numberToRoman;
|
|
if (romanInterger > 1000000) return message.channel.send(':x: Error! Number is too high!');
|
|
return message.channel.send(romanNumeralConverter.getRomanFromInteger(romanInterger));
|
|
}
|
|
};
|