From 9b2ab3b7a29983beba6908644a69925fd7adf253 Mon Sep 17 00:00:00 2001 From: 8cy <50817549+8cy@users.noreply.github.com> Date: Wed, 29 Apr 2020 14:42:03 -0700 Subject: add contact cmds, qol updates/ formatting, v9.1.0 --- src/commands/utility/fortnitestats.ts | 2 +- src/commands/utility/gmodserverstatus.ts | 2 +- src/commands/utility/romannumeral.ts | 55 ++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 src/commands/utility/romannumeral.ts (limited to 'src/commands/utility') diff --git a/src/commands/utility/fortnitestats.ts b/src/commands/utility/fortnitestats.ts index 88a50a0..84e0115 100644 --- a/src/commands/utility/fortnitestats.ts +++ b/src/commands/utility/fortnitestats.ts @@ -22,7 +22,7 @@ module.exports = class FortniteStatsUtility extends Command { ], group: 'utility', memberName: 'fortnitestats', - description: 'Grabs a specified player\' Fortnite statistics.', + description: 'Grabs a specified player\'s Fortnite statistics.', details: 'Available platforms are `pc` (PC), `xbp` (Xbox Live) and `psn` (Playstation Network).', examples: [ 'uwu!fortnitestats Frozen', diff --git a/src/commands/utility/gmodserverstatus.ts b/src/commands/utility/gmodserverstatus.ts index a92b5cf..f7d3b35 100644 --- a/src/commands/utility/gmodserverstatus.ts +++ b/src/commands/utility/gmodserverstatus.ts @@ -16,7 +16,7 @@ module.exports = class GModServerStatusUtility extends Command { ], group: 'utility', memberName: 'gmodserverstatus', - description: 'Grabs you the server status of a GMod server.', + description: 'Grabs you the server status of a Garry\'s Mod server.', examples: [ 'uwu!gmodserverstatus', 'uwu!gmodss' diff --git a/src/commands/utility/romannumeral.ts b/src/commands/utility/romannumeral.ts new file mode 100644 index 0000000..8dcc331 --- /dev/null +++ b/src/commands/utility/romannumeral.ts @@ -0,0 +1,55 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random' +import romanize from 'romanize' + +module.exports = class RomanNumeralUtility extends Command { + constructor(client) { + 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 }) { + if (nNum === parseInt(nNum, 10)) { + msg.reply(romanize(nNum)) + } + + const back = value => { + 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 + } + + msg.reply(back(nNum) + ' ' + emoji.random()) + } +}; \ No newline at end of file -- cgit v1.2.3