This commit is contained in:
Ashley Graves 2024-10-16 00:42:48 +02:00
parent 54a310fb3d
commit a85c33a1b5

View file

@ -43,28 +43,29 @@ module.exports = {
const embeds = []; const embeds = [];
const data = await (await fetch(`${process.env.SEARXNG_INSTANCE}/search?${queryString}`)).json(); const data = await (await fetch(`${process.env.SEARXNG_INSTANCE}/search?${queryString}`)).json();
for (const result of data.results) { 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 = ([ const footerText = ([
result.filesize, result.filesize,
`${result.seed} S`, `${result.seed} S`,
`${result.leech} L`, `${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(" • "); ]).filter(notEmpty).join(" • ");
const site = result.parsed_url.slice(0, 2).join("://"); const description = "• " + [
const description = [
"Downloads:",
result.magnetlink, result.magnetlink,
result.torrentfile, result.torrentfile,
result.url result.url
].filter(notEmpty).join("\n"); ].filter(notEmpty).join("\n");
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: result.engine, 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) .setTitle(result.title)
.setURL(result.url) .setURL(result.url)