Better Validators and More Destucturing

This commit is contained in:
Daniel Odendahl Jr
2017-04-19 18:55:26 +00:00
parent c064401b37
commit d77f71b66a
40 changed files with 114 additions and 124 deletions
+2 -2
View File
@@ -32,9 +32,9 @@ module.exports = class GoogleCommand extends Command {
const { query } = args;
const msg = await message.say('Searching...');
try {
const response = await request
const { text } = await request
.get(`https://www.google.com/search?q=${query}`);
const $ = cheerio.load(response.text);
const $ = cheerio.load(text);
let href = $('.r').first().find('a').first().attr('href');
href = querystring.parse(href.replace('/url?', ''));
return msg.edit(href.q);