booru nsfw switch
This commit is contained in:
parent
2eaadf2208
commit
0bc5929663
1 changed files with 8 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue