mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Add Images to Wikipedia and Bulbapedia
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiaobot",
|
||||
"version": "38.7.2",
|
||||
"version": "38.7.3",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Shard.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user