misc.search: did you mean deez nu-

This commit is contained in:
Cynthia Foxwell 2023-09-17 16:28:21 -06:00
parent 5117f101e8
commit 690a8f8765

View file

@ -570,10 +570,12 @@ search.callback = async function (msg, line, args, {results = 2}) {
if (res.url != url) return res.url;
}
const res = await fetch(`${librex}/api.php?q=${encodedQuery}&p=0&t=0`);
const searchResults = await res
.json()
.then((arr) => arr.splice(0, Number(results)));
const res = await fetch(`${librex}/api.php?q=${encodedQuery}&p=0&t=0`).then(
(res) => res.json()
);
const searchResults = res
.filter((result) => !("did_you_mean" in result))
.splice(0, Number(results));
let out = `__**Results for \`${safeString(query)}\`**__\n`;
for (const result of searchResults) {