mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-27 14:18:36 +02:00
Fix wikia no results
This commit is contained in:
@@ -38,6 +38,7 @@ 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, url } = await this.search(wiki, query);
|
||||||
|
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)
|
||||||
@@ -63,6 +64,7 @@ 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 };
|
||||||
return { id: data.body.query.pages[0].pageid, url: data.url };
|
return { id: data.body.query.pages[0].pageid, url: data.url };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user