default to safebooru

This commit is contained in:
Ashley Graves 2024-10-10 16:13:33 +02:00
parent 043284a9ea
commit 4ddbb90ef6

View file

@ -14,7 +14,7 @@ for (const site of Object.keys(Booru.sites)) {
}) })
} }
const defaultBooru = "gelbooru.com"; const defaultBooru = "safebooru.org";
const data = new SlashCommandBuilder() const data = new SlashCommandBuilder()
.setName("booru") .setName("booru")
@ -29,15 +29,9 @@ const data = new SlashCommandBuilder()
builder // builder //
.setName("booru") .setName("booru")
.setRequired(false) .setRequired(false)
.setDescription("Booru board to search (default: gelbooru)") .setDescription("Booru board to search (default: safebooru.org)")
.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,
@ -127,10 +121,9 @@ module.exports = {
return; return;
} }
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();
const searchTags = [...(nsfw ? [] : ["-rating:explicit", "-rating:sensitive", "-rating:questionable"]), ...tags, ...blacklist.map(i => "-" + i)]; const searchTags = [...tags, ...blacklist.map(i => "-" + i)];
const startTime = process.hrtime.bigint(); const startTime = process.hrtime.bigint();