mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Fix wikia url and logo
This commit is contained in:
@@ -37,14 +37,14 @@ module.exports = class WikiaCommand extends Command {
|
||||
|
||||
async run(msg, { wiki, query }) {
|
||||
try {
|
||||
const { id, url } = await this.search(wiki, query);
|
||||
const id = await this.search(wiki, query);
|
||||
if (!id) return msg.say('Could not find any results.');
|
||||
const data = await this.fetchArticle(wiki, id);
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0x002D54)
|
||||
.setTitle(data.title)
|
||||
.setURL(url)
|
||||
.setAuthor('FANDOM', 'https://i.imgur.com/15A34JT.png', 'https://www.fandom.com/')
|
||||
.setURL(`${data.basepath}${data.url}`)
|
||||
.setAuthor('FANDOM', 'https://i.imgur.com/kBDqFIN.png', 'https://www.fandom.com/')
|
||||
.setDescription(data.abstract)
|
||||
.setThumbnail(data.thumbnail);
|
||||
return msg.embed(embed);
|
||||
@@ -55,7 +55,7 @@ module.exports = class WikiaCommand extends Command {
|
||||
}
|
||||
|
||||
async search(wiki, query) {
|
||||
const data = await request
|
||||
const { body } = await request
|
||||
.get(`https://${wiki}.fandom.com/api.php`)
|
||||
.query({
|
||||
action: 'query',
|
||||
@@ -64,8 +64,8 @@ module.exports = class WikiaCommand extends Command {
|
||||
format: 'json',
|
||||
formatversion: 2
|
||||
});
|
||||
if (data.body.query.pages[0].missing) return { id: null, url: data.url };
|
||||
return { id: data.body.query.pages[0].pageid, url: data.url };
|
||||
if (body.query.pages[0].missing) return null;
|
||||
return body.query.pages[0].pageid;
|
||||
}
|
||||
|
||||
async fetchArticle(wiki, id) {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "119.39.0",
|
||||
"version": "119.39.1",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user