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 | |
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')
-rw-r--r-- | src/api/e926/index.ts | 14 | ||||
-rw-r--r-- | src/config.ts | 7 |
2 files changed, 15 insertions, 6 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 | } |
diff --git a/src/config.ts b/src/config.ts index 8eef85b..b81fdcb 100644 --- a/src/config.ts +++ b/src/config.ts | |||
@@ -32,6 +32,8 @@ const mainQuery: GetPostQuery = { | |||
32 | "-animated", | 32 | "-animated", |
33 | "-transformation", | 33 | "-transformation", |
34 | "-m*cro", | 34 | "-m*cro", |
35 | "-plushification", | ||
36 | "-foot_focus", | ||
35 | "-world_war_*", | 37 | "-world_war_*", |
36 | "-adolf_hitler_(artist)", | 38 | "-adolf_hitler_(artist)", |
37 | "-blackkaries", | 39 | "-blackkaries", |
@@ -41,10 +43,7 @@ const mainQuery: GetPostQuery = { | |||
41 | "score:>=20", | 43 | "score:>=20", |
42 | "inpool:false", | 44 | "inpool:false", |
43 | ], | 45 | ], |
44 | tagsBlacklist: [ | 46 | tagsBlacklist: [], |
45 | "plushification", | ||
46 | "foot_focus" | ||
47 | ], | ||
48 | maxPage: 118, | 47 | maxPage: 118, |
49 | }; | 48 | }; |
50 | 49 | ||