From 7c741f88d5a087a1c013ad2602f2ea16fd453e38 Mon Sep 17 00:00:00 2001 From: Ashley Graves Date: Thu, 10 Oct 2024 21:51:41 +0200 Subject: [PATCH] fuck you baltimore --- src/commands/fun/blacklist.js | 4 +--- src/commands/fun/gelbooru.js | 7 +++++-- 2 files changed, 6 insertions(+), 5 deletions(-) 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];