diff --git a/commands/search/app-store.js b/commands/search/app-store.js index aa035142..a1c8a6d6 100644 --- a/commands/search/app-store.js +++ b/commands/search/app-store.js @@ -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) diff --git a/commands/search/forecast.js b/commands/search/forecast.js index 9e094bfe..086d45a6 100644 --- a/commands/search/forecast.js +++ b/commands/search/forecast.js @@ -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; diff --git a/commands/search/google.js b/commands/search/google.js index c27f1989..db95aea9 100644 --- a/commands/search/google.js +++ b/commands/search/google.js @@ -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); } diff --git a/commands/search/image.js b/commands/search/image.js deleted file mode 100644 index 79cb78fc..00000000 --- a/commands/search/image.js +++ /dev/null @@ -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!'); - } - } -}; diff --git a/commands/search/imdb.js b/commands/search/imdb.js index 0a91883f..443f2aaa 100644 --- a/commands/search/imdb.js +++ b/commands/search/imdb.js @@ -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:**', diff --git a/commands/search/urban.js b/commands/search/urban.js index 1d02ba84..188ae5f5 100644 --- a/commands/search/urban.js +++ b/commands/search/urban.js @@ -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); diff --git a/commands/search/wattpad.js b/commands/search/wattpad.js index 2d72aeb5..1fb18f6e 100644 --- a/commands/search/wattpad.js +++ b/commands/search/wattpad.js @@ -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:**', diff --git a/commands/search/weather.js b/commands/search/weather.js index c44bfd77..ab803258 100644 --- a/commands/search/weather.js +++ b/commands/search/weather.js @@ -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() diff --git a/commands/search/wikipedia.js b/commands/search/wikipedia.js index e4aa6b9e..6a1b4d46 100644 --- a/commands/search/wikipedia.js +++ b/commands/search/wikipedia.js @@ -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) {