misc.search: hopefully it works better now
This commit is contained in:
parent
7d05a4f7c7
commit
39bd3f0a93
1 changed files with 3 additions and 2 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue