mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-07 05:42:57 -04:00
fix edge case with empty source collections
This commit is contained in:
parent
dfde49a555
commit
e4cb3a8030
2 changed files with 3 additions and 3 deletions
|
@ -31,7 +31,7 @@ function createWolframPage(context, pod, query, sources) {
|
|||
|
||||
// Only add a direct source if one is available
|
||||
if (src.collections) {
|
||||
res.embeds[0].description += citation(r, src.url, src.title + ' | ' + src.collections[0].text)
|
||||
res.embeds[0].description += citation(r, src.url, src.title + (src.collections[0] ? ' | ' + src.collections[0].text : ""))
|
||||
continue;
|
||||
}
|
||||
if (src.url) res.embeds[0].description += citation(r, src.url, src.title)
|
||||
|
|
|
@ -30,7 +30,7 @@ function createWolframPage(context, pod, query, sources) {
|
|||
|
||||
// Only add a direct source if one is available
|
||||
if (src.collections) {
|
||||
res.description += citation(r, src.url, src.title + ' | ' + src.collections[0].text)
|
||||
res.description += citation(r, src.url, src.title + (src.collections[0] ? ' | ' + src.collections[0].text : ""))
|
||||
continue;
|
||||
}
|
||||
if (src.url) res.description += citation(r, src.url, src.title)
|
||||
|
@ -119,7 +119,7 @@ module.exports = {
|
|||
}
|
||||
});
|
||||
} catch (e) {
|
||||
if(e.response.body?.error) return editOrReply(context, createEmbed("warning", context, e.response.body.message))
|
||||
if(e.response?.body?.error) return editOrReply(context, createEmbed("warning", context, e.response.body.message))
|
||||
console.log(e)
|
||||
return editOrReply(context, createEmbed("error", context, `Unable to perform Wolfram|Alpha search.`))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue