mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-05 00:06:42 +02:00
Remove Google Command
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const snekfetch = require('snekfetch');
|
||||
const cheerio = require('cheerio');
|
||||
const querystring = require('querystring');
|
||||
|
||||
module.exports = class GoogleCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'google',
|
||||
group: 'search',
|
||||
memberName: 'google',
|
||||
description: 'Searches Google for your query.',
|
||||
args: [
|
||||
{
|
||||
key: 'query',
|
||||
prompt: 'What would you like to search for?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
const { query } = args;
|
||||
const message = await msg.say('Searching...');
|
||||
try {
|
||||
const { text } = await snekfetch
|
||||
.get('https://www.google.com/search')
|
||||
.query({ q: query });
|
||||
const $ = cheerio.load(text);
|
||||
let href = $('.r').first().find('a').first().attr('href');
|
||||
if (!href) throw new Error('No Results');
|
||||
href = querystring.parse(href.replace('/url?', ''));
|
||||
return message.edit(href.q);
|
||||
} catch (err) {
|
||||
return message.edit(err.message);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -44,7 +44,6 @@
|
||||
<li>Yahoo Weather</li>
|
||||
<li>Gelbooru</li>
|
||||
<li>Giphy</li>
|
||||
<li>Google</li>
|
||||
<li>Konachan</li>
|
||||
<li>Google Maps</li>
|
||||
<li>Neopets</li>
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
<li>Yahoo Weather</li>
|
||||
<li>Gelbooru</li>
|
||||
<li>Giphy</li>
|
||||
<li>Google</li>
|
||||
<li>Konachan</li>
|
||||
<li>Google Maps</li>
|
||||
<li>Neopets</li>
|
||||
|
||||
Reference in New Issue
Block a user