Formatting

This commit is contained in:
Daniel Odendahl Jr
2017-03-23 01:35:22 +00:00
parent 72718c7c62
commit 40a4af36c4
109 changed files with 2660 additions and 2505 deletions
+4 -4
View File
@@ -2,7 +2,7 @@ const commando = require('discord.js-commando');
const stringToBinary = require('string-to-binary');
module.exports = class BinaryCommand extends commando.Command {
constructor(Client){
constructor(Client) {
super(Client, {
name: 'binary',
group: 'textedit',
@@ -13,11 +13,11 @@ module.exports = class BinaryCommand extends commando.Command {
}
async run(message) {
if(message.channel.type !== 'dm') {
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log("[Command] " + message.content);
let turnToBinary = message.content.split(" ").slice(1).join(" ");
message.channel.send(stringToBinary(turnToBinary)).catch(error => message.channel.send(':x: Error! Translation is too long, or nothing was entered!'));
}
};
};
+10 -9
View File
@@ -2,7 +2,7 @@ const commando = require('discord.js-commando');
const cowsay = require('cowsay');
module.exports = class CowsayCommand extends commando.Command {
constructor(Client){
constructor(Client) {
super(Client, {
name: 'cowsay',
group: 'textedit',
@@ -13,21 +13,22 @@ module.exports = class CowsayCommand extends commando.Command {
}
async run(message) {
if(message.channel.type !== 'dm') {
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log("[Command] " + message.content);
if(message.content.split(" ").slice(1).join(" ") === "") {
if (message.content.split(" ").slice(1).join(" ") === "") {
message.channel.send(":x: Error! You entered nothing!");
} else {
}
else {
let turnToCowsay = message.content.split(" ").slice(1).join(" ");
message.channel.sendCode(null, cowsay.say({
text : turnToCowsay,
e : "oO",
T : "U "
text: turnToCowsay,
e: "oO",
T: "U "
})).catch(error => {
message.channel.send(':x: Error! Perhaps the content is too long?');
});
}
}
};
};
+11 -10
View File
@@ -2,7 +2,7 @@ const commando = require('discord.js-commando');
const Discord = require('discord.js');
module.exports = class EmbedCommand extends commando.Command {
constructor(Client){
constructor(Client) {
super(Client, {
name: 'embed',
group: 'textedit',
@@ -13,22 +13,23 @@ module.exports = class EmbedCommand extends commando.Command {
}
async run(message) {
if(message.channel.type !== 'dm') {
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
if (message.channel.type !== 'dm') {
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(" ");
if(embedMessage === "") {
if (embedMessage === "") {
message.channel.send(":x: Error! Nothing to embed!");
} else {
}
else {
const embed = new Discord.RichEmbed()
.setAuthor(message.author.username, message.author.avatarURL)
.setColor(0x00AE86)
.setTimestamp()
.setDescription(embedMessage);
.setAuthor(message.author.username, message.author.avatarURL)
.setColor(0x00AE86)
.setTimestamp()
.setDescription(embedMessage);
message.channel.sendEmbed(embed).catch(console.error);
if (message.channel.type === 'dm') return;
message.delete();
}
}
};
};
+1 -1
View File
@@ -105,4 +105,4 @@
"yo": "Yoruba",
"zu": "Zulu"
}
}
}
+11 -8
View File
@@ -2,7 +2,7 @@ const commando = require('discord.js-commando');
const morse = require('morse');
module.exports = class MorseCommand extends commando.Command {
constructor(Client){
constructor(Client) {
super(Client, {
name: 'morse',
aliases: [
@@ -16,20 +16,23 @@ module.exports = class MorseCommand extends commando.Command {
}
async run(message) {
if(message.channel.type !== 'dm') {
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log("[Command] " + message.content);
let [methodToUse] = message.content.toLowerCase().split(" ").slice(1);
let toMorse = message.content.split(" ").slice(2).join(" ");
if(toMorse === "") {
if (toMorse === "") {
message.channel.send(":x: Error! Nothing to translate! Perhaps you forgot to set the method? Use either encode or decode before your text.");
} else if(methodToUse === 'encode') {
}
else if (methodToUse === 'encode') {
message.channel.send(morse.encode(toMorse)).catch(error => message.channel.send(':x: Error! Something went wrong! Perhaps you entered incorrect text?'));
} else if(methodToUse === 'decode') {
}
else if (methodToUse === 'decode') {
message.channel.send(morse.decode(toMorse)).catch(error => message.channel.send(':x: Error! Something went wrong! Perhaps you entered incorrect text?'));
} else {
}
else {
message.channel.send(":x: Error! Method not set/not correct! Use either encode or decode.");
}
}
};
};
+10 -8
View File
@@ -2,7 +2,7 @@ const commando = require('discord.js-commando');
const pirateSpeak = require('pirate-speak');
module.exports = class PirateCommand extends commando.Command {
constructor(Client){
constructor(Client) {
super(Client, {
name: 'pirate',
aliases: [
@@ -17,20 +17,22 @@ module.exports = class PirateCommand extends commando.Command {
}
async run(message) {
if(message.channel.type !== 'dm') {
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log("[Command] " + message.content);
let turnToPirate = message.content.split(" ").slice(1).join(" ");
let pirate = pirateSpeak.translate(turnToPirate);
if(turnToPirate === "") {
if (turnToPirate === "") {
message.channel.send(":x: Error! Nothing to translate!");
} else {
if(pirate.length > 1950) {
}
else {
if (pirate.length > 1950) {
message.channel.send(":x: Error! Your message is too long!");
} else {
}
else {
message.channel.send(pirate);
}
}
}
};
};
+7 -6
View File
@@ -1,7 +1,7 @@
const commando = require('discord.js-commando');
module.exports = class ReverseCommand extends commando.Command {
constructor(Client){
constructor(Client) {
super(Client, {
name: 'reverse',
group: 'textedit',
@@ -12,16 +12,17 @@ module.exports = class ReverseCommand extends commando.Command {
}
async run(message) {
if(message.channel.type !== 'dm') {
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log("[Command] " + message.content);
let stringToReverse = message.content.split(" ").slice(1).join(" ");
if(stringToReverse === "") {
if (stringToReverse === "") {
message.channel.send(":x: Error! Nothing to reverse!");
} else {
}
else {
let reversed = stringToReverse.split("").reverse().join("");
message.channel.send(reversed);
}
}
};
};
+18 -16
View File
@@ -3,7 +3,7 @@ const request = require('superagent');
const config = require('../../config.json');
module.exports = class RinSayCommand extends commando.Command {
constructor(Client){
constructor(Client) {
super(Client, {
name: 'rin',
aliases: [
@@ -15,25 +15,27 @@ module.exports = class RinSayCommand extends commando.Command {
examples: [";rin Hey guys!"]
});
}
hasPermission(msg) {
return this.client.isOwner(msg.author);
}
hasPermission(msg) {
return this.client.isOwner(msg.author);
}
async run(message) {
if(message.channel.type !== 'dm') {
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log("[Command] " + message.content);
let rinContent = message.content.split(" ").slice(1).join(" ");
request
.post(config.webhook)
.send({ content: rinContent })
.then(function (parsedBody) {
if(message.content.type === 'dm') return;
message.delete();
}).catch(function (err) {
message.channel.send(':x: Error! Message failed to send! Check the logs for details.');
console.log(err);
});
.post(config.webhook)
.send({
content: rinContent
})
.then(function(parsedBody) {
if (message.content.type === 'dm') return;
message.delete();
}).catch(function(err) {
message.channel.send(':x: Error! Message failed to send! Check the logs for details.');
console.log(err);
});
}
};
};
+10 -8
View File
@@ -2,7 +2,7 @@ const commando = require('discord.js-commando');
const hepburn = require('hepburn');
module.exports = class RomajiCommand extends commando.Command {
constructor(Client){
constructor(Client) {
super(Client, {
name: 'romaji',
aliases: [
@@ -16,20 +16,22 @@ module.exports = class RomajiCommand extends commando.Command {
}
async run(message) {
if(message.channel.type !== 'dm') {
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log("[Command] " + message.content);
let romajify = message.content.split(" ").slice(1).join(" ");
if(hepburn.containsKana(romajify)) {
if (hepburn.containsKana(romajify)) {
let romajified = hepburn.fromKana(romajify);
if(romajified.length > 1950) {
if (romajified.length > 1950) {
message.channel.send(":x: Error! Your message is too long!");
} else {
}
else {
message.channel.send(romajified);
}
} else {
}
else {
message.channel.send(":x: Error! Message contains no Kana!\n:notepad_spiral: Note: You cannot use this command on Kanji!");
}
}
};
};
+7 -6
View File
@@ -1,7 +1,7 @@
const commando = require('discord.js-commando');
module.exports = class SayCommand extends commando.Command {
constructor(Client){
constructor(Client) {
super(Client, {
name: 'say',
aliases: [
@@ -17,17 +17,18 @@ module.exports = class SayCommand extends commando.Command {
}
async run(message) {
if(message.channel.type !== 'dm') {
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log("[Command] " + message.content);
let copycat = message.content.split(" ").slice(1).join(" ");
if(copycat === "") {
if (copycat === "") {
message.channel.send(":x: Error! Nothing to say!");
} else {
}
else {
message.channel.send(copycat);
if (message.channel.type === 'dm') return;
message.delete();
}
}
};
};
+3 -2
View File
@@ -150,7 +150,8 @@ function translator(text) {
let character = text[i];
if (isLetter(character)) {
word += character;
} else {
}
else {
if (word != "") {
let wordTranslate = translateWord(word);
translatedText += wordTranslate;
@@ -168,7 +169,7 @@ function translator(text) {
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;
};
+22 -16
View File
@@ -4,7 +4,7 @@ const translate = require('google-translate-api');
const languages = require('./languages.json');
module.exports = class TranslateCommand extends commando.Command {
constructor(Client){
constructor(Client) {
super(Client, {
name: 'translate',
group: 'textedit',
@@ -15,35 +15,41 @@ module.exports = class TranslateCommand extends commando.Command {
}
async run(message) {
if(message.channel.type !== 'dm') {
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
}
console.log("[Command] " + message.content);
let [languageto] = message.content.toLowerCase().split(" ").slice(1);
let thingToTranslate = message.content.split(" ").slice(2).join(" ");
if(languageto === "list") {
if (languageto === "list") {
message.channel.send("af': 'Afrikaans\nsq': 'Albanian'\n'ar': 'Arabic\nhy': 'Armenian\naz': 'Azerbaijani\neu': 'Basque\nbe': 'Belarusian\nbn': 'Bengali\nbs': 'Bosnian\nbg': 'Bulgarian\nca': 'Catalan\nceb': 'Cebuano\nny': 'Chichewa\nzh-cn': 'Chinese Simplified\nzh-tw': 'Chinese Traditional\nco': 'Corsican\nhr': 'Croatian\ncs': 'Czech\nda': 'Danish\nnl': 'Dutch\nen': 'English\neo': 'Esperanto\net': 'Estonian\ntl': 'Filipino\nfi': 'Finnish\nfr': 'French\nfy': 'Frisian\ngl': 'Galician\nka': 'Georgian\nde': 'German\nel': 'Greek\ngu': 'Gujarati\nht': 'Haitian Creole\nha': 'Hausa\nhaw': 'Hawaiian\niw': 'Hebrew\nhi': 'Hindi\nhmn': 'Hmong\nhu': 'Hungarian\nis': 'Icelandic\nig': 'Igbo\nid': 'Indonesian\nga': 'Irish\nit': 'Italian\nja': 'Japanese\njw': 'Javanese\nkn': 'Kannada\nkk': 'Kazakh\nkm': 'Khmer\nko': 'Korean\nku': 'Kurdish (Kurmanji)\nky': 'Kyrgyz\nlo': 'Lao\nla': 'Latin\nlv': 'Latvian\nlt': 'Lithuanian\nlb': 'Luxembourgish\nmk': 'Macedonian\nmg': 'Malagasy\nms': 'Malay\nml': 'Malayalam\nmt': 'Maltese\nmi': 'Maori\nmr': 'Marathi\nmn': 'Mongolian\nmy': 'Myanmar (Burmese)\nne': 'Nepali\nno': 'Norwegian\nps': 'Pashto\nfa': 'Persian\npl': 'Polish\npt': 'Portuguese\nma': 'Punjabi\nro': 'Romanian\nru': 'Russian\nsm': 'Samoan\ngd': 'Scots Gaelic\nsr': 'Serbian\nst': 'Sesotho\nsn': 'Shona\nsd': 'Sindhi\nsi': 'Sinhala\nsk': 'Slovak\nsl': 'Slovenian\nso': 'Somali\nes': 'Spanish\nsu': 'Sudanese\nsw': 'Swahili\nsv': 'Swedish\ntg': 'Tajik\nta': 'Tamil\nte': 'Telugu\nth': 'Thai\ntr': 'Turkish\nuk': 'Ukrainian\nur': 'Urdu\nuz': 'Uzbek\nvi': 'Vietnamese\ncy': 'Welsh\nxh': 'Xhosa\nyi': 'Yiddish\nyo': 'Yoruba\nzu': 'Zulu'");
} else if(languages.entries[languageto]) {
if(thingToTranslate === "") {
}
else if (languages.entries[languageto]) {
if (thingToTranslate === "") {
message.channel.send(":x: Error! Nothing to translate!");
} else if(thingToTranslate.length > 200) {
}
else if (thingToTranslate.length > 200) {
message.channel.send(":x: Error! Please keep translations below 200 characters!");
} else {
translate(thingToTranslate, {to: languageto}).then(res => {
}
else {
translate(thingToTranslate, {
to: languageto
}).then(res => {
let languagefrom = res.from.language.iso.toLowerCase();
const embed = new Discord.RichEmbed()
.setColor(0x00AE86)
.addField('Input (From: ' + languages.entries[languagefrom] + '):',
thingToTranslate)
.addField('Translation (To: ' + languages.entries[languageto] + '):',
res.text);
.setColor(0x00AE86)
.addField('Input (From: ' + languages.entries[languagefrom] + '):',
thingToTranslate)
.addField('Translation (To: ' + languages.entries[languageto] + '):',
res.text);
message.channel.sendEmbed(embed).catch(console.error);
}).catch(err => {
message.channel.send(":x: Error! Something went wrong!");
});
}
} else {
}
else {
message.channel.send(":x: Error! Language not found! Use `;translate list` to view a list of translate codes!");
}
}
};
};
+25 -18
View File
@@ -3,7 +3,7 @@ const request = require('superagent');
const config = require('../../config.json');
module.exports = class YodaCommand extends commando.Command {
constructor(Client){
constructor(Client) {
super(Client, {
name: 'yoda',
group: 'textedit',
@@ -14,27 +14,34 @@ module.exports = class YodaCommand extends commando.Command {
}
async run(message) {
if(message.channel.type !== 'dm') {
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log("[Command] " + message.content);
let turnToYoda = message.content.split(" ").slice(1).join(" ");
if(turnToYoda === "") {
if (turnToYoda === "") {
message.channel.send(':x: Error! Nothing to translate!');
} else {
}
else {
request
.get('https://yoda.p.mashape.com/yoda')
.set({ 'X-Mashape-Key': config.mashapekey, 'Accept': 'text/plain' })
.query({ sentence: turnToYoda })
.then(function (response) {
if(response === undefined) {
message.channel.send(':x: Error! Something went wrong! Keep it simple to avoid this error.');
} else {
message.channel.send(response.text).catch(error => message.channel.send(':x: Error! Something went wrong! Keep it simple to avoid this error.'));
}
}).catch(function (err) {
message.channel.send(":x: Error! Unknown Error. Try again later!");
});
.get('https://yoda.p.mashape.com/yoda')
.set({
'X-Mashape-Key': config.mashapekey,
'Accept': 'text/plain'
})
.query({
sentence: turnToYoda
})
.then(function(response) {
if (response === undefined) {
message.channel.send(':x: Error! Something went wrong! Keep it simple to avoid this error.');
}
else {
message.channel.send(response.text).catch(error => message.channel.send(':x: Error! Something went wrong! Keep it simple to avoid this error.'));
}
}).catch(function(err) {
message.channel.send(":x: Error! Unknown Error. Try again later!");
});
}
}
};
};
+9 -7
View File
@@ -2,7 +2,7 @@ const commando = require('discord.js-commando');
const zalgo = require('zalgolize');
module.exports = class ZalgoCommand extends commando.Command {
constructor(Client){
constructor(Client) {
super(Client, {
name: 'zalgo',
group: 'textedit',
@@ -13,17 +13,19 @@ module.exports = class ZalgoCommand extends commando.Command {
}
async run(message) {
if(message.channel.type !== 'dm') {
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log("[Command] " + message.content);
let zalgoified = zalgo(message.content.split(" ").slice(1).join(" "));
if(zalgoified === '') {
if (zalgoified === '') {
message.channel.send(":x: Error! Nothing to zalgoify!");
} else if(zalgoified.length > 1950) {
}
else if (zalgoified.length > 1950) {
message.channel.send(":x: Error! Your message is too long!");
} else {
}
else {
message.channel.send(zalgoified);
}
}
};
};