From d876a3f7853bc295a96c4e37a5e73958da85d646 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Tue, 26 Oct 2021 06:48:24 +0200 Subject: Improved tag blacklist --- src/api/e926/index.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/api/e926/index.ts') diff --git a/src/api/e926/index.ts b/src/api/e926/index.ts index 301ad3f..a691648 100644 --- a/src/api/e926/index.ts +++ b/src/api/e926/index.ts @@ -71,8 +71,18 @@ export async function getRandomPost(query: GetPostQuery): Promise { const postIndex = Math.floor(Math.random() * response.posts.length); const post = response.posts[postIndex]; - - if (post.tags.general.some(tag => query.tagsBlacklist.includes(tag))) { + const mergedTags = [ + ...post.tags.artist, + ...post.tags.character, + ...post.tags.copyright, + ...post.tags.general, + ...post.tags.invalid, + ...post.tags.lore, + ...post.tags.meta, + ...post.tags.species, + ]; + + if (query.tagsBlacklist.some(tag => mergedTags.includes(tag))) { await delay(1000); return getRandomPost(query); } -- cgit v1.2.3-70-g09d2