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
+3 -3
View File
@@ -43,14 +43,14 @@ module.exports = class BotSearchCommand extends commando.Command {
response.body.prefix, true)
.addField('**Invite:**',
`[Here](${response.body.invite_url})`, true);
message.channel.sendEmbed(embed);
return message.channel.sendEmbed(embed);
}
catch (err) {
message.channel.send(":x: Error! Bot not Found!");
return message.channel.send(":x: Error! Bot not Found!");
}
}
else {
message.channel.send(':x: Error! Please mention one bot!');
return message.channel.send(':x: Error! Please mention one bot!');
}
}
};
+2 -2
View File
@@ -40,10 +40,10 @@ module.exports = class DefineCommand extends commando.Command {
.setColor(0x9797FF)
.setTitle(response.body[0].word)
.setDescription(response.body[0].text);
message.channel.sendEmbed(embed);
return message.channel.sendEmbed(embed);
}
catch (err) {
message.channel.send(":x: Error! Word not Found!");
return message.channel.send(":x: Error! Word not Found!");
}
}
};
+2 -2
View File
@@ -27,10 +27,10 @@ module.exports = class DiscrimCommand extends commando.Command {
const embed = new Discord.RichEmbed()
.setTitle(`${users.length} Users with the discriminator: ${userToSearch}`)
.setDescription(users.join(', '));
message.channel.sendEmbed(embed);
return message.channel.sendEmbed(embed);
}
else {
message.channel.send(':x: Error! This discriminator is invalid!');
return message.channel.send(':x: Error! This discriminator is invalid!');
}
}
};
+2 -2
View File
@@ -43,10 +43,10 @@ module.exports = class ForecastCommand extends commando.Command {
`**High:** ${info.item.forecast[5].high}°F, **Low:** ${info.item.forecast[5].low}°F, **Condition:** ${info.item.forecast[5].text}`)
.addField(`**${info.item.forecast[6].day} - ${info.item.forecast[6].date}:**`,
`**High:** ${info.item.forecast[6].high}°F, **Low:** ${info.item.forecast[6].low}°F, **Condition:** ${info.item.forecast[6].text}`);
message.channel.sendEmbed(embed);
return message.channel.sendEmbed(embed);
}
catch (err) {
message.channel.send(":x: Error! Make sure you typed the location correctly!");
return message.channel.send(":x: Error! Make sure you typed the location correctly!");
}
}
};
+2 -2
View File
@@ -31,10 +31,10 @@ module.exports = class DefineCommand extends commando.Command {
let href = $('.r').first().find('a').first().attr('href');
if (!href) return Promise.reject(new Error('NO RESULTS'));
href = querystring.parse(href.replace('/url?', ''));
searchMsg.edit(href.q);
return searchMsg.edit(href.q);
}
catch (err) {
searchMsg.edit(':x: Error! No Results Found!');
return searchMsg.edit(':x: Error! No Results Found!');
}
}
};
+2 -2
View File
@@ -29,10 +29,10 @@ module.exports = class DefineCommand extends commando.Command {
.get(`https://www.google.com/search?tbm=isch&gs_l=img&q=${encodeURI(thingToSearch)}`);
const $ = cheerio.load(response.text);
const result = $('.images_table').find('img').first().attr('src');
searchMsg.edit(result);
return searchMsg.edit(result);
}
catch (err) {
searchMsg.edit(':x: Error! No Results Found!');
return searchMsg.edit(':x: Error! No Results Found!');
}
}
};
+1 -1
View File
@@ -18,7 +18,7 @@ module.exports = class IMDBCommand 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;
}
+9 -4
View File
@@ -18,12 +18,17 @@ module.exports = class NeopetCommand extends commando.Command {
console.log(`[Command] ${message.content}`);
let petID = encodeURI(message.content.toLowerCase().split(" ").slice(1).join(" "));
if (petID === "getid") {
let petIDMsg = await message.channel.send("To get your pet's ID, simply go to http://www.sunnyneo.com/petimagefinder.php and enter your pet's name. It's image should show up. Then, find the link below the pet's image, and copy it to your message!");
let petIDMsg2 = await message.channel.sendFile('./images/PetID.png');
let petIDMsg3 = await message.channel.send("It's recommended you keep this ID with you so you can easily share your pet's picture without having to repeat these steps.");
let petIDMsg = await message.channel.send("To get your pet's ID, simply go to http://www.sunnyneo.com/petimagefinder.php and enter your pet's name. It's image should show up. Then, find the link below the pet's image, and copy it to your message! It's recommended you keep this ID with you so you can easily share your pet's picture without having to repeat these steps.");
return message.channel.sendFile('./images/PetID.png');
}
else {
message.channel.send(`Result for: ${petID}`).then(message.channel.sendFile(`http://pets.neopets.com/cp/${petID}/1/5.png`).catch(error => message.channel.send(":x: Error! Pet ID Not Found! Use `;neopet getID` for help on getting your pet ID.")));
try {
let petMsg = await message.channel.send(`Result for: ${petID}`);
return message.channel.sendFile(`http://pets.neopets.com/cp/${petID}/1/5.png`);
}
catch (err) {
return message.channel.send(":x: Error! Pet ID Not Found! Use `;neopet getID` for help on getting your pet ID.");
}
}
}
};
+3 -3
View File
@@ -34,7 +34,7 @@ module.exports = class OsuCommand extends commando.Command {
type: 'string'
});
if (!response.body[0]) {
message.channel.send(":x: Error! User not found!");
return message.channel.send(":x: Error! User not found!");
}
else {
const embed = new Discord.RichEmbed()
@@ -65,11 +65,11 @@ module.exports = class OsuCommand extends commando.Command {
response.body[0].count_rank_s, true)
.addField('**A:**',
response.body[0].count_rank_a, true);
message.channel.sendEmbed(embed);
return message.channel.sendEmbed(embed);
}
}
catch (err) {
message.channel.send(":x: Error! User not Found!");
return message.channel.send(":x: Error! User not Found!");
}
}
};
+3 -3
View File
@@ -16,7 +16,7 @@ module.exports = class PokedexCommand 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;
}
@@ -34,10 +34,10 @@ module.exports = class PokedexCommand extends commando.Command {
pokedex.entry[pokemon])
.addField('Type',
pokedex.type[pokemon]);
message.channel.sendEmbed(embed).catch(console.error);
return message.channel.sendEmbed(embed);
}
else {
message.channel.send(":x: This Pokémon either doesn't exist, or isn't implemented yet.");
return message.channel.send(":x: This Pokémon either doesn't exist, or isn't implemented yet.");
}
}
};
+5 -5
View File
@@ -18,7 +18,7 @@ module.exports = class UrbanDictionary 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;
}
@@ -26,10 +26,10 @@ module.exports = class UrbanDictionary extends commando.Command {
let wordToDefine = message.content.split(" ").slice(1).join(" ");
urban(wordToDefine).first(function(response) {
if (!response) {
message.channel.send(":x: Error! Word not found!");
return message.channel.send(":x: Error! Word not found!");
}
else if (!response.definition) {
message.channel.send(":x: Error! Word has no definition!");
return message.channel.send(":x: Error! Word has no definition!");
}
else if (response.example) {
const embed = new Discord.RichEmbed()
@@ -40,7 +40,7 @@ module.exports = class UrbanDictionary extends commando.Command {
.setDescription(`${response.definition.substr(0, 1900)} [Read the Rest Here!](${response.permalink})`)
.addField('**Example:**',
response.example.substr(0, 1900));
message.channel.sendEmbed(embed);
return message.channel.sendEmbed(embed);
}
else {
const embed = new Discord.RichEmbed()
@@ -49,7 +49,7 @@ module.exports = class UrbanDictionary extends commando.Command {
.setURL(response.permalink)
.setTitle(response.word)
.setDescription(`${response.definition.substr(0, 1900)} [Read the Rest Here!](${response.permalink})`);
message.channel.sendEmbed(embed);
return message.channel.sendEmbed(embed);
}
});
}
+2 -2
View File
@@ -48,10 +48,10 @@ module.exports = class WattpadCommand extends commando.Command {
response.body.stories[0].readCount, true)
.addField('**Comments:**',
response.body.stories[0].commentCount, true);
message.channel.sendEmbed(embed);
return message.channel.sendEmbed(embed);
}
catch (err) {
message.channel.send(":x: Error! Book not Found!");
return message.channel.send(":x: Error! Book not Found!");
}
}
};
+2 -2
View File
@@ -50,10 +50,10 @@ module.exports = class WeatherCommand extends commando.Command {
info.wind.direction, true)
.addField('**Wind Speed:**',
info.wind.speed, true);
message.channel.sendEmbed(embed);
return message.channel.sendEmbed(embed);
}
catch (err) {
message.channel.send(":x: Error! Make sure you typed the location correctly!");
return message.channel.send(":x: Error! Make sure you typed the location correctly!");
}
}
};
+3 -3
View File
@@ -26,7 +26,7 @@ module.exports = class WikipediaCommand extends commando.Command {
let description = response.body.query.pages[0].extract;
let name = response.body.query.pages[0].title;
if (!description) {
message.channel.send(":x: Error! Entry Not Found!");
return message.channel.send(":x: Error! Entry Not Found!");
}
else {
description = description.substr(0, 1900);
@@ -37,11 +37,11 @@ module.exports = class WikipediaCommand extends commando.Command {
.setURL(`https://en.wikipedia.org/wiki/${thingToSearch}`)
.setAuthor("Wikipedia", "https://upload.wikimedia.org/wikipedia/en/thumb/8/80/Wikipedia-logo-v2.svg/1122px-Wikipedia-logo-v2.svg.png")
.setDescription(`${description} [Read the Rest Here](https://en.wikipedia.org/wiki/${thingToSearch})`);
message.channel.sendEmbed(embed);
return message.channel.sendEmbed(embed);
}
}
catch (err) {
message.channel.send(":x: Error! Entry Not Found!");
return message.channel.send(":x: Error! Entry Not Found!");
}
}
};
+3 -3
View File
@@ -34,7 +34,7 @@ module.exports = class YouTubeCommand extends commando.Command {
key: config.youtubekey
});
if (!response.body.items[0].snippet) {
message.channel.send(':x: Error! No Video Found!');
return message.channel.send(':x: Error! No Video Found!');
}
else {
const embed = new Discord.RichEmbed()
@@ -44,11 +44,11 @@ module.exports = class YouTubeCommand extends commando.Command {
.setAuthor(`YouTube - ${response.body.items[0].snippet.channelTitle}`, 'https://cdn3.iconfinder.com/data/icons/social-icons-5/607/YouTube_Play.png')
.setURL(`https://www.youtube.com/watch?v=${response.body.items[0].id.videoId}`)
.setThumbnail(response.body.items[0].snippet.thumbnails.default.url);
message.channel.sendEmbed(embed);
return message.channel.sendEmbed(embed);
}
}
catch (err) {
message.channel.send(":x: Error! An error has occurred! Try again later! (If this continues to occur, the daily quota may have been reached).");
return message.channel.send(":x: Error! An error has occurred! Try again later! (If this continues to occur, the daily quota may have been reached).");
}
}
};
+3 -3
View File
@@ -40,7 +40,7 @@ module.exports = class YuGiOhCommand extends commando.Command {
response.body.data.def, true)
.addField('**Level:**',
response.body.data.level, true);
message.channel.sendEmbed(embed);
return message.channel.sendEmbed(embed);
}
else {
const embed = new Discord.RichEmbed()
@@ -50,11 +50,11 @@ module.exports = class YuGiOhCommand extends commando.Command {
.setAuthor('Yu-Gi-Oh!', 'http://vignette3.wikia.nocookie.net/yugioh/images/1/10/Back-TF-EN-VG.png/revision/latest?cb=20120824043558')
.addField('**Card Type:**',
response.body.data.card_type, true);
message.channel.sendEmbed(embed);
return message.channel.sendEmbed(embed);
}
}
catch (err) {
message.channel.send(":x: Error! Card not Found!\n:notepad_spiral: Note: This command is **extremely** sensitive to casing and dashes and whatnot. Type the *exact* card name to get data!");
return message.channel.send(":x: Error! Card not Found!\n:notepad_spiral: Note: This command is **extremely** sensitive to casing and dashes and whatnot. Type the *exact* card name to get data!");
}
}
};