diff --git a/src/modules/misc.js b/src/modules/misc.js index bf2958c..9fba146 100644 --- a/src/modules/misc.js +++ b/src/modules/misc.js @@ -1,7 +1,6 @@ const Command = require("../lib/command.js"); const CATEGORY = "misc"; -const {librex} = require("../../config.json"); const { hastebin, safeString, @@ -180,9 +179,7 @@ gimg.callback = async function (msg, line) { url: image.url, }, footer: { - text: `Image ${Number(index) + 1}/${ - images.length - }. Rerun to get a different image.`, + text: `Image ${index}/${images.length}. Rerun to get a different image.`, }, }, ], @@ -545,39 +542,3 @@ generate.callback = async function (msg, line) { return out; }; hf.registerCommand(generate); - -const search = new Command("search"); -search.category = CATEGORY; -search.helpText = "Search, powered by LibreX"; -search.addAlias("g"); -search.addAlias("google"); -search.addAlias("ddg"); -search.callback = async function (msg, line) { - if (!librex) return "LibreX instance not defined."; - - const query = encodeURIComponent(line); - - if (line.startsWith("!")) { - const url = `https://api.duckduckgo.com/?q=${query}&format=json`; - const res = await fetch(url); - if (res.url != url) return res.url; - } - - const res = await fetch(librex + "/api.php?q=${query}&p=0&t=0"); - const results = await res.json().splice(0, 5); - - let out = `__Results for \`${safeString(line)}\`__\n`; - for (const result of results) { - if (result.special_response) { - out += "> " + result.special_response.response.split("\n").join("\n> "); - out += `\n<${result.special_response.source}>`; - } else { - out += `**${result.title}** - <${result.url}>`; - out += `\n> ${result.description}`; - } - out += "\n\n"; - } - - return out.trim(); -}; -hf.registerCommand(search);