summaryrefslogtreecommitdiff
path: root/src/commands/utility/romannumeral.ts
diff options
context:
space:
mode:
author8cy <[email protected]>2020-07-23 23:24:17 -0700
committer8cy <[email protected]>2020-07-23 23:24:17 -0700
commitbb511abc03bb66848947e37a999502b813c77269 (patch)
tree612c010fc8317e1cdf11471a18aad0270819d33e /src/commands/utility/romannumeral.ts
parentfix: if clear amount equal or over 100, round down to 99 (diff)
downloaddep-core-bb511abc03bb66848947e37a999502b813c77269.tar.xz
dep-core-bb511abc03bb66848947e37a999502b813c77269.zip
goodbye old uwufier :cry:
Diffstat (limited to 'src/commands/utility/romannumeral.ts')
-rw-r--r--src/commands/utility/romannumeral.ts57
1 files changed, 0 insertions, 57 deletions
diff --git a/src/commands/utility/romannumeral.ts b/src/commands/utility/romannumeral.ts
deleted file mode 100644
index 39b9320..0000000
--- a/src/commands/utility/romannumeral.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando';
-//@ts-ignore no types
-import emoji from 'emoji-random'
-//@ts-ignore no types
-import romanize from 'romanize'
-
-module.exports = class RomanNumeralUtility extends Command {
- constructor(client: CommandoClient) {
- super(client, {
- name: 'romannumeral',
- aliases: [
- 'roman-numeral',
- 'romannumerals',
- 'roman-numerals'
- ],
- group: 'utility',
- memberName: 'romannumeral',
- description: 'Converts a number to a roman numeral.',
- examples: ['uwu!romannumeral 12'],
- throttling: {
- usages: 5,
- duration: 30
- },
- userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
- clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
- args: [
- {
- key: 'nNum',
- prompt: 'What number would you like to translate',
- type: 'integer',
- min: 1
- }
- ]
- });
- }
- run(msg: CommandoMessage, { nNum }: any) {
- if (nNum === parseInt(nNum, 10)) {
- msg.reply(romanize(nNum))
- }
-
- const back = (value: string) => {
- let res = 0
-
- const decimal = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]
- const roman = ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"]
- for (let i = 0; i <= decimal.length; i++) {
- while (value.indexOf(roman[i]) === 0) {
- res += decimal[i]
- value = value.replace(roman[i], '')
- }
- }
- return res
- }
-
- return msg.reply(back(nNum) + ' ' + emoji.random())
- }
-}; \ No newline at end of file