From 2bfaa4288eafb8b2469a8022dd5c00e4e456a055 Mon Sep 17 00:00:00 2001 From: Ashley Graves Date: Thu, 10 Oct 2024 17:15:26 +0200 Subject: [PATCH] sex --- src/commands/fun/gelbooru.js | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/src/commands/fun/gelbooru.js b/src/commands/fun/gelbooru.js index 8f8a5e9..4782211 100644 --- a/src/commands/fun/gelbooru.js +++ b/src/commands/fun/gelbooru.js @@ -14,7 +14,13 @@ for (const site of Object.keys(Booru.sites)) { }) } -const defaultBooru = "safebooru.org"; +const defaultBooru = "gelbooru.com"; +const ratings = [ + "rating:general", + "rating:questionable", + "rating:sensitive", + "rating:explicit", +]; const data = new SlashCommandBuilder() .setName("booru") @@ -25,10 +31,17 @@ const data = new SlashCommandBuilder() .setRequired(true) .setDescription("Tags to search for") ) + .addStringOption(builder => + builder // + .setName("rating") + .setRequired(false) + .setDescription("Image rating (default: safe)") + .setChoices(ratings.map(r => { var x = r.split(":")[1]; var s = x[0].toUpperCase() + x.slice(1); return { name: s, value: r } })) + ) .addStringOption(builder => builder // .setName("booru") - .setDescription("Booru board to search (default: safebooru.org)") + .setDescription("Booru board to search (default: gelbooru.org)") .addChoices(boorus) ) .setContexts([ @@ -114,24 +127,30 @@ function proxy(url) { ...auth }); - console.log(url); - return url; } module.exports = { data, async execute(interaction) { + await interaction.deferReply(); + 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 tag(s): \`${containsBlacklist.join(", ")}\``); + await interaction.followUp(`searched for blacklisted tag(s): \`${containsBlacklist.join(", ")}\`.\n-# this incident will be reported.`); + var incidentChannel = interaction.client.channels.cache.get(process.env.INCIDENT_CHANNEL); + if (incidentChannel) { + incidentChannel.send(`User \`${interaction.user.username}\` (<@${interaction.user.id}>) searched for blacklisted tags:\n\`${containsBlacklist.join(", ")}\``); + } return; } const booru = interaction.options.getString("booru") ?? defaultBooru; + const rating = (interaction.options.getString("rating") ?? ratings[0]); + console.log(rating); - await interaction.deferReply(); - const searchTags = [...tags, ...blacklist.map(i => "-" + i)]; + const searchTags = [...tags, ...blacklist.map(i => "-" + i), ...ratings.filter(v => v != rating).map(i => "-" + i)]; + console.log(rating, searchTags); const startTime = process.hrtime.bigint();