From 14ce3ee16396afb11308707deac0a060150768cf Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sat, 7 Nov 2020 14:08:15 -0500 Subject: [PATCH] Fix wikia url and logo --- commands/search/wikia.js | 12 ++++++------ package.json | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/commands/search/wikia.js b/commands/search/wikia.js index fb57ef5b..5b2e26d8 100644 --- a/commands/search/wikia.js +++ b/commands/search/wikia.js @@ -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) { diff --git a/package.json b/package.json index 4b285b54..d81cc34c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "119.39.0", + "version": "119.39.1", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {