Fix wikia url and logo

This commit is contained in:
Dragon Fire
2020-11-07 14:08:15 -05:00
parent 3ab1744f2b
commit 14ce3ee163
2 changed files with 7 additions and 7 deletions
+6 -6
View File
@@ -37,14 +37,14 @@ module.exports = class WikiaCommand extends Command {
async run(msg, { wiki, query }) { async run(msg, { wiki, query }) {
try { 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.'); if (!id) return msg.say('Could not find any results.');
const data = await this.fetchArticle(wiki, id); const data = await this.fetchArticle(wiki, id);
const embed = new MessageEmbed() const embed = new MessageEmbed()
.setColor(0x002D54) .setColor(0x002D54)
.setTitle(data.title) .setTitle(data.title)
.setURL(url) .setURL(`${data.basepath}${data.url}`)
.setAuthor('FANDOM', 'https://i.imgur.com/15A34JT.png', 'https://www.fandom.com/') .setAuthor('FANDOM', 'https://i.imgur.com/kBDqFIN.png', 'https://www.fandom.com/')
.setDescription(data.abstract) .setDescription(data.abstract)
.setThumbnail(data.thumbnail); .setThumbnail(data.thumbnail);
return msg.embed(embed); return msg.embed(embed);
@@ -55,7 +55,7 @@ module.exports = class WikiaCommand extends Command {
} }
async search(wiki, query) { async search(wiki, query) {
const data = await request const { body } = await request
.get(`https://${wiki}.fandom.com/api.php`) .get(`https://${wiki}.fandom.com/api.php`)
.query({ .query({
action: 'query', action: 'query',
@@ -64,8 +64,8 @@ module.exports = class WikiaCommand extends Command {
format: 'json', format: 'json',
formatversion: 2 formatversion: 2
}); });
if (data.body.query.pages[0].missing) return { id: null, url: data.url }; if (body.query.pages[0].missing) return null;
return { id: data.body.query.pages[0].pageid, url: data.url }; return body.query.pages[0].pageid;
} }
async fetchArticle(wiki, id) { async fetchArticle(wiki, id) {
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "xiao", "name": "xiao",
"version": "119.39.0", "version": "119.39.1",
"description": "Your personal server companion.", "description": "Your personal server companion.",
"main": "Xiao.js", "main": "Xiao.js",
"scripts": { "scripts": {