mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-07 06:45:31 +02:00
Remove all useless async
This commit is contained in:
@@ -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!'));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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 "
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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!');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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!");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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’\n’sq': 'Albanian'\n'ar': 'Arabic’\n’hy': 'Armenian’\n’az': 'Azerbaijani’\n’eu': 'Basque’\n’be': 'Belarusian’\n’bn': 'Bengali’\n’bs': 'Bosnian’\n’bg': 'Bulgarian’\n’ca': 'Catalan’\n’ceb': 'Cebuano’\n’ny': 'Chichewa’\n’zh-cn': 'Chinese Simplified’\n’zh-tw': 'Chinese Traditional’\n’co': 'Corsican’\n’hr': 'Croatian’\n’cs': 'Czech’\n’da': 'Danish’\n’nl': 'Dutch’\n’en': 'English’\n’eo': 'Esperanto’\n’et': 'Estonian’\n’tl': 'Filipino’\n’fi': 'Finnish’\n’fr': 'French’\n’fy': 'Frisian’\n’gl': 'Galician’\n’ka': 'Georgian’\n’de': 'German’\n’el': 'Greek’\n’gu': 'Gujarati’\n’ht': 'Haitian Creole’\n’ha': 'Hausa’\n’haw': 'Hawaiian’\n’iw': 'Hebrew’\n’hi': 'Hindi’\n’hmn': 'Hmong’\n’hu': 'Hungarian’\n’is': 'Icelandic’\n’ig': 'Igbo’\n’id': 'Indonesian’\n’ga': 'Irish’\n’it': 'Italian’\n’ja': 'Japanese’\n’jw': 'Javanese’\n’kn': 'Kannada’\n’kk': 'Kazakh’\n’km': 'Khmer’\n’ko': 'Korean’\n’ku': 'Kurdish (Kurmanji)’\n’ky': 'Kyrgyz’\n’lo': 'Lao’\n’la': 'Latin’\n’lv': 'Latvian’\n’lt': 'Lithuanian’\n’lb': 'Luxembourgish’\n’mk': 'Macedonian’\n’mg': 'Malagasy’\n’ms': 'Malay’\n’ml': 'Malayalam’\n’mt': 'Maltese’\n’mi': 'Maori’\n’mr': 'Marathi’\n’mn': 'Mongolian’\n’my': 'Myanmar (Burmese)’\n’ne': 'Nepali’\n’no': 'Norwegian’\n’ps': 'Pashto’\n’fa': 'Persian’\n’pl': 'Polish’\n’pt': 'Portuguese’\n’ma': 'Punjabi’\n’ro': 'Romanian’\n’ru': 'Russian’\nsm': 'Samoan’\n’gd': 'Scots Gaelic’\n’sr': 'Serbian’\n’st': 'Sesotho’\n’sn': 'Shona’\n’sd': 'Sindhi’\n’si': 'Sinhala’\n’sk': 'Slovak’\n’sl': 'Slovenian’\n’so': 'Somali’\n’es': 'Spanish’\n’su': 'Sudanese’\n’sw': 'Swahili’\n’sv': 'Swedish’\n’tg': 'Tajik’\n’ta': 'Tamil’\n’te': 'Telugu’\n’th': 'Thai’\n’tr': 'Turkish’\n’uk': 'Ukrainian’\n’ur': 'Urdu’\n’uz': 'Uzbek’\n’vi': 'Vietnamese’\n’cy': 'Welsh’\n’xh': 'Xhosa’\n’yi': 'Yiddish’\n’yo': 'Yoruba’\n’zu': 'Zulu'");
|
||||
return message.channel.send("‘af': 'Afrikaans’\n’sq': 'Albanian'\n'ar': 'Arabic’\n’hy': 'Armenian’\n’az': 'Azerbaijani’\n’eu': 'Basque’\n’be': 'Belarusian’\n’bn': 'Bengali’\n’bs': 'Bosnian’\n’bg': 'Bulgarian’\n’ca': 'Catalan’\n’ceb': 'Cebuano’\n’ny': 'Chichewa’\n’zh-cn': 'Chinese Simplified’\n’zh-tw': 'Chinese Traditional’\n’co': 'Corsican’\n’hr': 'Croatian’\n’cs': 'Czech’\n’da': 'Danish’\n’nl': 'Dutch’\n’en': 'English’\n’eo': 'Esperanto’\n’et': 'Estonian’\n’tl': 'Filipino’\n’fi': 'Finnish’\n’fr': 'French’\n’fy': 'Frisian’\n’gl': 'Galician’\n’ka': 'Georgian’\n’de': 'German’\n’el': 'Greek’\n’gu': 'Gujarati’\n’ht': 'Haitian Creole’\n’ha': 'Hausa’\n’haw': 'Hawaiian’\n’iw': 'Hebrew’\n’hi': 'Hindi’\n’hmn': 'Hmong’\n’hu': 'Hungarian’\n’is': 'Icelandic’\n’ig': 'Igbo’\n’id': 'Indonesian’\n’ga': 'Irish’\n’it': 'Italian’\n’ja': 'Japanese’\n’jw': 'Javanese’\n’kn': 'Kannada’\n’kk': 'Kazakh’\n’km': 'Khmer’\n’ko': 'Korean’\n’ku': 'Kurdish (Kurmanji)’\n’ky': 'Kyrgyz’\n’lo': 'Lao’\n’la': 'Latin’\n’lv': 'Latvian’\n’lt': 'Lithuanian’\n’lb': 'Luxembourgish’\n’mk': 'Macedonian’\n’mg': 'Malagasy’\n’ms': 'Malay’\n’ml': 'Malayalam’\n’mt': 'Maltese’\n’mi': 'Maori’\n’mr': 'Marathi’\n’mn': 'Mongolian’\n’my': 'Myanmar (Burmese)’\n’ne': 'Nepali’\n’no': 'Norwegian’\n’ps': 'Pashto’\n’fa': 'Persian’\n’pl': 'Polish’\n’pt': 'Portuguese’\n’ma': 'Punjabi’\n’ro': 'Romanian’\n’ru': 'Russian’\nsm': 'Samoan’\n’gd': 'Scots Gaelic’\n’sr': 'Serbian’\n’st': 'Sesotho’\n’sn': 'Shona’\n’sd': 'Sindhi’\n’si': 'Sinhala’\n’sk': 'Slovak’\n’sl': 'Slovenian’\n’so': 'Somali’\n’es': 'Spanish’\n’su': 'Sudanese’\n’sw': 'Swahili’\n’sv': 'Swedish’\n’tg': 'Tajik’\n’ta': 'Tamil’\n’te': 'Telugu’\n’th': 'Thai’\n’tr': 'Turkish’\n’uk': 'Ukrainian’\n’ur': 'Urdu’\n’uz': 'Uzbek’\n’vi': 'Vietnamese’\n’cy': 'Welsh’\n’xh': 'Xhosa’\n’yi': 'Yiddish’\n’yo': 'Yoruba’\n’zu': '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!");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user