mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Some Changes
This commit is contained in:
@@ -44,7 +44,7 @@ module.exports = class AppStoreCommand extends commando.Command {
|
||||
.setAuthor('App Store', 'https://upload.wikimedia.org/wikipedia/en/1/1f/App_Store_Logo.png')
|
||||
.setTitle(data.trackName)
|
||||
.setURL(data.trackViewUrl)
|
||||
.setDescription(data.description)
|
||||
.setDescription(data.description.substr(0, 1900))
|
||||
.setThumbnail(data.artworkUrl512)
|
||||
.addField('**Version:**',
|
||||
data.version, true)
|
||||
|
||||
@@ -31,7 +31,8 @@ module.exports = class ForecastCommand extends commando.Command {
|
||||
let response = await request
|
||||
.get('https://query.yahooapis.com/v1/public/yql')
|
||||
.query({
|
||||
q: `select * from weather.forecast where u='f' AND woeid in (select woeid from geo.places(1) where text="${locationToSearch}")&format=json`
|
||||
q: `select * from weather.forecast where u='f' AND woeid in (select woeid from geo.places(1) where text="${locationToSearch}")`,
|
||||
format: 'json'
|
||||
});
|
||||
let info = response.body.query.results.channel;
|
||||
let data = info.item.forecast;
|
||||
|
||||
@@ -37,7 +37,6 @@ module.exports = class GoogleCommand extends commando.Command {
|
||||
});
|
||||
const $ = cheerio.load(response.text);
|
||||
let href = $('.r').first().find('a').first().attr('href');
|
||||
//if (!href) return searchMsg.edit(':x: Error! No Results Found!');
|
||||
href = querystring.parse(href.replace('/url?', ''));
|
||||
return searchMsg.edit(href.q);
|
||||
}
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
const commando = require('discord.js-commando');
|
||||
const request = require('superagent');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = class ImageSearchCommand extends commando.Command {
|
||||
constructor(Client) {
|
||||
super(Client, {
|
||||
name: 'image',
|
||||
aliases: [
|
||||
'searchimage',
|
||||
'googleimages'
|
||||
],
|
||||
group: 'search',
|
||||
memberName: 'image',
|
||||
description: 'Searches Google for an Image. (;image Cat)',
|
||||
examples: [';image Cat'],
|
||||
args: [{
|
||||
key: 'query',
|
||||
prompt: 'What would you like to search for?',
|
||||
type: 'string'
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm') {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
}
|
||||
console.log(`[Command] ${message.content}`);
|
||||
let thingToSearch = args.query;
|
||||
let searchMsg = await message.say('Searching...');
|
||||
try {
|
||||
let response = await request
|
||||
.get('https://www.google.com/search')
|
||||
.query({
|
||||
tbm: 'isch',
|
||||
gs_1: 'img',
|
||||
q: thingToSearch
|
||||
});
|
||||
const $ = cheerio.load(response.text);
|
||||
const result = $('.images_table').find('img').first().attr('src');
|
||||
return searchMsg.edit(result);
|
||||
}
|
||||
catch (err) {
|
||||
return searchMsg.edit(':x: Error! No Results Found!');
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -42,7 +42,7 @@ module.exports = class IMDBCommand extends commando.Command {
|
||||
.setAuthor('IMDB', 'http://static.wixstatic.com/media/c65cbf_31901b544fe24f1890134553bf40c8be.png')
|
||||
.setURL(`http://www.imdb.com/title/${data.imdbID}`)
|
||||
.setTitle(`${data.Title} (${data.imdbRating} Score)`)
|
||||
.setDescription(`${data.Plot.substr(0, 1500)} [Read the Rest Here!](http://www.imdb.com/title/${data.imdbID})`)
|
||||
.setDescription(data.Plot.substr(0, 1900))
|
||||
.addField('**Genres:**',
|
||||
data.Genre)
|
||||
.addField('**Year:**',
|
||||
|
||||
@@ -41,7 +41,7 @@ module.exports = class UrbanDictionary extends commando.Command {
|
||||
.setAuthor('Urban Dictionary', 'http://a1.mzstatic.com/eu/r30/Purple71/v4/66/54/68/6654683f-cacd-4a55-1784-f14257f77874/icon175x175.png')
|
||||
.setURL(data.permalink)
|
||||
.setTitle(data.word)
|
||||
.setDescription(`${data.definition.substr(0, 1900)} [Read the Rest Here!](${data.permalink})`)
|
||||
.setDescription(data.definition.substr(0, 1900))
|
||||
.addField('**Example:**',
|
||||
data.example.substr(0, 1900) || 'None');
|
||||
return message.embed(embed);
|
||||
|
||||
@@ -41,7 +41,7 @@ module.exports = class WattpadCommand extends commando.Command {
|
||||
.setAuthor('Wattpad', 'http://www.selfpubtoolbox.com/wp-content/uploads/2015/05/a6044fd3a88acd5043860484db972ca6.png')
|
||||
.setURL(data.url)
|
||||
.setTitle(data.title)
|
||||
.setDescription(`${data.description.substr(0, 1500)} [Read the Rest Here!](${data.url})`)
|
||||
.setDescription(data.description.substr(0, 1500))
|
||||
.addField('**Author:**',
|
||||
data.user, true)
|
||||
.addField('**Parts:**',
|
||||
|
||||
@@ -28,7 +28,8 @@ module.exports = class WeatherCommand extends commando.Command {
|
||||
let response = await request
|
||||
.get('https://query.yahooapis.com/v1/public/yql')
|
||||
.query({
|
||||
q: `select * from weather.forecast where u='f' AND woeid in (select woeid from geo.places(1) where text="${locationToSearch}")&format=json`
|
||||
q: `select * from weather.forecast where u='f' AND woeid in (select woeid from geo.places(1) where text="${locationToSearch}")`,
|
||||
format: 'json'
|
||||
});
|
||||
let data = response.body.query.results.channel;
|
||||
const embed = new Discord.RichEmbed()
|
||||
|
||||
@@ -46,7 +46,7 @@ module.exports = class WikipediaCommand extends commando.Command {
|
||||
.setTitle(data.name)
|
||||
.setURL(`https://en.wikipedia.org/wiki/${title}`)
|
||||
.setAuthor("Wikipedia", "https://upload.wikimedia.org/wikipedia/en/thumb/8/80/Wikipedia-logo-v2.svg/1122px-Wikipedia-logo-v2.svg.png")
|
||||
.setDescription(`${description} [Read the Rest Here](https://en.wikipedia.org/wiki/${title})`);
|
||||
.setDescription(description);
|
||||
return message.embed(embed);
|
||||
}
|
||||
catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user