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 }) {
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
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "119.39.0",
"version": "119.39.1",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {