summaryrefslogtreecommitdiffstats
path: root/src/api
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2021-10-26 06:38:43 +0200
committerVolpeon <git@volpeon.ink>2021-10-26 06:38:43 +0200
commitd4e2f646abeba5a5777432cb22652472e4741174 (patch)
tree2572eaa4c66cccccd7a1f0e76414cd61ed5b6f87 /src/api
parentBlacklist 2588693 (diff)
downloadferalbot-d4e2f646abeba5a5777432cb22652472e4741174.tar.gz
feralbot-d4e2f646abeba5a5777432cb22652472e4741174.tar.bz2
feralbot-d4e2f646abeba5a5777432cb22652472e4741174.zip
Added tag blacklist since the query limit was reached
Diffstat (limited to 'src/api')
-rw-r--r--src/api/e926/index.ts6
1 files changed, 6 insertions, 0 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
8export interface GetPostQuery { 8export 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);