From 0bc59296639862cfe37bdde744eb8fd656968884 Mon Sep 17 00:00:00 2001 From: Ashley Graves Date: Thu, 10 Oct 2024 08:34:58 +0200 Subject: [PATCH] booru nsfw switch --- src/commands/fun/gelbooru.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/commands/fun/gelbooru.js b/src/commands/fun/gelbooru.js index 73684a0..467aa72 100644 --- a/src/commands/fun/gelbooru.js +++ b/src/commands/fun/gelbooru.js @@ -28,6 +28,12 @@ const data = new SlashCommandBuilder() .setDescription("Booru board to search (default: gelbooru)") .addChoices(boorus) ) + .addBooleanOption(builder => + builder // + .setName("nsfw") + .setRequired(false) + .setDescription("Allow NSFW posts") + ) .setContexts([ InteractionContextType.Guild, InteractionContextType.BotDM, @@ -93,6 +99,7 @@ module.exports = { async execute(interaction) { const tags = interaction.options.getString("tags").split(" "); const booru = interaction.options.getString("booru") ?? defaultBooru; + const nsfw = interaction.options.getBoolean("nsfw") ?? false; await interaction.deferReply(); console.log(booru, tags); @@ -106,7 +113,7 @@ module.exports = { await interaction.followUp("Could not find any post matching tags."); return; } - if (isNSFWPost(newPost)) continue; + if (!nsfw && isNSFWPost(newPost)) continue; post = newPost; }