The Power of const

This commit is contained in:
Daniel Odendahl Jr
2017-04-03 22:31:19 +00:00
parent 4f0f1b4ad2
commit 76907549df
87 changed files with 525 additions and 558 deletions
+2 -2
View File
@@ -28,8 +28,8 @@ module.exports = class BinaryCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let turnToBinary = args.text;
let binaryText = stringToBinary(turnToBinary);
const turnToBinary = args.text;
const binaryText = stringToBinary(turnToBinary);
return message.say(binaryText);
}
};
+1 -1
View File
@@ -22,7 +22,7 @@ module.exports = class CowsayCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let turnToCowsay = args.text;
const turnToCowsay = args.text;
return message.code(null, cowsay.say({
text: turnToCowsay,
e: "oO",
+3 -4
View File
@@ -23,14 +23,13 @@ module.exports = class EmbedCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
}
console.log(`[Command] ${message.content}`);
let embedMessage = message.content.split(" ").slice(1).join(" ");
const embedMessage = message.content.split(" ").slice(1).join(" ");
const embed = new Discord.RichEmbed()
.setAuthor(message.author.username, message.author.avatarURL)
.setColor(0x00AE86)
.setTimestamp()
.setDescription(embedMessage);
let deleteMsg = await message.delete();
let embedSend = await message.embed(embed);
return [deleteMsg, embedSend];
await message.delete();
return message.embed(embed);
}
};
+3 -3
View File
@@ -20,7 +20,7 @@ module.exports = class MorseCommand extends commando.Command {
if (method.toLowerCase() === 'encode' || method.toLowerCase() === 'decode') {
return true;
}
return 'Please enter either `encode` or `decode`.'
return 'Please enter either `encode` or `decode`.';
}
}, {
key: 'text',
@@ -35,8 +35,8 @@ module.exports = class MorseCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let methodToUse = args.method.toLowerCase();
let toMorse = args.text;
const methodToUse = args.method.toLowerCase();
const toMorse = args.text;
if (methodToUse === 'encode') {
return message.say(morse.encode(toMorse)).catch(error => message.say(':x: Error! Something went wrong! Perhaps you entered incorrect text?'));
}
+2 -2
View File
@@ -32,8 +32,8 @@ module.exports = class PirateCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let turnToPirate = args.text;
let pirate = pirateSpeak.translate(turnToPirate);
const turnToPirate = args.text;
const pirate = pirateSpeak.translate(turnToPirate);
if (pirate.length > 1950) return message.say(":x: Error! Your message is too long!");
return message.say(pirate);
}
+2 -2
View File
@@ -21,8 +21,8 @@ module.exports = class ReverseCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let stringToReverse = args.text;
let reversed = stringToReverse.split("").reverse().join("");
const stringToReverse = args.text;
const reversed = stringToReverse.split("").reverse().join("");
return message.say(reversed);
}
};
+2 -2
View File
@@ -34,8 +34,8 @@ module.exports = class RomajiCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let romajify = args.kana;
let romajified = hepburn.fromKana(romajify);
const romajify = args.kana;
const romajified = hepburn.fromKana(romajify);
return message.say(romajified);
}
};
+3 -4
View File
@@ -28,9 +28,8 @@ module.exports = class SayCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'MANAGE_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let copycat = args.text;
let deleteMsg = await message.delete();
let copyMsg = await message.say(copycat);
return [deleteMsg, copyMsg];
const copycat = args.text;
await message.delete();
return message.say(copycat);
}
};
+1 -1
View File
@@ -33,7 +33,7 @@ module.exports = class ShuffleCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let thingToShuffle = args.text;
const thingToShuffle = args.text;
return message.say(thingToShuffle.shuffle());
}
};
+3 -288
View File
@@ -1,290 +1,5 @@
const commando = require('discord.js-commando');
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) {
let 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();
let firstChar = wordA.slice(0, 1);
let 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) {
let translatedText = "";
let word = "";
for (let i = 0; i < text.length; i += 1) {
let character = text[i];
if (isLetter(character)) {
word += character;
}
else {
if (word != "") {
let wordTranslate = translateWord(word);
translatedText += wordTranslate;
word = "";
}
translatedText += character;
}
}
if (word !== "") translatedText += translateWord(word);
return translatedText;
}
const temmize = function(text) {
let currentTranslation = translator(text);
let temmify = currentTranslation.split("ing").join("in").split("!").join("!!!!111!11!1!!!1!!!1111!").split("'").join("");
return temmify;
};
const temmize = require('./temmize.js');
module.exports = class TemmieCommand extends commando.Command {
constructor(Client) {
@@ -313,8 +28,8 @@ module.exports = class TemmieCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let thingToTranslate = args.text;
let temmized = temmize(thingToTranslate);
const thingToTranslate = args.text;
const temmized = temmize(thingToTranslate);
return message.say(temmized);
}
};
+285
View File
@@ -0,0 +1,285 @@
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) {
let 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();
let firstChar = wordA.slice(0, 1);
let 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) {
let translatedText = "";
let word = "";
for (let i = 0; i < text.length; i += 1) {
let character = text[i];
if (isLetter(character)) {
word += character;
}
else {
if (word != "") {
let wordTranslate = translateWord(word);
translatedText += wordTranslate;
word = "";
}
translatedText += character;
}
}
if (word !== "") translatedText += translateWord(word);
return translatedText;
}
module.exports = function(text) {
let currentTranslation = translator(text);
let temmify = currentTranslation.split("ing").join("in").split("!").join("!!!!111!11!1!!!1!!!1111!").split("'").join("");
return temmify;
};
+4 -4
View File
@@ -146,13 +146,13 @@ module.exports = class TranslateCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
}
console.log(`[Command] ${message.content}`);
let languageto = args.to.toLowerCase();
let thingToTranslate = args.text;
const languageto = args.to.toLowerCase();
const thingToTranslate = args.text;
try {
let res = await translate(thingToTranslate, {
const res = await translate(thingToTranslate, {
to: languageto
});
let languagefrom = res.from.language.iso.toLowerCase();
const languagefrom = res.from.language.iso.toLowerCase();
const embed = new Discord.RichEmbed()
.setColor(0x00AE86)
.addField(`Input (From: ${languages[languagefrom]}):`,
+4 -4
View File
@@ -31,15 +31,15 @@ module.exports = class WebhookCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'MANAGE_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let content = args.text;
const content = args.text;
try {
let post = await request
await message.delete();
const post = await request
.post(config.webhook)
.send({
content: content
});
let deleteMsg = await message.delete();
return [post, deleteMsg];
return post;
}
catch (err) {
return message.say(':x: Error! Message failed to send!');
+2 -2
View File
@@ -23,9 +23,9 @@ module.exports = class YodaCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let turnToYoda = args.text;
const turnToYoda = args.text;
try {
let response = await request
const response = await request
.get('https://yoda.p.mashape.com/yoda')
.set({
'X-Mashape-Key': config.mashapekey,
+1 -1
View File
@@ -28,7 +28,7 @@ module.exports = class ZalgoCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let zalgoified = zalgo(args.text);
const zalgoified = zalgo(args.text);
return message.say(zalgoified);
}
};