diff --git a/src/commands/fun/blacklist.js b/src/commands/fun/blacklist.js index fb4e8a8..9e918f1 100644 --- a/src/commands/fun/blacklist.js +++ b/src/commands/fun/blacklist.js @@ -26,6 +26,11 @@ const data = new SlashCommandBuilder() .setDescription("Tag to unblacklist") .setAutocomplete(true) )) + .addSubcommand((builder) => + builder // + .setName("list") + .setDescription("List current blacklist") + ) .setContexts([ InteractionContextType.Guild, InteractionContextType.BotDM, @@ -41,7 +46,6 @@ module.exports = { async execute(interaction) { await interaction.deferReply({ ephemeral: true }); const command = interaction.options.getSubcommand(true); - const tag = interaction.options.getString("tag").replaceAll(" ", "_"); var result = await knex.select("blacklist").from("blacklists").where("user", interaction.user.id).first(); if (!result) result = { blacklist: '' }; @@ -50,10 +54,13 @@ module.exports = { const data = { user: interaction.user.id, - blacklist: [...blacklist].join(" ").trim() + blacklist: blacklist.join(" ").trim() } switch (command) { + case "add" || "remove": + const tag = interaction.options.getString("tag").replaceAll(" ", "_"); + case "add": if (blacklist.includes(tag)) { await interaction.followUp("This tag is already blacklisted."); @@ -67,6 +74,9 @@ module.exports = { data.blacklist = data.blacklist.split(" ").filter(i => i != tag).join(" ").trim(); await interaction.followUp("Successfully removed!"); break; + case "list": + await interaction.followUp(`Current blacklist:\n\`\`${blacklist.join(", ").replaceAll("`", "`" + String.fromCharCode(8203))}\`\``); + return; default: break; } diff --git a/src/commands/fun/gelbooru.js b/src/commands/fun/gelbooru.js index 435d608..9248b9d 100644 --- a/src/commands/fun/gelbooru.js +++ b/src/commands/fun/gelbooru.js @@ -137,11 +137,9 @@ module.exports = { const tags = (interaction.options.getString("tags") ?? "").split(" "); const booru = interaction.options.getString("booru") ?? defaultBooru; const rating = (interaction.options.getString("rating") ?? ratings[0]); - console.log(rating); const userBlacklist = ((await knex.select("blacklist").from("blacklists").where("user", interaction.user.id).first()).blacklist ?? "").split(" "); const searchTags = [rating, ...tags, ...[...blacklist, ...userBlacklist].map(i => "-" + i)]; - console.log(rating, searchTags); const startTime = process.hrtime.bigint();