summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2021-10-20 09:28:31 +0200
committerVolpeon <git@volpeon.ink>2021-10-20 09:28:31 +0200
commit34d6aa385807bce63c88ca0176190317aea343ba (patch)
tree26d2b11866f46e8952f45a39f234ac121df3992d
parentKeep 100 items in dedupe db (diff)
downloadferalbot-34d6aa385807bce63c88ca0176190317aea343ba.tar.gz
feralbot-34d6aa385807bce63c88ca0176190317aea343ba.tar.bz2
feralbot-34d6aa385807bce63c88ca0176190317aea343ba.zip
Added post id blacklist
-rw-r--r--src/api/e926/index.ts5
-rw-r--r--src/config.ts1
2 files changed, 6 insertions, 0 deletions
diff --git a/src/api/e926/index.ts b/src/api/e926/index.ts
index 37d8598..8e363c9 100644
--- a/src/api/e926/index.ts
+++ b/src/api/e926/index.ts
@@ -71,6 +71,11 @@ export async function getRandomPost(query: GetPostQuery): Promise<Post> {
71 const postIndex = Math.floor(Math.random() * response.posts.length); 71 const postIndex = Math.floor(Math.random() * response.posts.length);
72 const post = response.posts[postIndex]; 72 const post = response.posts[postIndex];
73 73
74 if (config.e621.blacklist.includes(post.id)) {
75 await delay(1000);
76 return getRandomPost(query);
77 }
78
74 const isDupe = await dedupeDb.insertIfNotExists({ provider: "e926", id: post.id }); 79 const isDupe = await dedupeDb.insertIfNotExists({ provider: "e926", id: post.id });
75 80
76 if (isDupe) { 81 if (isDupe) {
diff --git a/src/config.ts b/src/config.ts
index 7d20621..a982124 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -40,6 +40,7 @@ export default {
40 queries: [ 40 queries: [
41 mainQuery, 41 mainQuery,
42 ], 42 ],
43 blacklist: [] as number[],
43 }, 44 },
44 /*misskey: { 45 /*misskey: {
45 instance: "https://mk.vulpes.one/", 46 instance: "https://mk.vulpes.one/",