diff options
author | Volpeon <git@volpeon.ink> | 2021-10-26 06:48:24 +0200 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2021-10-26 06:48:24 +0200 |
commit | d876a3f7853bc295a96c4e37a5e73958da85d646 (patch) | |
tree | 57800f5b5221339128afbed18f7d0ed8ae90fb9a /src/api/e926/index.ts | |
parent | Added tag blacklist since the query limit was reached (diff) | |
download | feralbot-d876a3f7853bc295a96c4e37a5e73958da85d646.tar.gz feralbot-d876a3f7853bc295a96c4e37a5e73958da85d646.tar.bz2 feralbot-d876a3f7853bc295a96c4e37a5e73958da85d646.zip |
Improved tag blacklist
Diffstat (limited to 'src/api/e926/index.ts')
-rw-r--r-- | src/api/e926/index.ts | 14 |
1 files changed, 12 insertions, 2 deletions
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<Post> { | |||
71 | 71 | ||
72 | const postIndex = Math.floor(Math.random() * response.posts.length); | 72 | const postIndex = Math.floor(Math.random() * response.posts.length); |
73 | const post = response.posts[postIndex]; | 73 | const post = response.posts[postIndex]; |
74 | 74 | const mergedTags = [ | |
75 | if (post.tags.general.some(tag => query.tagsBlacklist.includes(tag))) { | 75 | ...post.tags.artist, |
76 | ...post.tags.character, | ||
77 | ...post.tags.copyright, | ||
78 | ...post.tags.general, | ||
79 | ...post.tags.invalid, | ||
80 | ...post.tags.lore, | ||
81 | ...post.tags.meta, | ||
82 | ...post.tags.species, | ||
83 | ]; | ||
84 | |||
85 | if (query.tagsBlacklist.some(tag => mergedTags.includes(tag))) { | ||
76 | await delay(1000); | 86 | await delay(1000); |
77 | return getRandomPost(query); | 87 | return getRandomPost(query); |
78 | } | 88 | } |