From 9f7275269faffd95437d850630e4ff59c09ffa62 Mon Sep 17 00:00:00 2001 From: Ashley Graves Date: Thu, 10 Oct 2024 15:39:16 +0200 Subject: [PATCH] guh --- src/commands/fun/gelbooru.js | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/commands/fun/gelbooru.js b/src/commands/fun/gelbooru.js index 0b09441..65cccca 100644 --- a/src/commands/fun/gelbooru.js +++ b/src/commands/fun/gelbooru.js @@ -24,15 +24,14 @@ const data = new SlashCommandBuilder() .setName("tags") .setRequired(false) .setDescription("Tags to search for") - .setAutocomplete(true) ) - /*.addStringOption(builder => + .addStringOption(builder => builder // .setName("booru") .setRequired(false) .setDescription("Booru board to search (default: gelbooru)") .addChoices(boorus) - )*/ + ) .addBooleanOption(builder => builder // .setName("nsfw") @@ -95,15 +94,13 @@ function formatTime(time) { return `${(Number(time) / 1e6).toFixed(2)}ms` } -const aiTags = [ - "ai_art", - "ai_generated" +const blacklist = [ + "-ai_generated", + "-ai_art", + "-child", + "-loli" ]; -function isAIPost(post) { - return aiTags.map(i => post.tags.includes(i)).includes(true); -} - var credentials = JSON.parse(readFileSync("credentials.json")); function proxy(url) { @@ -124,11 +121,16 @@ module.exports = { data, async execute(interaction) { const tags = (interaction.options.getString("tags") ?? "").split(" "); + const containsBlacklist = tags.filter(i => blacklist.includes("-" + i)); + if (containsBlacklist.length > 0) { + await interaction.followUp(`<:warning:1293874152150667315> kill yourself.\n(searched for blacklisted tags: \`${containsBlacklist.join(", ")}\`)`); + return; + } const booru = interaction.options.getString("booru") ?? defaultBooru; const nsfw = interaction.options.getBoolean("nsfw") ?? false; await interaction.deferReply(); - const searchTags = [...(nsfw ? [] : ["-rating:explicit", "-rating:questionable"]), ...tags]; + const searchTags = [...(nsfw ? [] : ["-rating:explicit", "-rating:questionable"]), ...tags, ...blacklist]; const startTime = process.hrtime.bigint(); @@ -139,7 +141,7 @@ module.exports = { await interaction.followUp("<:warning:1293874152150667315> Could not find any post matching tags."); return; } - if (/*!nsfw && isNSFWPost(newPost) || */isAIPost(newPost)) continue; + if (/*!nsfw && isNSFWPost(newPost) || */isAIPost(newPost) || isFucked(newPost)) continue; post = newPost; }