Remove all useless async

This commit is contained in:
Daniel Odendahl Jr
2017-03-24 12:16:58 +00:00
parent 33b7d18d54
commit 0ce7eb3ee1
95 changed files with 287 additions and 287 deletions
+2 -2
View File
@@ -12,12 +12,12 @@ module.exports = class BinaryCommand extends commando.Command {
});
}
async run(message) {
run(message) {
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!'));
return message.channel.send(stringToBinary(turnToBinary)).catch(error => message.channel.send(':x: Error! Translation is too long, or nothing was entered!'));
}
};
+3 -3
View File
@@ -12,17 +12,17 @@ module.exports = class CowsayCommand extends commando.Command {
});
}
async run(message) {
run(message) {
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(" ")) {
message.channel.send(":x: Error! You entered nothing!");
return message.channel.send(":x: Error! You entered nothing!");
}
else {
let turnToCowsay = message.content.split(" ").slice(1).join(" ");
message.channel.sendCode(null, cowsay.say({
return message.channel.sendCode(null, cowsay.say({
text: turnToCowsay,
e: "oO",
T: "U "
+4 -4
View File
@@ -12,14 +12,14 @@ module.exports = class EmbedCommand extends commando.Command {
});
}
async run(message) {
run(message) {
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) {
message.channel.send(":x: Error! Nothing to embed!");
return message.channel.send(":x: Error! Nothing to embed!");
}
else {
if (message.channel.type === 'dm') {
@@ -28,7 +28,7 @@ module.exports = class EmbedCommand extends commando.Command {
.setColor(0x00AE86)
.setTimestamp()
.setDescription(embedMessage);
message.channel.sendEmbed(embed).catch(console.error);
return message.channel.sendEmbed(embed);
}
else {
const embed = new Discord.RichEmbed()
@@ -37,7 +37,7 @@ module.exports = class EmbedCommand extends commando.Command {
.setTimestamp()
.setDescription(embedMessage);
message.delete();
message.channel.sendEmbed(embed).catch(console.error);
return message.channel.sendEmbed(embed);
}
}
}
+5 -5
View File
@@ -15,7 +15,7 @@ module.exports = class MorseCommand extends commando.Command {
});
}
async run(message) {
run(message) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
@@ -23,16 +23,16 @@ module.exports = class MorseCommand extends commando.Command {
let [methodToUse] = message.content.toLowerCase().split(" ").slice(1);
let toMorse = message.content.split(" ").slice(2).join(" ");
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.");
return 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') {
message.channel.send(morse.encode(toMorse)).catch(error => message.channel.send(':x: Error! Something went wrong! Perhaps you entered incorrect text?'));
return 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') {
message.channel.send(morse.decode(toMorse)).catch(error => message.channel.send(':x: Error! Something went wrong! Perhaps you entered incorrect text?'));
return message.channel.send(morse.decode(toMorse)).catch(error => message.channel.send(':x: Error! Something went wrong! Perhaps you entered incorrect text?'));
}
else {
message.channel.send(":x: Error! Method not set/not correct! Use either encode or decode.");
return message.channel.send(":x: Error! Method not set/not correct! Use either encode or decode.");
}
}
};
+4 -4
View File
@@ -16,7 +16,7 @@ module.exports = class PirateCommand extends commando.Command {
});
}
async run(message) {
run(message) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
@@ -24,14 +24,14 @@ module.exports = class PirateCommand extends commando.Command {
let turnToPirate = message.content.split(" ").slice(1).join(" ");
let pirate = pirateSpeak.translate(turnToPirate);
if (!turnToPirate) {
message.channel.send(":x: Error! Nothing to translate!");
return message.channel.send(":x: Error! Nothing to translate!");
}
else {
if (pirate.length > 1950) {
message.channel.send(":x: Error! Your message is too long!");
return message.channel.send(":x: Error! Your message is too long!");
}
else {
message.channel.send(pirate);
return message.channel.send(pirate);
}
}
}
+3 -3
View File
@@ -11,18 +11,18 @@ module.exports = class ReverseCommand extends commando.Command {
});
}
async run(message) {
run(message) {
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) {
message.channel.send(":x: Error! Nothing to reverse!");
return message.channel.send(":x: Error! Nothing to reverse!");
}
else {
let reversed = stringToReverse.split("").reverse().join("");
message.channel.send(reversed);
return message.channel.send(reversed);
}
}
};
+2 -2
View File
@@ -32,11 +32,11 @@ module.exports = class RinSayCommand extends commando.Command {
content: rinContent
});
if (message.content.type !== 'dm') {
message.delete();
return message.delete();
}
}
catch (err) {
message.channel.send(':x: Error! Message failed to send!');
return message.channel.send(':x: Error! Message failed to send!');
}
}
};
+4 -4
View File
@@ -15,7 +15,7 @@ module.exports = class RomajiCommand extends commando.Command {
});
}
async run(message) {
run(message) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
@@ -24,14 +24,14 @@ module.exports = class RomajiCommand extends commando.Command {
if (hepburn.containsKana(romajify)) {
let romajified = hepburn.fromKana(romajify);
if (romajified.length > 1950) {
message.channel.send(":x: Error! Your message is too long!");
return message.channel.send(":x: Error! Your message is too long!");
}
else {
message.channel.send(romajified);
return message.channel.send(romajified);
}
}
else {
message.channel.send(":x: Error! Message contains no Kana!\n:notepad_spiral: Note: You cannot use this command on Kanji!");
return message.channel.send(":x: Error! Message contains no Kana!\n:notepad_spiral: Note: You cannot use this command on Kanji!");
}
}
};
+4 -4
View File
@@ -17,22 +17,22 @@ module.exports = class SayCommand extends commando.Command {
});
}
async run(message) {
run(message) {
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) {
message.channel.send(":x: Error! Nothing to say!");
return message.channel.send(":x: Error! Nothing to say!");
}
else {
if (message.channel.type === 'dm') {
message.channel.send(copycat);
return message.channel.send(copycat);
}
else {
message.delete();
message.channel.send(copycat);
return message.channel.send(copycat);
}
}
}
+3 -3
View File
@@ -23,17 +23,17 @@ module.exports = class ShuffleCommand extends commando.Command {
});
}
async run(message) {
run(message) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let thingToShuffle = message.content.split(" ").slice(1).join(" ");
if (!thingToShuffle) {
message.channel.send(":x: Error! Nothing to shuffle!");
return message.channel.send(":x: Error! Nothing to shuffle!");
}
else {
message.channel.send(thingToShuffle.shuffle());
return message.channel.send(thingToShuffle.shuffle());
}
}
};
+3 -3
View File
@@ -298,18 +298,18 @@ module.exports = class TemmieCommand extends commando.Command {
});
}
async run(message) {
run(message) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let thingToTranslate = message.content.split(" ").slice(1).join(" ");
if (!thingToTranslate) {
message.channel.send(':x: Error! Nothing to translate!');
return message.channel.send(':x: Error! Nothing to translate!');
}
else {
let temmized = temmize(thingToTranslate);
message.channel.send(temmized);
return message.channel.send(temmized);
}
}
};
+6 -6
View File
@@ -128,14 +128,14 @@ module.exports = class TranslateCommand extends commando.Command {
let [languageto] = message.content.toLowerCase().split(" ").slice(1);
let thingToTranslate = message.content.split(" ").slice(2).join(" ");
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'");
return 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[languageto]) {
if (!thingToTranslate) {
message.channel.send(":x: Error! Nothing to translate!");
return message.channel.send(":x: Error! Nothing to translate!");
}
else if (thingToTranslate.length > 200) {
message.channel.send(":x: Error! Please keep translations below 200 characters!");
return message.channel.send(":x: Error! Please keep translations below 200 characters!");
}
else {
try {
@@ -149,15 +149,15 @@ module.exports = class TranslateCommand extends commando.Command {
thingToTranslate)
.addField(`Translation (To: ${languages[languageto]}):`,
res.text);
message.channel.sendEmbed(embed).catch(console.error);
return message.channel.sendEmbed(embed);
}
catch (err) {
message.channel.send(":x: Error! Something went wrong!");
return message.channel.send(":x: Error! Something went wrong!");
}
}
}
else {
message.channel.send(":x: Error! Language not found! Use `;translate list` to view a list of translate codes!");
return message.channel.send(":x: Error! Language not found! Use `;translate list` to view a list of translate codes!");
}
}
};
+4 -4
View File
@@ -20,7 +20,7 @@ module.exports = class YodaCommand extends commando.Command {
console.log(`[Command] ${message.content}`);
let turnToYoda = message.content.split(" ").slice(1).join(" ");
if (!turnToYoda) {
message.channel.send(':x: Error! Nothing to translate!');
return message.channel.send(':x: Error! Nothing to translate!');
}
else {
try {
@@ -34,14 +34,14 @@ module.exports = class YodaCommand extends commando.Command {
sentence: turnToYoda
});
if (!response) {
message.channel.send(':x: Error! Something went wrong! Keep it simple to avoid this error.');
return message.channel.send(':x: Error! Something went wrong! Keep it simple to avoid this error.');
}
else {
message.channel.send(response.text);
return message.channel.send(response.text);
}
}
catch (err) {
message.channel.send(":x: Error! Something went wrong!");
return message.channel.send(":x: Error! Something went wrong!");
}
}
}
+4 -4
View File
@@ -12,20 +12,20 @@ module.exports = class ZalgoCommand extends commando.Command {
});
}
async run(message) {
run(message) {
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) {
message.channel.send(":x: Error! Nothing to zalgoify!");
return message.channel.send(":x: Error! Nothing to zalgoify!");
}
else if (zalgoified.length > 1950) {
message.channel.send(":x: Error! Your message is too long!");
return message.channel.send(":x: Error! Your message is too long!");
}
else {
message.channel.send(zalgoified);
return message.channel.send(zalgoified);
}
}
};