Remove tons of faulty awaits

This commit is contained in:
Daniel Odendahl Jr
2017-03-23 13:39:50 +00:00
parent 29ac65d220
commit 7d1b54b5e6
14 changed files with 14 additions and 14 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ module.exports = class BotSearchCommand extends commando.Command {
console.log(`[Command] ${message.content}`);
if (message.mentions.users.size === 1) {
let botToFind = message.mentions.users.first().id;
await request
return request
.get(`https://bots.discord.pw/api/bots/${botToFind}`)
.set({
'Authorization': config.botskey
+1 -1
View File
@@ -26,7 +26,7 @@ module.exports = class DefineCommand extends commando.Command {
}
console.log(`[Command] ${message.content}`);
let defineThis = encodeURI(message.content.split(" ").slice(1).join(" "));
await request
return request
.get(`http://api.wordnik.com:80/v4/word.json/${defineThis}/definitions`)
.query({
limit: 1,
+1 -1
View File
@@ -22,7 +22,7 @@ module.exports = class ForecastCommand extends commando.Command {
}
console.log(`[Command] ${message.content}`);
let locationToSearch = message.content.split(" ").slice(1).join(" ");
await weather(locationToSearch, 'f').then(info => {
return weather(locationToSearch, 'f').then(info => {
const embed = new Discord.RichEmbed()
.setColor(0x0000FF)
.setAuthor(info.title, 'http://media.idownloadblog.com/wp-content/uploads/2013/12/yahoo-weather-213x220.png')
+1 -1
View File
@@ -24,7 +24,7 @@ module.exports = class DefineCommand extends commando.Command {
console.log(`[Command] ${message.content}`);
let thingToSearch = encodeURI(message.content.split(" ").slice(1).join(" "));
await message.channel.send('Searching...').then(msg => {
await request
return request
.get(`https://www.google.com/search?q=${thingToSearch}`)
.then(function(response) {
const $ = cheerio.load(response.text);
+1 -1
View File
@@ -24,7 +24,7 @@ module.exports = class DefineCommand extends commando.Command {
console.log(`[Command] ${message.content}`);
let thingToSearch = encodeURI(message.content.split(" ").slice(1).join(" "));
await message.channel.send('Searching...').then(msg => {
await request
return request
.get(`https://www.google.com/search?tbm=isch&gs_l=img&q=${encodeURI(thingToSearch)}`)
.then(function(response) {
const $ = cheerio.load(response.text);
+1 -1
View File
@@ -25,7 +25,7 @@ module.exports = class OsuCommand extends commando.Command {
}
console.log(`[Command] ${message.content}`);
let usernameToSearch = message.content.split(" ").slice(1).join(" ");
await request
return request
.get('https://osu.ppy.sh/api/get_user')
.query({
k: config.osukey,
+1 -1
View File
@@ -20,7 +20,7 @@ module.exports = class WattpadCommand extends commando.Command {
}
console.log(`[Command] ${message.content}`);
let queryBook = message.content.split(" ").slice(1).join(" ");
await request
return request
.get('https://api.wattpad.com:443/v4/stories')
.set({
'Authorization': `Basic ${config.wattpadkey}`
+1 -1
View File
@@ -19,7 +19,7 @@ module.exports = class WeatherCommand extends commando.Command {
}
console.log(`[Command] ${message.content}`);
let locationToSearch = message.content.split(" ").slice(1).join(" ");
await weather(locationToSearch, 'f').then(info => {
return weather(locationToSearch, 'f').then(info => {
const embed = new Discord.RichEmbed()
.setColor(0x0000FF)
.setAuthor(info.title, 'http://media.idownloadblog.com/wp-content/uploads/2013/12/yahoo-weather-213x220.png')
+1 -1
View File
@@ -20,7 +20,7 @@ module.exports = class WikipediaCommand extends commando.Command {
console.log(`[Command] ${message.content}`);
let thingToSearch = encodeURI(message.content.split(" ").slice(1).join(" "));
thingToSearch = thingToSearch.split(")").join("%29");
await request
return request
.get(`https://en.wikipedia.org/w/api.php?action=query&prop=extracts&format=json&titles=${thingToSearch}&exintro=&explaintext=&redirects=&formatversion=2`)
.then(function(response) {
let description = response.body.query.pages[0].extract;
+1 -1
View File
@@ -23,7 +23,7 @@ module.exports = class YouTubeCommand extends commando.Command {
}
console.log(`[Command] ${message.content}`);
let videoToSearch = message.content.split(" ").slice(1).join("-");
await request
return request
.get('https://www.googleapis.com/youtube/v3/search')
.query({
part: 'snippet',
+1 -1
View File
@@ -19,7 +19,7 @@ module.exports = class YuGiOhCommand extends commando.Command {
}
console.log(`[Command] ${message.content}`);
let cardName = encodeURI(message.content.split(" ").slice(1).join(" "));
await request
return request
.get(`http://yugiohprices.com/api/card_data/${cardName}`)
.then(function(response) {
if (response.body.data.card_type === 'monster') {
+1 -1
View File
@@ -25,7 +25,7 @@ module.exports = class RinSayCommand extends commando.Command {
}
console.log(`[Command] ${message.content}`);
let rinContent = message.content.split(" ").slice(1).join(" ");
await request
return request
.post(config.webhook)
.send({
content: rinContent
+1 -1
View File
@@ -138,7 +138,7 @@ module.exports = class TranslateCommand extends commando.Command {
return message.channel.send(":x: Error! Please keep translations below 200 characters!");
}
else {
await translate(thingToTranslate, {
return translate(thingToTranslate, {
to: languageto
}).then(res => {
let languagefrom = res.from.language.iso.toLowerCase();
+1 -1
View File
@@ -23,7 +23,7 @@ module.exports = class YodaCommand extends commando.Command {
return message.channel.send(':x: Error! Nothing to translate!');
}
else {
await request
return request
.get('https://yoda.p.mashape.com/yoda')
.set({
'X-Mashape-Key': config.mashapekey,