From f1c4802890c888e162d652cdbe9ebdb5fe91522f Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Wed, 12 Apr 2017 17:48:02 +0000 Subject: [PATCH] Remove Tons of Dependencies --- README.md | 2 +- commands/numedit/roman.js | 34 --- commands/textedit/cowsay.js | 15 +- commands/textedit/morse.js | 44 +++- commands/textedit/pirate.js | 7 +- commands/textedit/pirateDictionary.json | 156 +++++++++++++ commands/textedit/romaji.js | 40 ---- commands/textedit/shuffle.js | 38 ---- commands/textedit/temmie.js | 9 +- commands/textedit/temmieDictionary.json | 234 +++++++++++++++++++ commands/textedit/temmize.js | 287 ------------------------ commands/util/info.js | 4 +- functions/translator.js | 32 +++ html/carbondesc.html | 7 +- html/carbonfeat.html | 3 +- html/discordbots.html | 10 +- index.js | 4 - package.json | 7 +- 18 files changed, 488 insertions(+), 445 deletions(-) delete mode 100644 commands/numedit/roman.js create mode 100644 commands/textedit/pirateDictionary.json delete mode 100644 commands/textedit/romaji.js delete mode 100644 commands/textedit/shuffle.js create mode 100644 commands/textedit/temmieDictionary.json delete mode 100644 commands/textedit/temmize.js create mode 100644 functions/translator.js diff --git a/README.md b/README.md index 9a34d776..29846942 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ You can add XiaoBot to your server with [this link](https://discordapp.com/oauth You can join the home server with [this link](https://discord.gg/fqQF8mc). ## Modules & APIs -[discord.js](https://discord.js.org/#/), [commando](https://github.com/Gawdl3y/discord.js-commando), [pirate-speak](https://github.com/mikewesthad/pirate-speak), [zalgoize](https://github.com/clux/zalgolize), [hepburn](https://github.com/lovell/hepburn), [roman-numeral-converter-mmxvi](https://github.com/Cein-Markey/roman-numeral-conversion-library), [cowsay](https://github.com/piuccio/cowsay), [morse](https://github.com/ecto/morse), [superagent](https://github.com/visionmedia/superagent), [mathjs](http://mathjs.org/), [moment](http://momentjs.com), [moment-duration-format](https://github.com/jsmreese/moment-duration-format), [jimp](https://github.com/oliver-moran/jimp), [cheerio](https://cheerio.js.org/), [Wattpad](https://developer.wattpad.com/docs/api), [Wordnik](http://developer.wordnik.com/docs.html), [osu!](https://osu.ppy.sh/p/api), [memegen.link](https://memegen.link/), [Yugioh Prices](http://docs.yugiohprices.apiary.io/#), [YouTube Data](https://developers.google.com/youtube/v3/), [Yoda Speak](https://market.mashape.com/ismaelc/yoda-speak), [Discord Bots](https://bots.discord.pw/api), [Today in History](http://history.muffinlabs.com/#api), [jService](http://jservice.io/), [Strawpoll](https://github.com/strawpoll/strawpoll/wiki/API), [Urban Dictionary](https://github.com/zdict/zdict/wiki/Urban-dictionary-API-documentation), [OMDB](http://www.omdbapi.com/), [Yahoo Weather](https://developer.yahoo.com/weather/), [Yandex.Translate](https://translate.yandex.com/developers), [Wikipedia](https://en.wikipedia.org/w/api.php) +[discord.js](https://discord.js.org/#/), [commando](https://github.com/Gawdl3y/discord.js-commando), [zalgoize](https://github.com/clux/zalgolize), [superagent](https://github.com/visionmedia/superagent), [mathjs](http://mathjs.org/), [moment](http://momentjs.com), [moment-duration-format](https://github.com/jsmreese/moment-duration-format), [jimp](https://github.com/oliver-moran/jimp), [cheerio](https://cheerio.js.org/), [Wattpad](https://developer.wattpad.com/docs/api), [Wordnik](http://developer.wordnik.com/docs.html), [osu!](https://osu.ppy.sh/p/api), [memegen.link](https://memegen.link/), [Yugioh Prices](http://docs.yugiohprices.apiary.io/#), [YouTube Data](https://developers.google.com/youtube/v3/), [Yoda Speak](https://market.mashape.com/ismaelc/yoda-speak), [Discord Bots](https://bots.discord.pw/api), [Today in History](http://history.muffinlabs.com/#api), [jService](http://jservice.io/), [Strawpoll](https://github.com/strawpoll/strawpoll/wiki/API), [Urban Dictionary](https://github.com/zdict/zdict/wiki/Urban-dictionary-API-documentation), [OMDB](http://www.omdbapi.com/), [Yahoo Weather](https://developer.yahoo.com/weather/), [Yandex.Translate](https://translate.yandex.com/developers), [Wikipedia](https://en.wikipedia.org/w/api.php) ## Self-Hosting You can Self-Host the bot easily, provided you have API keys and a Discord Bot Token. [Node.js](https://nodejs.org/en/) is also required, with at least version 7.8.0 recommended. diff --git a/commands/numedit/roman.js b/commands/numedit/roman.js deleted file mode 100644 index cb9d1469..00000000 --- a/commands/numedit/roman.js +++ /dev/null @@ -1,34 +0,0 @@ -const { Command } = require('discord.js-commando'); -const romanNumeralConverter = require('roman-numeral-converter-mmxvi'); - -module.exports = class RomanCommand extends Command { - constructor(client) { - super(client, { - name: 'roman', - group: 'numedit', - memberName: 'roman', - description: 'Converts numbers to Roman Numerals. (;roman 2)', - examples: [';roman 2'], - args: [{ - key: 'number', - prompt: 'What do you want to convert to Roman?', - type: 'integer', - validate: number => { - if (number < 1000001 && number > 0) { - return true; - } - return 'Please enter a number below one million and above zero.'; - } - }] - }); - } - - run(message, args) { - if (message.channel.type !== 'dm') { - if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; - } - const number = args.number; - const roman = romanNumeralConverter.getRomanFromInteger(number); - return message.say(roman); - } -}; diff --git a/commands/textedit/cowsay.js b/commands/textedit/cowsay.js index 96ed7555..2de625d8 100644 --- a/commands/textedit/cowsay.js +++ b/commands/textedit/cowsay.js @@ -1,5 +1,4 @@ const { Command } = require('discord.js-commando'); -const cowsay = require('cowsay'); module.exports = class CowsayCommand extends Command { constructor(client) { @@ -12,7 +11,13 @@ module.exports = class CowsayCommand extends Command { args: [{ key: 'text', prompt: 'What text would you like the cow to say?', - type: 'string' + type: 'string', + validate: text => { + if (text.length < 1500) { + return true; + } + return 'Your message content is too long.'; + } }] }); } @@ -22,10 +27,6 @@ module.exports = class CowsayCommand extends Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } const text = args.text; - return message.code(null, cowsay.say({ - text: text, - e: 'oO', - T: 'U ' - })).catch(() => message.say(':x: Error! Perhaps the content is too long?')); + return message.code(null, `< ${text} >\n \\ ^__^\n \\ (oO)\\_______\n (__)\\ )\\/\\\n U ||----w |\n || ||`); } }; diff --git a/commands/textedit/morse.js b/commands/textedit/morse.js index 3582d9ca..6b86ab7c 100644 --- a/commands/textedit/morse.js +++ b/commands/textedit/morse.js @@ -1,5 +1,43 @@ const { Command } = require('discord.js-commando'); -const morse = require('morse'); +const translator = require('../../functions/translator.js'); +const morse = { + "a": ".-", + "b": "-...", + "c": "-.-.", + "d": "-..", + "e": ".", + "f": "..-.", + "g": "--.", + "h": "....", + "i": "..", + "j": ".---", + "k": "-.-", + "l": ".-..", + "m": "--", + "n": "-.", + "o": "---", + "p": ".--.", + "q": "--.-", + "r": ".-.", + "s": "...", + "t": "-", + "u": "..-", + "v": "...-", + "w": ".--", + "x": "-..-", + "y": "-.--", + "z": "--..", + "0": "-----", + "1": ".----", + "2": "..---", + "3": "...--", + "4": "....-", + "5": ".....", + "6": "-....", + "7": "--...", + "8": "---..", + "9": "----." +}; module.exports = class MorseCommand extends Command { constructor(client) { @@ -17,7 +55,7 @@ module.exports = class MorseCommand extends Command { prompt: 'What text would you like to convert to morse?', type: 'string', validate: content => { - if (morse.encode(content).length < 1900) { + if (translator.letterTrans(content, morse).length < 1900) { return true; } return 'Your text to encode is too long.'; @@ -31,7 +69,7 @@ module.exports = class MorseCommand extends Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } const text = args.text; - const encoded = morse.encode(text); + const encoded = translator.letterTrans(text, morse); return message.say(encoded); } }; diff --git a/commands/textedit/pirate.js b/commands/textedit/pirate.js index 9ca6093f..29747503 100644 --- a/commands/textedit/pirate.js +++ b/commands/textedit/pirate.js @@ -1,5 +1,6 @@ const { Command } = require('discord.js-commando'); -const pirateSpeak = require('pirate-speak'); +const translator = require('../../functions/translator.js'); +const { dictionary } = require('./pirateDictionary.json'); module.exports = class PirateCommand extends Command { constructor(client) { @@ -18,7 +19,7 @@ module.exports = class PirateCommand extends Command { prompt: 'What text would you like to convert to pirate?', type: 'string', validate: content => { - if (pirateSpeak.translate(content).length > 1950) { + if (translator.wordTrans(content, dictionary).length > 1950) { return 'Your message content is too long.'; } return true; @@ -32,7 +33,7 @@ module.exports = class PirateCommand extends Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } const text = args.text; - const pirate = pirateSpeak.translate(text); + const pirate = translator.wordTrans(text, dictionary); return message.say(`\u180E${pirate}`); } }; diff --git a/commands/textedit/pirateDictionary.json b/commands/textedit/pirateDictionary.json new file mode 100644 index 00000000..4aa1395c --- /dev/null +++ b/commands/textedit/pirateDictionary.json @@ -0,0 +1,156 @@ +{ + "dictionary": { + "address": "port o' call", + "admin": "helm", + "am": "be", + "an": "a", + "and": "n'", + "are": "be", + "award": "prize", + "bathroom": "head", + "beer": "grog", + "before": "afore", + "belief": "creed", + "between": "betwixt", + "big": "vast", + "bill": "coin", + "bills": "coins", + "boss": "admiral", + "bourbon": "rum", + "box": "barrel", + "boy": "lad", + "buddy": "mate", + "business": "company", + "businesses": "companies", + "calling": "callin'", + "canada": "Great North", + "cash": "coin", + "cat": "parrot", + "cheat": "hornswaggle", + "comes": "hails", + "comments": "yer words", + "cool": "shipshape", + "country": "land", + "dashboard": "shanty", + "dead": "in Davy Jones's Locker", + "disconnect": "keelhaul", + "do": "d'", + "dog": "parrot", + "dollar": "doubloon", + "dollars": "doubloons", + "dude": "pirate", + "employee": "crew", + "everyone": "all hands", + "eye": "eye-patch", + "family": "kin", + "fee": "debt", + "female": "wench", + "females": "wenches", + "food": "grub", + "for": "fer", + "friend": "mate", + "friends": "crew", + "fuck": "shiver me timbers", + "gin": "rum", + "girl": "lass", + "girls": "lassies", + "go": "sail", + "good": "jolly good", + "grave": "Davy Jones's Locker", + "group": "maties", + "gun": "bluderbuss", + "haha": "yo ho", + "hahaha": "yo ho ho", + "hahahaha": "yo ho ho ho", + "hand": "hook", + "happy": "grog-filled", + "hello": "ahoy", + "hey": "ahoy", + "hi": "ahoy", + "hotel": "fleebag inn", + "i": "me", + "i'm": "i be", + "internet": "series o' tubes", + "invalid": "sunk", + "is": "be", + "island": "isle", + "isn't": "be not", + "it's": "'tis", + "jail": "brig", + "kill": "keelhaul", + "king": "king", + "ladies": "lasses", + "lady": "lass", + "lawyer": "scurvy land lubber", + "left": "port", + "leg": "peg", + "logout": "walk the plank", + "lol": "blimey", + "male": "pirate", + "man": "pirate", + "manager": "admiral", + "money": "doubloons", + "month": "moon", + "my": "me", + "never": "nary", + "no": "nay", + "not": "nay", + "of": "o'", + "old": "barnacle-covered", + "omg": "shiver me timbers", + "over": "o'er", + "page": "parchment", + "people": "scallywags", + "person": "scurvy dog", + "posted": "tacked to the yardarm", + "president": "king", + "prison": "brig", + "quickly": "smartly", + "really": "verily", + "relative": "kin", + "relatives": "kin", + "religion": "creed", + "restaurant": "galley", + "right": "starboard", + "rotf": "rollin' on the decks", + "say": "cry", + "seconds": "ticks o' tha clock", + "shipping": "cargo", + "shit": "shiver me timbers", + "small": "puny", + "snack": "grub", + "soldier": "sailor", + "sorry": "yarr", + "spouse": "ball 'n' chain", + "state": "land", + "supervisor": "Cap'n", + "that's": "that be", + "the": "thar", + "theif": "swoggler", + "them": "'em", + "this": "dis", + "to": "t'", + "together": "t'gether", + "treasure": "booty", + "vodka": "rum", + "was": "be", + "water": "grog", + "we": "our jolly crew", + "we're": "we's", + "whiskey": "rum", + "whisky": "rum", + "wine": "grog", + "with": "wit'", + "woman": "comely wench", + "women": "beauties", + "work": "duty", + "yah": "aye", + "yeah": "aye", + "yes": "aye", + "you": "ye", + "you're": "you be", + "you've": "ye", + "your": "yer", + "yup": "aye" + } +} diff --git a/commands/textedit/romaji.js b/commands/textedit/romaji.js deleted file mode 100644 index 91c07757..00000000 --- a/commands/textedit/romaji.js +++ /dev/null @@ -1,40 +0,0 @@ -const { Command } = require('discord.js-commando'); -const hepburn = require('hepburn'); - -module.exports = class RomajiCommand extends Command { - constructor(client) { - super(client, { - name: 'romaji', - aliases: [ - 'romajify' - ], - group: 'textedit', - memberName: 'romaji', - description: 'Convert Hiragana and Katakana to Romaji (;romaji ひらがな)', - examples: [';romaji ひらがな'], - args: [{ - key: 'kana', - prompt: 'What kana would you like to convert to romaji?', - type: 'string', - validate: kana => { - if (hepburn.containsKana(kana)) { - if (hepburn.fromKana(kana).length > 1950) { - return 'Your message content is too long.'; - } - return true; - } - return 'Please enter text in either Hiragana or Katakana.'; - } - }] - }); - } - - run(message, args) { - if (message.channel.type !== 'dm') { - if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; - } - const kana = args.kana; - const romaji = hepburn.fromKana(kana); - return message.say(romaji); - } -}; diff --git a/commands/textedit/shuffle.js b/commands/textedit/shuffle.js deleted file mode 100644 index b6fa5c37..00000000 --- a/commands/textedit/shuffle.js +++ /dev/null @@ -1,38 +0,0 @@ -const { Command } = require('discord.js-commando'); -String.prototype.shuffle = function() { - let a = this.split(''), - n = a.length; - for (let i = n - 1; i > 0; i--) { - let j = Math.floor(Math.random() * (i + 1)); - let tmp = a[i]; - a[i] = a[j]; - a[j] = tmp; - } - return a.join(''); -}; - -module.exports = class ShuffleCommand extends Command { - constructor(client) { - super(client, { - name: 'shuffle', - group: 'textedit', - memberName: 'shuffle', - description: 'Shuffles text (;shuffle This Text)', - examples: [';shuffle This Text'], - args: [{ - key: 'text', - prompt: 'What text would you like to shuffle?', - type: 'string' - }] - }); - } - - run(message, args) { - if (message.channel.type !== 'dm') { - if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; - } - const text = args.text; - const shuffled = text.shuffle(); - return message.say(`\u180E${shuffled}`); - } -}; diff --git a/commands/textedit/temmie.js b/commands/textedit/temmie.js index a90f86ae..91f7023f 100644 --- a/commands/textedit/temmie.js +++ b/commands/textedit/temmie.js @@ -1,5 +1,6 @@ const { Command } = require('discord.js-commando'); -const temmize = require('./temmize.js'); +const translator = require('../../functions/translator.js'); +const { dictionary } = require('./temmieDictionary.json'); module.exports = class TemmieCommand extends Command { constructor(client) { @@ -14,7 +15,7 @@ module.exports = class TemmieCommand extends Command { prompt: 'What text would you like to convert to Temmie speak?', type: 'string', validate: content => { - if (temmize(content).length > 1950) { + if (translator.wordTrans(content, dictionary).length > 1950) { return 'Your message content is too long.'; } return true; @@ -28,7 +29,7 @@ module.exports = class TemmieCommand extends Command { if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; } const text = args.text; - const temmized = temmize(text); + const temmized = translator.wordTrans(text, dictionary); return message.say(`\u180E${temmized}`); } -}; +}; \ No newline at end of file diff --git a/commands/textedit/temmieDictionary.json b/commands/textedit/temmieDictionary.json new file mode 100644 index 00000000..5845ce33 --- /dev/null +++ b/commands/textedit/temmieDictionary.json @@ -0,0 +1,234 @@ +{ + "dictionary": { + "i": "tem", + "hi": "hoi", + "that": "dat", + "that's": "dat", + "hello": "hoi", + "me": "temmie", + "goodbye": "boi", + "bye": "boi", + "later": "boi", + "college": "colleg", + "money": "muns", + "food": "tem flakes", + "snack": "tem flakes", + "snacks": "tem flakes", + "meal": "tem flakes", + "meals": "tem flakes", + "human": "hooman", + "humans": "hoomans", + "chocolate": "choco", + "cute": "coot", + "allergic": "allergics", + "allergy": "allergics", + "do": "dos", + "does": "dos", + "what": "ppppppppp...", + "who": "ppppppppp...", + "when": "ppppppppp...", + "why": "ppppppppp...", + "where": "ppppppppp...", + "how": "ppppppppp...", + "xd": "xd", + "but": "b-but", + "store": "tem shop", + "restaurant": "tem shop", + "shop": "tem shop", + "temmie": "temmiy", + "sick": "holves", + "illness": "holves", + "ill": "holves", + "disease": "holves", + "cat": "tem", + "dog": 'tem', + "hugs": "pets", + "pats": "pets", + "waves": "pets", + "high-fives": "pets", + "fistbumps": "pets", + "hug": "pet", + "pat": "pet", + "wave": "pet", + "high-five": "pet", + "fistbump": "pet", + "hungry": "hungr", + "muscles": "not coot", + "aw": "awwawa", + "yikes": "omg!", + "ah": "omg!", + "oh": "omg!", + "yipe": "omg!", + "wait": "omg!", + "yes": "yee!", + "no": "no!", + "person": "bark", + "monster": "munster", + "monsters": "munsters", + "great": "tem outta tem", + "awesome": "tem outta tem", + "cool": "tem outta tem", + "nice": "tem outta tem", + "good": "tem outta tem", + "walks": "vibrates", + "moves": "vibrates", + "sits": "vibrates", + "goes": "vibrates", + "runs": "vibrates intensely", + "climbs": "vibrates intensely", + "escapes": "vibrates intensely", + "normal": "bob", + "hmm": "p...", + "okay": "ok", + "lol": "lel", + "enemy": "special enemy", + "villain": "special enemy", + "bad guy": "special enemy", + "badguy": "special enemy", + "school": "skool", + "um": "p...", + "elizabeth": "ebears", + "yeah": "yaya", + "yea": "yaya", + "uh-huh": "yaya", + "vampire": "wampire", + "tired": "*dies*", + "exhausted": "*dies*", + "bored": "*dies*", + "annoyed": "*dies*", + "irritated": "*dies*", + "mad": "*dies*", + "sleepy": "*dies*", + "confused": "*dies*", + "house": "tem villag", + "home": "tem villag", + "apartment": "tem villag", + "world": "undergroun", + "hotel": "mtt resort", + "motel": "mtt resort", + "inn": "mtt resort", + "cash": "g", + "gold": "g", + "jewels": "g", + "aaron": "not coot", + "boy": "tim", + "girl": "tem", + "we": "tems", + "you": "u", + "your": "ur", + "yours": "urs", + "there": "dere", + "proud": "prouds", + "random": "rando", + "see": "c", + "this": "dis", + "egg": "eg", + "very": "very!", + "excited": "excite", + "doesn't": "don't", + "sleep": "slep", + "noodles": "alphys foob", + "scream": "screems", + "gonna": "gunna", + "pasta": "papy foob", + "spaghetti": "papy foob", + "scary": "scaredy", + "frightening": "scaredy", + "worry": "worrys", + "worries": "worrys", + "sushi": "undyne foob", + "banana": "bernerner", + "bananas": "bernerners", + "apple": "oppl", + "apples": "oppls", + "grape": "grep", + "grapes": "greps", + "wonder": "wunders", + "wonders": "wunders", + "wondering": "wunders", + "wonderful": "wunderfull", + "think": "finks", + "thinks": "finks", + "thought": "finked", + "beat": "dunks", + "defeat": "dunks", + "defeated": "dunkd", + "they're": "their", + "their": "there", + "you're": "ur", + "because": "cuz", + "bc": "cuz", + "will": "wil", + "things": "thins", + "thing": "thin", + "science": "scienc", + "ice cream": "noice creem", + "spear": "speer", + "baby": "temini", + "babies": "teminis", + "child": "temini", + "children": "teminis", + "kid": "temini", + "kids": "teminis", + "bot": "xiao", + "robot": "mettatun", + "ghost": "bluuk", + "nap": "slep", + "boop": "blep", + "beep": "blep", + "bleep": "blep", + "bop": "blep", + "spider": "spoider", + "spiders": "sploiders", + "music": "moosics", + "again": "agin", + "the": "teh", + "family": "fam", + "smart": "smarts", + "smartness": "smartiness", + "intelligence": "smartiness", + "typo": "tpyo", + "typo'd": "tyop'd", + "typos": "typoys", + "yay": "yee", + "potato": "tato", + "potatoes": "tatos", + "fry": "fri", + "fries": "fri", + "burger": "glamburg", + "steak": "stek", + "heart": "hart", + "love": "lub", + "hate": "h8", + "like": "liek", + "library": "librarby", + "fire": "flemz", + "flame": "flemz", + "fires": "flemz", + "flames": "flemz", + "witchcraft": "magics", + "witchcrafts": "magics", + "magic": "magics", + "sorcery": "magics", + "superpower": "magics", + "superpowers": "magics", + "sorceries": "magics", + "and": "n", + "my": "tem's", + "mine": "tem's", + "everyone": "everytem", + "anyone": "anytem", + "someone": "sometem", + "everbody": "everytemmie", + "anybody": "anytemmie", + "somebody": "sometemmie", + "beautiful": "booftifull", + "pretty": "prety", + "so": "soooo", + "help": "halp", + "uh-uh": "nuh", + "nope": "nuh", + "nuh-uh": "nuh", + "please": "pls" + } +} diff --git a/commands/textedit/temmize.js b/commands/textedit/temmize.js deleted file mode 100644 index 681f7dc2..00000000 --- a/commands/textedit/temmize.js +++ /dev/null @@ -1,287 +0,0 @@ -const dictionary = { - "i": "tem", - "hi": "hoi", - "that": "dat", - "that's": "dat", - "hello": "hoi", - "me": "temmie", - "goodbye": "boi", - "bye": "boi", - "later": "boi", - "college": "colleg", - "money": "muns", - "food": "tem flakes", - "snack": "tem flakes", - "snacks": "tem flakes", - "meal": "tem flakes", - "meals": "tem flakes", - "human": "hooman", - "humans": "hoomans", - "chocolate": "choco", - "cute": "coot", - "allergic": "allergics", - "allergy": "allergics", - "do": "dos", - "does": "dos", - "what": "ppppppppp...", - "who": "ppppppppp...", - "when": "ppppppppp...", - "why": "ppppppppp...", - "where": "ppppppppp...", - "how": "ppppppppp...", - "xd": "xd", - "but": "b-but", - "store": "tem shop", - "restaurant": "tem shop", - "shop": "tem shop", - "temmie": "temmiy", - "sick": "holves", - "illness": "holves", - "ill": "holves", - "disease": "holves", - "cat": "tem", - "dog": 'tem', - "hugs": "pets", - "pats": "pets", - "waves": "pets", - "high-fives": "pets", - "fistbumps": "pets", - "hug": "pet", - "pat": "pet", - "wave": "pet", - "high-five": "pet", - "fistbump": "pet", - "hungry": "hungr", - "muscles": "not coot", - "aw": "awwawa", - "yikes": "omg!", - "ah": "omg!", - "oh": "omg!", - "yipe": "omg!", - "wait": "omg!", - "yes": "yee!", - "no": "no!", - "person": "bark", - "monster": "munster", - "monsters": "munsters", - "great": "tem outta tem", - "awesome": "tem outta tem", - "cool": "tem outta tem", - "nice": "tem outta tem", - "good": "tem outta tem", - "walks": "vibrates", - "moves": "vibrates", - "sits": "vibrates", - "goes": "vibrates", - "runs": "vibrates intensely", - "climbs": "vibrates intensely", - "escapes": "vibrates intensely", - "normal": "bob", - "hmm": "p...", - "okay": "ok", - "lol": "lel", - "enemy": "special enemy", - "villain": "special enemy", - "bad guy": "special enemy", - "badguy": "special enemy", - "school": "skool", - "um": "p...", - "elizabeth": "ebears", - "yeah": "yaya", - "yea": "yaya", - "uh-huh": "yaya", - "vampire": "wampire", - "tired": "*dies*", - "exhausted": "*dies*", - "bored": "*dies*", - "annoyed": "*dies*", - "irritated": "*dies*", - "mad": "*dies*", - "sleepy": "*dies*", - "confused": "*dies*", - "house": "tem villag", - "home": "tem villag", - "apartment": "tem villag", - "world": "undergroun", - "hotel": "mtt resort", - "motel": "mtt resort", - "inn": "mtt resort", - "cash": "g", - "gold": "g", - "jewels": "g", - "aaron": "not coot", - "boy": "tim", - "girl": "tem", - "we": "tems", - "you": "u", - "your": "ur", - "yours": "urs", - "there": "dere", - "proud": "prouds", - "random": "rando", - "see": "c", - "this": "dis", - "egg": "eg", - "very": "very!", - "excited": "excite", - "doesn't": "don't", - "sleep": "slep", - "noodles": "alphys foob", - "scream": "screems", - "gonna": "gunna", - "pasta": "papy foob", - "spaghetti": "papy foob", - "scary": "scaredy", - "frightening": "scaredy", - "worry": "worrys", - "worries": "worrys", - "sushi": "undyne foob", - "banana": "bernerner", - "bananas": "bernerners", - "apple": "oppl", - "apples": "oppls", - "grape": "grep", - "grapes": "greps", - "wonder": "wunders", - "wonders": "wunders", - "wondering": "wunders", - "wonderful": "wunderfull", - "think": "finks", - "thinks": "finks", - "thought": "finked", - "beat": "dunks", - "defeat": "dunks", - "defeated": "dunkd", - "they're": "their", - "their": "there", - "you're": "ur", - "because": "cuz", - "bc": "cuz", - "will": "wil", - "things": "thins", - "thing": "thin", - "science": "scienc", - "ice cream": "noice creem", - "spear": "speer", - "baby": "temini", - "babies": "teminis", - "child": "temini", - "children": "teminis", - "kid": "temini", - "kids": "teminis", - "bot": "xiao", - "robot": "mettatun", - "ghost": "bluuk", - "nap": "slep", - "boop": "blep", - "beep": "blep", - "bleep": "blep", - "bop": "blep", - "spider": "spoider", - "spiders": "sploiders", - "music": "moosics", - "again": "agin", - "the": "teh", - "family": "fam", - "smart": "smarts", - "smartness": "smartiness", - "intelligence": "smartiness", - "typo": "tpyo", - "typo'd": "tyop'd", - "typos": "typoys", - "yay": "yee", - "potato": "tato", - "potatoes": "tatos", - "fry": "fri", - "fries": "fri", - "burger": "glamburg", - "steak": "stek", - "heart": "hart", - "love": "lub", - "hate": "h8", - "like": "liek", - "library": "librarby", - "fire": "flemz", - "flame": "flemz", - "fires": "flemz", - "flames": "flemz", - "witchcraft": "magics", - "witchcrafts": "magics", - "magic": "magics", - "sorcery": "magics", - "superpower": "magics", - "superpowers": "magics", - "sorceries": "magics", - "and": "n", - "my": "tem's", - "mine": "tem's", - "everyone": "everytem", - "anyone": "anytem", - "someone": "sometem", - "everbody": "everytemmie", - "anybody": "anytemmie", - "somebody": "sometemmie", - "beautiful": "booftifull", - "pretty": "prety", - "so": "soooo", - "help": "halp", - "uh-uh": "nuh", - "nope": "nuh", - "nuh-uh": "nuh", - "please": "pls" -}; - -function translateWord(word) { - var wordTranslate = dictionary[word.toLowerCase()]; - if (wordTranslate === undefined) return word; - else return applyCase(word, wordTranslate); -} - -function applyCase(wordA, wordB) { - if (wordA.length === 1 && wordB.length !== 1) return wordB; - if (wordA === wordA.toUpperCase()) return wordB.toUpperCase(); - if (wordA === wordA.toLowerCase()) return wordB.toLowerCase(); - var firstChar = wordA.slice(0, 1); - var otherChars = wordA.slice(1); - if (firstChar === firstChar.toUpperCase() && otherChars === otherChars.toLowerCase()) { - return wordB.slice(0, 1).toUpperCase() + wordB.slice(1).toLowerCase(); - } - return wordB; -} - -function isLetter(character) { - if (character.search(/[a-zA-Z'-]/) === -1) return false; - return true; -} - -function translator(text) { - var translatedText = ''; - var word = ''; - for (var i = 0; i < text.length; i += 1) { - var character = text[i]; - if (isLetter(character)) { - word += character; - } - else { - if (word != '') { - var wordTranslate = translateWord(word); - translatedText += wordTranslate; - word = ''; - } - translatedText += character; - } - } - - if (word !== '') translatedText += translateWord(word); - - return translatedText; -} - -module.exports = function(text) { - const currentTranslation = translator(text); - let temmify = currentTranslation.replace(/[ing]/g, 'in'); - temmify = temmify.replace(/[!]/g, '!!!!111!11!1!!!1!!!1111!'); - temmify - temmify.replace(/[']/g, ''); - - return temmify; -}; diff --git a/commands/util/info.js b/commands/util/info.js index a81a54c6..1b782475 100644 --- a/commands/util/info.js +++ b/commands/util/info.js @@ -33,7 +33,7 @@ module.exports = class InfoCommand extends Command { .addField('Shards', `${this.client.options.shardCount} (${this.client.shard.id})`, true) .addField('Commands', - '112', true) + '111', true) .addField('Owner', 'dragonfire535#8081', true) .addField('Source Code', @@ -47,7 +47,7 @@ module.exports = class InfoCommand extends Command { .addField('Library', '[discord.js](https://discord.js.org/#/)', true) .addField('Modules', - '[commando](https://github.com/Gawdl3y/discord.js-commando), [pirate-speak](https://github.com/mikewesthad/pirate-speak), [zalgoize](https://github.com/clux/zalgolize), [hepburn](https://github.com/lovell/hepburn), [roman-numeral-converter-mmxvi](https://github.com/Cein-Markey/roman-numeral-conversion-library), [cowsay](https://github.com/piuccio/cowsay), [morse](https://github.com/ecto/morse), [superagent](https://github.com/visionmedia/superagent), [mathjs](http://mathjs.org/), [moment](http://momentjs.com), [moment-duration-format](https://github.com/jsmreese/moment-duration-format), [jimp](https://github.com/oliver-moran/jimp), [cheerio](https://cheerio.js.org/)') + '[commando](https://github.com/Gawdl3y/discord.js-commando), [zalgoize](https://github.com/clux/zalgolize), [superagent](https://github.com/visionmedia/superagent), [mathjs](http://mathjs.org/), [moment](http://momentjs.com), [moment-duration-format](https://github.com/jsmreese/moment-duration-format), [jimp](https://github.com/oliver-moran/jimp), [cheerio](https://cheerio.js.org/)') .addField('APIs', '[Wattpad](https://developer.wattpad.com/docs/api), [Wordnik](http://developer.wordnik.com/docs.html), [osu!](https://osu.ppy.sh/p/api), [memegen.link](https://memegen.link/), [Yugioh Prices](http://docs.yugiohprices.apiary.io/#), [YouTube Data](https://developers.google.com/youtube/v3/), [Yoda Speak](https://market.mashape.com/ismaelc/yoda-speak), [Discord Bots](https://bots.discord.pw/api), [Today in History](http://history.muffinlabs.com/#api), [jService](http://jservice.io/), [Strawpoll](https://github.com/strawpoll/strawpoll/wiki/API), [Urban Dictionary](https://github.com/zdict/zdict/wiki/Urban-dictionary-API-documentation), [OMDB](http://www.omdbapi.com/), [Yahoo Weather](https://developer.yahoo.com/weather/), [Yandex.Translate](https://translate.yandex.com/developers), [Wikipedia](https://en.wikipedia.org/w/api.php)'); return message.embed(embed); diff --git a/functions/translator.js b/functions/translator.js new file mode 100644 index 00000000..36ceefe8 --- /dev/null +++ b/functions/translator.js @@ -0,0 +1,32 @@ +module.exports.wordTrans = (text, words) => { + text = text.split(' '); + let translation = []; + for (let i = 0; i < text.length; i++) { + const word = text[i]; + 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) => { + text = text.split(''); + let translation = []; + for (let i = 0; i < text.length; i++) { + const letter = text[i]; + if (letters[letter]) { + const reg = new RegExp(letter, 'gi'); + translation.push(letter.replace(reg, letters[letter])); + } + else { + translation.push(letter); + } + } + return translation.join(''); +}; diff --git a/html/carbondesc.html b/html/carbondesc.html index 659144b6..3c7fcc27 100644 --- a/html/carbondesc.html +++ b/html/carbondesc.html @@ -18,16 +18,11 @@
  • discord.js
  • discord.js-commando
  • JIMP
  • -
  • pirate-speak
  • zalgoize
  • -
  • hepburn
  • superagent
  • mathjs
  • -
  • roman-numeral-converter-mmxvi
  • -
  • cowsay
  • moment
  • moment-duration-format
  • -
  • morse
  • cheerio
  • APIs

    @@ -52,7 +47,7 @@

    Information

    diff --git a/html/carbonfeat.html b/html/carbonfeat.html index d4a638c4..55d1080c 100644 --- a/html/carbonfeat.html +++ b/html/carbonfeat.html @@ -41,8 +41,7 @@
  • Search Wikipedia
  • Get Yu-Gi-Oh! Card Data
  • Pirate, Binary, and Yoda Translators
  • -
  • Randomize and Shuffle Text
  • -
  • Convert Hiragana and Katakana to Romaji
  • +
  • Reverse Text
  • Translate Text
  • Zalgoize Text
  • And so so so much more!
  • diff --git a/html/discordbots.html b/html/discordbots.html index a20261b6..2170f6f4 100644 --- a/html/discordbots.html +++ b/html/discordbots.html @@ -45,8 +45,7 @@
  • Search Wikipedia
  • Get Yu-Gi-Oh! Card Data
  • Pirate, Binary, and Yoda Translators
  • -
  • Randomize and Shuffle Text
  • -
  • Convert Hiragana and Katakana to Romaji
  • +
  • Reverse Text
  • Translate Text
  • Zalgoize Text
  • And so so so much more!
  • @@ -66,16 +65,11 @@
  • discord.js
  • discord.js-commando
  • JIMP
  • -
  • pirate-speak
  • zalgoize
  • -
  • hepburn
  • superagent
  • mathjs
  • -
  • roman-numeral-converter-mmxvi
  • -
  • cowsay
  • moment
  • moment-duration-format
  • -
  • morse
  • cheerio
  • APIs

    @@ -101,7 +95,7 @@

    Information

    diff --git a/index.js b/index.js index cfc7aa62..65da87dd 100644 --- a/index.js +++ b/index.js @@ -107,10 +107,6 @@ client.setTimeout(() => { process.exit(0); }, 14400000); -client.setInterval(() => { - console.log(`Shard ${client.shard.id} using ${process.memoryUsage().heapUsed} Bytes of Memory.`); -}, 60000); - client.on('ready', () => { console.log(`[Ready] Shard ${client.shard.id} Logged in!`); client.user.setGame(`;help | Shard ${client.shard.id}`); diff --git a/package.json b/package.json index b9ee0bc8..59ce1958 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "23.1.0", + "version": "24.0.0", "description": "A Discord Bot", "main": "shardingmanager.js", "repository": { @@ -17,17 +17,12 @@ "license": "ISC", "dependencies": { "cheerio": "^0.22.0", - "cowsay": "^1.1.9", "discord.js": "hydrabolt/discord.js", "discord.js-commando": "gawdl3y/discord.js-commando", - "hepburn": "^1.0.0", "jimp": "^0.2.27", "mathjs": "^3.11.0", "moment": "^2.18.1", "moment-duration-format": "^1.3.0", - "morse": "^0.1.0", - "pirate-speak": "^1.0.1", - "roman-numeral-converter-mmxvi": "^1.0.5", "superagent": "^3.5.2", "zalgolize": "^1.2.4" }