mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Remove Google Support
This commit is contained in:
@@ -54,7 +54,7 @@ class InfoCommand extends commando.Command {
|
||||
.addField('Library',
|
||||
"[discord.js](https://discord.js.org/#/) / [commando](https://github.com/Gawdl3y/discord.js-commando)")
|
||||
.addField('Modules',
|
||||
"[cleverbot-node](https://github.com/fojas/cleverbot-node), [pirate-speak](https://github.com/mikewesthad/pirate-speak), [google-translate-api](https://github.com/matheuss/google-translate-api), [urban](https://github.com/mvrilo/urban), [zalgoize](https://github.com/clux/zalgolize), [hepburn](https://github.com/lovell/hepburn), [yahoo-weather](https://github.com/mamal72/node-yahoo-weather), [imdb-api](https://github.com/worr/node-imdb-api), [string-to-binary](https://www.npmjs.com/package/string-to-binary), [google](https://github.com/jprichardson/node-google), [roman-numeral-converter-mmxvi](https://github.com/Cein-Markey/roman-numeral-conversion-library), [cowsay](https://github.com/piuccio/cowsay), [morse](https://github.com/ecto/morse)")
|
||||
"[cleverbot-node](https://github.com/fojas/cleverbot-node), [pirate-speak](https://github.com/mikewesthad/pirate-speak), [google-translate-api](https://github.com/matheuss/google-translate-api), [urban](https://github.com/mvrilo/urban), [zalgoize](https://github.com/clux/zalgolize), [hepburn](https://github.com/lovell/hepburn), [yahoo-weather](https://github.com/mamal72/node-yahoo-weather), [imdb-api](https://github.com/worr/node-imdb-api), [string-to-binary](https://www.npmjs.com/package/string-to-binary), [roman-numeral-converter-mmxvi](https://github.com/Cein-Markey/roman-numeral-conversion-library), [cowsay](https://github.com/piuccio/cowsay), [morse](https://github.com/ecto/morse)")
|
||||
.addField('Utility Modules',
|
||||
"[request](https://github.com/request/request), [request-promise](https://github.com/request/request-promise), [mathjs](http://mathjs.org/), [moment](http://momentjs.com), [moment-duration-format](https://github.com/jsmreese/moment-duration-format), [opusscript](https://github.com/abalabahaha/opusscript), [jimp](https://github.com/oliver-moran/jimp)")
|
||||
.addField('APIs',
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
const commando = require('discord.js-commando');
|
||||
const google = require('google');
|
||||
|
||||
class GoogleCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
super(Client, {
|
||||
name: 'google',
|
||||
group: 'search',
|
||||
memberName: 'google',
|
||||
description: 'Searches Google for something. (;google Discord)',
|
||||
examples: [';google Discord']
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('SEND_MESSAGES')) return;
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission('READ_MESSAGES')) return;
|
||||
}
|
||||
console.log("[Command] " + message.content);
|
||||
let searchQuery = message.content.split(" ").slice(1).join(" ");
|
||||
if(searchQuery === "") {
|
||||
message.channel.send(':x: Error! I cannot search google for nothing!');
|
||||
} else {
|
||||
google.resultsPerPage = 2
|
||||
google(searchQuery, function (err, res) {
|
||||
if (res === undefined) {
|
||||
message.channel.send(':x: Error! Too many requests! Try again later! (Much later)');
|
||||
} else {
|
||||
let link = res.links;
|
||||
if(link === undefined) {
|
||||
message.channel.send(':x: Error! No Results Found!');
|
||||
} else {
|
||||
if(link[0] === undefined) {
|
||||
message.channel.send(':x: Error! No Results Found!');
|
||||
} else {
|
||||
if(link[0].href === null) {
|
||||
message.channel.send(':x: Error! No Results Found!');
|
||||
} else {
|
||||
message.channel.send(link[0].href).catch(error => message.channel.send(':x: An Error Occurred! Try again later!'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = GoogleCommand;
|
||||
Reference in New Issue
Block a user