diff --git a/commands/interaction/slash/search/wolfram-alpha.js b/commands/interaction/slash/search/wolfram-alpha.js index 5f5803b..eba9569 100644 --- a/commands/interaction/slash/search/wolfram-alpha.js +++ b/commands/interaction/slash/search/wolfram-alpha.js @@ -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) diff --git a/commands/message/search/wolfram-alpha.js b/commands/message/search/wolfram-alpha.js index c079bb2..10ce947 100644 --- a/commands/message/search/wolfram-alpha.js +++ b/commands/message/search/wolfram-alpha.js @@ -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.`)) }