From 39bd3f0a93292b6791c65e79ef16e83f80d46d8a Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Thu, 11 Jul 2024 00:55:52 -0600 Subject: [PATCH] misc.search: hopefully it works better now --- src/modules/misc.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/misc.js b/src/modules/misc.js index 9229360..c4a536b 100644 --- a/src/modules/misc.js +++ b/src/modules/misc.js @@ -641,7 +641,6 @@ search.callback = async function (msg, line, args, {results = 2}) { const res = await fetch(`${librex}/api.php?q=${encodedQuery}&p=0&t=0`).then( (res) => res.json() ); - delete res.results_source; if (res.error?.message) { if (res.error.message.indexOf("No results found.") > -1) { return "Search returned no results."; @@ -650,7 +649,9 @@ search.callback = async function (msg, line, args, {results = 2}) { } } else { const searchResults = Object.values(res) - .filter((result) => !("did_you_mean" in result)) + .filter( + (result) => result.did_you_mean == null && typeof result !== "string" + ) .splice(0, Number(results)); if (searchResults.length > 0) {