From 56ebf4fa1fe838b965bdefdc18d091ca0f7a2b0f Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Thu, 13 Apr 2017 00:44:01 +0000 Subject: [PATCH] Yay I can Install my own dependencies --- commands/textedit/morse.js | 2 +- commands/textedit/pirate.js | 2 +- commands/textedit/temmie.js | 2 +- functions/translator.js | 32 -------------------------------- package.json | 3 ++- 5 files changed, 5 insertions(+), 36 deletions(-) delete mode 100644 functions/translator.js diff --git a/commands/textedit/morse.js b/commands/textedit/morse.js index 83a0a299..6988a11a 100644 --- a/commands/textedit/morse.js +++ b/commands/textedit/morse.js @@ -1,5 +1,5 @@ const { Command } = require('discord.js-commando'); -const translator = require('../../functions/translator.js'); +const translator = require('custom-translate'); const morse = { "a": ".-", "b": "-...", diff --git a/commands/textedit/pirate.js b/commands/textedit/pirate.js index 4c4b3572..a3d4d96b 100644 --- a/commands/textedit/pirate.js +++ b/commands/textedit/pirate.js @@ -1,5 +1,5 @@ const { Command } = require('discord.js-commando'); -const translator = require('../../functions/translator.js'); +const translator = require('custom-translate'); const { dictionary } = require('./piratewords.json'); module.exports = class PirateCommand extends Command { diff --git a/commands/textedit/temmie.js b/commands/textedit/temmie.js index fad60b35..45ab24bc 100644 --- a/commands/textedit/temmie.js +++ b/commands/textedit/temmie.js @@ -1,5 +1,5 @@ const { Command } = require('discord.js-commando'); -const translator = require('../../functions/translator.js'); +const translator = require('custom-translate'); const { dictionary } = require('./temmiewords.json'); module.exports = class TemmieCommand extends Command { diff --git a/functions/translator.js b/functions/translator.js deleted file mode 100644 index 7a05b469..00000000 --- a/functions/translator.js +++ /dev/null @@ -1,32 +0,0 @@ -module.exports.wordTrans = (text, words) => { - text = text.split(' '); - let translation = []; - for (let i = 0; i < text.length; i++) { - const word = text[i].toLowerCase(); - const wordPuncStrip = word.replace(/[\[\\^$.|?*+()\]]/g, ''); - if (words[wordPuncStrip]) { - const reg = new RegExp(wordPuncStrip, 'gi'); - translation.push(word.replace(reg, words[wordPuncStrip])); - } - else { - translation.push(word); - } - } - return translation.join(' '); -}; - -module.exports.letterTrans = (text, letters, joinWith) => { - text = text.split(''); - let translation = []; - for (let i = 0; i < text.length; i++) { - const letter = text[i]; - if (letters[letter]) { - translation.push(letters[letter]); - } - else { - translation.push(letter); - } - } - joinWith = joinWith || ''; - return translation.join(joinWith); -}; diff --git a/package.json b/package.json index 27649462..af1d922c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "24.0.1", + "version": "24.1.0", "description": "A Discord Bot", "main": "shardingmanager.js", "repository": { @@ -17,6 +17,7 @@ "license": "ISC", "dependencies": { "cheerio": "^0.22.0", + "custom-translate": "dragonfire535/custom-translate", "discord.js": "hydrabolt/discord.js", "discord.js-commando": "gawdl3y/discord.js-commando", "jimp": "^0.2.27",