From a85c33a1b550d605d666a0164aaa25971abd3651 Mon Sep 17 00:00:00 2001 From: Ashley Graves Date: Wed, 16 Oct 2024 00:42:48 +0200 Subject: [PATCH] buh --- src/commands/utility/file.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/commands/utility/file.js b/src/commands/utility/file.js index 606e564..9e8f95a 100644 --- a/src/commands/utility/file.js +++ b/src/commands/utility/file.js @@ -43,28 +43,29 @@ module.exports = { const embeds = []; const data = await (await fetch(`${process.env.SEARXNG_INSTANCE}/search?${queryString}`)).json(); for (const result of data.results) { - if (result.magnetlink) result.magnetlink = `[magnet](${process.env.BASE_URL}/magnet/${result.magnetlink})`; + if (result.magnetlink) + result.magnetlink = `[${result.magnetlink.slice(0, result.magnetlink.indexOf("&"))}](${process.env.BASE_URL}/magnet/${result.magnetlink})`; + + if (result.publishedDate) + result.publishedDate = new Date(result.publishedDate).toLocaleDateString('en-us', { weekday: "long", year: "numeric", month: "short", day: "numeric" }); const footerText = ([ result.filesize, `${result.seed} S`, `${result.leech} L`, - result.publishedDate ? new Date(result.publishedDate).toLocaleDateString('en-us', { weekday: "long", year: "numeric", month: "short", day: "numeric" }) : '' + result.publishedDate ]).filter(notEmpty).join(" • "); - const site = result.parsed_url.slice(0, 2).join("://"); - - const description = [ - "Downloads:", + const description = "• " + [ result.magnetlink, result.torrentfile, result.url - ].filter(notEmpty).join("\n"); + ].filter(notEmpty).join("\n• "); const embed = new EmbedBuilder() .setAuthor({ name: result.engine, - iconURL: `https://vault.incest.world/icons/${result.parsed_url[1]}/icon.png` + url: result.parsed_url.slice(0, 2).join("://") }) .setTitle(result.title) .setURL(result.url)