diff options
| author | Volpeon <git@volpeon.ink> | 2021-10-26 06:38:43 +0200 |
|---|---|---|
| committer | Volpeon <git@volpeon.ink> | 2021-10-26 06:38:43 +0200 |
| commit | d4e2f646abeba5a5777432cb22652472e4741174 (patch) | |
| tree | 2572eaa4c66cccccd7a1f0e76414cd61ed5b6f87 /src | |
| parent | Blacklist 2588693 (diff) | |
| download | feralbot-d4e2f646abeba5a5777432cb22652472e4741174.tar.gz feralbot-d4e2f646abeba5a5777432cb22652472e4741174.tar.bz2 feralbot-d4e2f646abeba5a5777432cb22652472e4741174.zip | |
Added tag blacklist since the query limit was reached
Diffstat (limited to 'src')
| -rw-r--r-- | src/api/e926/index.ts | 6 | ||||
| -rw-r--r-- | src/config.ts | 10 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/api/e926/index.ts b/src/api/e926/index.ts index 8e363c9..301ad3f 100644 --- a/src/api/e926/index.ts +++ b/src/api/e926/index.ts | |||
| @@ -7,6 +7,7 @@ export const dedupeDb = new PostDatabase("e926dedupe.json", 100); | |||
| 7 | 7 | ||
| 8 | export interface GetPostQuery { | 8 | export interface GetPostQuery { |
| 9 | tags: readonly string[]; | 9 | tags: readonly string[]; |
| 10 | tagsBlacklist: readonly string[]; | ||
| 10 | maxPage: number; | 11 | maxPage: number; |
| 11 | } | 12 | } |
| 12 | 13 | ||
| @@ -71,6 +72,11 @@ export async function getRandomPost(query: GetPostQuery): Promise<Post> { | |||
| 71 | const postIndex = Math.floor(Math.random() * response.posts.length); | 72 | const postIndex = Math.floor(Math.random() * response.posts.length); |
| 72 | const post = response.posts[postIndex]; | 73 | const post = response.posts[postIndex]; |
| 73 | 74 | ||
| 75 | if (post.tags.general.some(tag => query.tagsBlacklist.includes(tag))) { | ||
| 76 | await delay(1000); | ||
| 77 | return getRandomPost(query); | ||
| 78 | } | ||
| 79 | |||
| 74 | if (config.e621.blacklist.includes(post.id)) { | 80 | if (config.e621.blacklist.includes(post.id)) { |
| 75 | await delay(1000); | 81 | await delay(1000); |
| 76 | return getRandomPost(query); | 82 | return getRandomPost(query); |
diff --git a/src/config.ts b/src/config.ts index 0a623e0..8eef85b 100644 --- a/src/config.ts +++ b/src/config.ts | |||
| @@ -31,10 +31,8 @@ const mainQuery: GetPostQuery = { | |||
| 31 | "-mouth_shot", | 31 | "-mouth_shot", |
| 32 | "-animated", | 32 | "-animated", |
| 33 | "-transformation", | 33 | "-transformation", |
| 34 | "-macro", | 34 | "-m*cro", |
| 35 | "-micro", | 35 | "-world_war_*", |
| 36 | "-world_war_1", | ||
| 37 | "-world_war_2", | ||
| 38 | "-adolf_hitler_(artist)", | 36 | "-adolf_hitler_(artist)", |
| 39 | "-blackkaries", | 37 | "-blackkaries", |
| 40 | "-photography_(artwork)", | 38 | "-photography_(artwork)", |
| @@ -43,6 +41,10 @@ const mainQuery: GetPostQuery = { | |||
| 43 | "score:>=20", | 41 | "score:>=20", |
| 44 | "inpool:false", | 42 | "inpool:false", |
| 45 | ], | 43 | ], |
| 44 | tagsBlacklist: [ | ||
| 45 | "plushification", | ||
| 46 | "foot_focus" | ||
| 47 | ], | ||
| 46 | maxPage: 118, | 48 | maxPage: 118, |
| 47 | }; | 49 | }; |
| 48 | 50 | ||
