diff --git a/src/commands/fun/blacklist.js b/src/commands/fun/blacklist.js index 9e918f1..acfcad3 100644 --- a/src/commands/fun/blacklist.js +++ b/src/commands/fun/blacklist.js @@ -57,10 +57,8 @@ module.exports = { blacklist: blacklist.join(" ").trim() } + const tag = (interaction.options.getString("tag") ?? "").replaceAll(" ", "_"); 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."); diff --git a/src/commands/fun/gelbooru.js b/src/commands/fun/gelbooru.js index 9248b9d..d44eab2 100644 --- a/src/commands/fun/gelbooru.js +++ b/src/commands/fun/gelbooru.js @@ -138,9 +138,12 @@ module.exports = { const booru = interaction.options.getString("booru") ?? defaultBooru; const rating = (interaction.options.getString("rating") ?? ratings[0]); - 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)]; + var result = await knex.select("blacklist").from("blacklists").where("user", interaction.user.id).first(); + if (!result) + result = { blacklist: '' }; + const userBlacklist = (result.blacklist ?? "").trim().split(" "); + const searchTags = [rating, ...tags, ...[...blacklist, ...userBlacklist].map(i => "-" + i)]; const startTime = process.hrtime.bigint(); var post = (await Booru.search(booru, searchTags, { limit: 1, random: true, credentials: credentials[booru] ?? null }))[0];