From 7d1b54b5e68b7ba339cea49c0f633f53885d2ba8 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Thu, 23 Mar 2017 13:39:50 +0000 Subject: [PATCH] Remove tons of faulty awaits --- commands/search/botinfo.js | 2 +- commands/search/define.js | 2 +- commands/search/forecast.js | 2 +- commands/search/google.js | 2 +- commands/search/image.js | 2 +- commands/search/osu.js | 2 +- commands/search/wattpad.js | 2 +- commands/search/weather.js | 2 +- commands/search/wikipedia.js | 2 +- commands/search/youtube.js | 2 +- commands/search/yugioh.js | 2 +- commands/textedit/rin.js | 2 +- commands/textedit/translate.js | 2 +- commands/textedit/yoda.js | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/commands/search/botinfo.js b/commands/search/botinfo.js index 23e6c1c4..e9398dff 100644 --- a/commands/search/botinfo.js +++ b/commands/search/botinfo.js @@ -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 diff --git a/commands/search/define.js b/commands/search/define.js index 2ab77ed4..7c76e2b7 100644 --- a/commands/search/define.js +++ b/commands/search/define.js @@ -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, diff --git a/commands/search/forecast.js b/commands/search/forecast.js index bff55acf..01871829 100644 --- a/commands/search/forecast.js +++ b/commands/search/forecast.js @@ -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') diff --git a/commands/search/google.js b/commands/search/google.js index a0994d95..34a43a77 100644 --- a/commands/search/google.js +++ b/commands/search/google.js @@ -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); diff --git a/commands/search/image.js b/commands/search/image.js index dd1baffc..ef0f2882 100644 --- a/commands/search/image.js +++ b/commands/search/image.js @@ -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); diff --git a/commands/search/osu.js b/commands/search/osu.js index e9fc7899..9d687985 100644 --- a/commands/search/osu.js +++ b/commands/search/osu.js @@ -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, diff --git a/commands/search/wattpad.js b/commands/search/wattpad.js index 87a6e985..06832770 100644 --- a/commands/search/wattpad.js +++ b/commands/search/wattpad.js @@ -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}` diff --git a/commands/search/weather.js b/commands/search/weather.js index 4a092bb3..e99bf602 100644 --- a/commands/search/weather.js +++ b/commands/search/weather.js @@ -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') diff --git a/commands/search/wikipedia.js b/commands/search/wikipedia.js index a5d95766..266b5135 100644 --- a/commands/search/wikipedia.js +++ b/commands/search/wikipedia.js @@ -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; diff --git a/commands/search/youtube.js b/commands/search/youtube.js index accb0244..aa3fddbd 100644 --- a/commands/search/youtube.js +++ b/commands/search/youtube.js @@ -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', diff --git a/commands/search/yugioh.js b/commands/search/yugioh.js index 6c9dc19b..50821e24 100644 --- a/commands/search/yugioh.js +++ b/commands/search/yugioh.js @@ -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') { diff --git a/commands/textedit/rin.js b/commands/textedit/rin.js index 1eb2c236..f10ae73a 100644 --- a/commands/textedit/rin.js +++ b/commands/textedit/rin.js @@ -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 diff --git a/commands/textedit/translate.js b/commands/textedit/translate.js index 702f8276..d3e39187 100644 --- a/commands/textedit/translate.js +++ b/commands/textedit/translate.js @@ -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(); diff --git a/commands/textedit/yoda.js b/commands/textedit/yoda.js index 92354ed8..cbdd5f86 100644 --- a/commands/textedit/yoda.js +++ b/commands/textedit/yoda.js @@ -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,