From e88cfd7fc4c8c5883466e2bf651072b360898f4b Mon Sep 17 00:00:00 2001 From: dragonfire535 Date: Wed, 13 Sep 2017 16:51:25 -0400 Subject: [PATCH] Add Images to Wikipedia and Bulbapedia --- commands/search/bulbapedia.js | 4 +++- commands/search/wikipedia.js | 4 +++- package.json | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/commands/search/bulbapedia.js b/commands/search/bulbapedia.js index f51a7b9a..c42018de 100644 --- a/commands/search/bulbapedia.js +++ b/commands/search/bulbapedia.js @@ -29,11 +29,12 @@ module.exports = class BulbapediaCommand extends Command { .get('https://bulbapedia.bulbagarden.net/w/api.php') .query({ action: 'query', - prop: 'extracts', + prop: 'extracts|pageimages', format: 'json', titles: query, exintro: '', explaintext: '', + pithumbsize: 150, redirects: '', formatversion: 2 }); @@ -42,6 +43,7 @@ module.exports = class BulbapediaCommand extends Command { .setColor(0x3E7614) .setTitle(body.query.pages[0].title) .setAuthor('Bulbapedia', 'https://i.imgur.com/09eYo5T.png') + .setThumbnail(body.query.pages[0].thumbnail ? body.query.pages[0].thumbnail.source : null) .setDescription(shorten(body.query.pages[0].extract.replace(/\n/g, '\n\n'))); return msg.embed(embed); } catch (err) { diff --git a/commands/search/wikipedia.js b/commands/search/wikipedia.js index c8e2e1b8..64539b97 100644 --- a/commands/search/wikipedia.js +++ b/commands/search/wikipedia.js @@ -28,11 +28,12 @@ module.exports = class WikipediaCommand extends Command { .get('https://en.wikipedia.org/w/api.php') .query({ action: 'query', - prop: 'extracts', + prop: 'extracts|pageimages', format: 'json', titles: query, exintro: '', explaintext: '', + pithumbsize: 150, redirects: '', formatversion: 2 }); @@ -41,6 +42,7 @@ module.exports = class WikipediaCommand extends Command { .setColor(0xE7E7E7) .setTitle(body.query.pages[0].title) .setAuthor('Wikipedia', 'https://i.imgur.com/a4eeEhh.png') + .setThumbnail(body.query.pages[0].thumbnail ? body.query.pages[0].thumbnail.source : null) .setDescription(shorten(body.query.pages[0].extract.replace(/\n/g, '\n\n'))); return msg.embed(embed); } catch (err) { diff --git a/package.json b/package.json index 7fded649..bafcd8da 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "38.7.2", + "version": "38.7.3", "description": "Your personal server companion.", "main": "Shard.js", "scripts": {