Closed Zel9278 closed 5 years ago
Could you please provide a code example showing the issue?
Could you please provide a code example showing the issue?
const page = await wiki.page('Wikipedia');
const summary = await page.summary();
const images = await page.mainImage();
const noi = `${images ? `${images}` : "画像が見つかりませんでした。"}`;
const noi2 = `${images ? `${images}` : "https://sitechecker.pro/wp-content/uploads/2017/12/404.png"}`;
message.channel.send({
embed: {
color: 2500351,
title: `Wikipediaの検索結果(Wikipedia)`,
description: summary,
timestamp: new Date(),
footer: {
icon_url: message.author.avatarURL,
text: `実行者: ${message.author.tag}`,
},
thumbnail: {
url: noi2
},
fields: [
{
name: "links",
value: '無いよ',
},
],
},
}).catch(error => message.reply(`${error}のためメッセージを表示できませんでした`));
(Sorry Japanese)
Could you please give a much more specific issue.
What exactly is not returning what you expect?
I did notice that the Wikipedia page gives undefined
for a mainImage, is this what you are speaking of?
No, I just want to show the Wikipedia article link, but I do not know what to do https://ja.wikipedia.org/wiki/Wikipedia
I want to display this.
I have this simple example
var wikijs = require("wikijs").default;
wikijs({
apiUrl: 'https://es.wikipedia.org/w/api.php',
origin: null
})
.page("djinn")
.then(async data => {
console.log(data.raw.canonicalurl) //the URL for the Wikipedia article is here
return data.summary();
})
.then (async res => {
let firstChars = res.split('\n')[0] + "...";
console.log(firstChars)
})```
Thanks! I will add a method for getting that value easily.
Will be published in v5.3.0
Will be published in v5.3.0
Thanks!
I use this module using Wikipedia's api. However, I noticed that I could not display Wikipedia links.