diff --git a/commands/botinfo/info.js b/commands/botinfo/info.js index 3b6b421d..4e379e6e 100644 --- a/commands/botinfo/info.js +++ b/commands/botinfo/info.js @@ -59,7 +59,7 @@ class InfoCommand extends commando.Command { .addField('Lib', "[discord.js](https://discord.js.org/#/) (master)", true) .addField('Packages', - "[Commando](https://github.com/Gawdl3y/discord.js-commando) (0.9.0), [cleverbot-node](https://github.com/fojas/cleverbot-node) (0.3.5), [pirate-speak](https://github.com/mikewesthad/pirate-speak) (1.0.1), [JIMP](https://github.com/oliver-moran/jimp) (0.2.27), [google-translate-api](https://github.com/matheuss/google-translate-api) (2.2.2), [urban](https://github.com/mvrilo/urban) (0.3.1), [zalgoize](https://github.com/clux/zalgolize) (1.2.4)") + "[Commando](https://github.com/Gawdl3y/discord.js-commando) (0.9.0), [cleverbot-node](https://github.com/fojas/cleverbot-node) (0.3.5), [pirate-speak](https://github.com/mikewesthad/pirate-speak) (1.0.1), [JIMP](https://github.com/oliver-moran/jimp) (0.2.27), [google-translate-api](https://github.com/matheuss/google-translate-api) (2.2.2), [urban](https://github.com/mvrilo/urban) (0.3.1), [zalgoize](https://github.com/clux/zalgolize) (1.2.4), [hepburn](https://github.com/lovell/hepburn) (1.0.0)") .addField('Other Credit', "[Cleverbot API](https://www.cleverbot.com/api/)") .addField('My Server', diff --git a/commands/textedit/romaji.js b/commands/textedit/romaji.js new file mode 100644 index 00000000..1c180984 --- /dev/null +++ b/commands/textedit/romaji.js @@ -0,0 +1,31 @@ +const commando = require('discord.js-commando'); +const hepburn = require('hepburn'); + +class RomajiCommand extends commando.Command { + constructor(Client){ + super(Client, { + name: 'romaji', + group: 'textedit', + memberName: 'romaji', + description: 'Convert Hiragana and Katakana to Romaji (;romaji ひらがな)', + examples: [';romaji ひらがな'] + }); + } + + async run(message, args) { + if(message.channel.type !== 'dm') { + if(!message.channel.permissionsFor(this.client.user).hasPermission('SEND_MESSAGES')) return; + if(!message.channel.permissionsFor(this.client.user).hasPermission('READ_MESSAGES')) return; + } + console.log("[Command] " + message.content); + let romajify = message.content.split(" ").slice(1).join(" "); + if(hepburn.containsKana(romajify)) { + let romajified = hepburn.fromKana(romajify); + message.channel.sendMessage(romajified); + } else { + message.channel.sendMessage(":x: Error! Message contains no Kana!\n:notepad_spiral: Note: You cannot use this command on Kanji!"); + } + } +} + +module.exports = RomajiCommand; \ No newline at end of file diff --git a/package.json b/package.json index 96edad94..fe009424 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "discord.js": "github:hydrabolt/discord.js", "discord.js-commando": "^0.9.0", "google-translate-api": "^2.2.2", + "hepburn": "^1.0.0", "jimp": "^0.2.27", "pirate-speak": "^1.0.1", "urban": "^0.3.1",