mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 06:42:51 +02:00
Better Validators and More Destucturing
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user