booru nsfw switch

This commit is contained in:
Ashley Graves 2024-10-10 08:34:58 +02:00
parent 2eaadf2208
commit 0bc5929663

View file

@ -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;
}