mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-20 05:51:35 +02:00
Roman Numerals
This commit is contained in:
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"M": 1000,
|
||||||
|
"CM": 900,
|
||||||
|
"D": 500,
|
||||||
|
"CD": 400,
|
||||||
|
"C": 100,
|
||||||
|
"XC": 90,
|
||||||
|
"L": 50,
|
||||||
|
"XL": 40,
|
||||||
|
"X": 10,
|
||||||
|
"IX": 9,
|
||||||
|
"V": 5,
|
||||||
|
"IV": 4,
|
||||||
|
"I": 1
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
const { Command } = require('discord.js-commando');
|
||||||
|
const numerals = require('../../assets/json/roman-numeral');
|
||||||
|
|
||||||
|
module.exports = class RomanNumeralCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'roman-numeral',
|
||||||
|
aliases: ['roman'],
|
||||||
|
group: 'number-edit',
|
||||||
|
memberName: 'roman-numeral',
|
||||||
|
description: 'Converts a number to roman numerals.',
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
key: 'number',
|
||||||
|
prompt: 'What number would you like to convert to roman numerals?',
|
||||||
|
type: 'integer',
|
||||||
|
max: 4999
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
run(msg, { number }) {
|
||||||
|
let result = '';
|
||||||
|
for (const [numeral, value] of Object.entries(numerals)) {
|
||||||
|
while (number >= value) {
|
||||||
|
result += numeral;
|
||||||
|
number -= value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return msg.say(result);
|
||||||
|
}
|
||||||
|
};
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "66.2.0",
|
"version": "66.3.0",
|
||||||
"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