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)")
|
.setDescription("Booru board to search (default: gelbooru)")
|
||||||
.addChoices(boorus)
|
.addChoices(boorus)
|
||||||
)
|
)
|
||||||
|
.addBooleanOption(builder =>
|
||||||
|
builder //
|
||||||
|
.setName("nsfw")
|
||||||
|
.setRequired(false)
|
||||||
|
.setDescription("Allow NSFW posts")
|
||||||
|
)
|
||||||
.setContexts([
|
.setContexts([
|
||||||
InteractionContextType.Guild,
|
InteractionContextType.Guild,
|
||||||
InteractionContextType.BotDM,
|
InteractionContextType.BotDM,
|
||||||
|
@ -93,6 +99,7 @@ module.exports = {
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
const tags = interaction.options.getString("tags").split(" ");
|
const tags = interaction.options.getString("tags").split(" ");
|
||||||
const booru = interaction.options.getString("booru") ?? defaultBooru;
|
const booru = interaction.options.getString("booru") ?? defaultBooru;
|
||||||
|
const nsfw = interaction.options.getBoolean("nsfw") ?? false;
|
||||||
|
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
console.log(booru, tags);
|
console.log(booru, tags);
|
||||||
|
@ -106,7 +113,7 @@ module.exports = {
|
||||||
await interaction.followUp("Could not find any post matching tags.");
|
await interaction.followUp("Could not find any post matching tags.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isNSFWPost(newPost)) continue;
|
if (!nsfw && isNSFWPost(newPost)) continue;
|
||||||
post = newPost;
|
post = newPost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue