summaryrefslogtreecommitdiffstats
path: root/src/api/e621/index.ts
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2021-10-19 16:36:56 +0200
committerVolpeon <git@volpeon.ink>2021-10-19 16:36:56 +0200
commitf0ae49019b5758389a44477914b7e13b822e791a (patch)
tree9f2e6f2cd6e9aaed4a632a6c3733b532d191e139 /src/api/e621/index.ts
parentExclude dress (diff)
downloadferalbot-f0ae49019b5758389a44477914b7e13b822e791a.tar.gz
feralbot-f0ae49019b5758389a44477914b7e13b822e791a.tar.bz2
feralbot-f0ae49019b5758389a44477914b7e13b822e791a.zip
Code improvements
Diffstat (limited to 'src/api/e621/index.ts')
-rw-r--r--src/api/e621/index.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/api/e621/index.ts b/src/api/e621/index.ts
index 32b7fc0..5c5fd2a 100644
--- a/src/api/e621/index.ts
+++ b/src/api/e621/index.ts
@@ -2,6 +2,7 @@ import got from "got";
2import config from "../../config"; 2import config from "../../config";
3import fs from "fs/promises"; 3import fs from "fs/promises";
4import path from "path"; 4import path from "path";
5import delay from "../../util/delay";
5 6
6export interface GetPostQuery { 7export interface GetPostQuery {
7 tags: readonly string[]; 8 tags: readonly string[];
@@ -101,7 +102,7 @@ export async function getRandomPost(query: GetPostQuery) {
101 const post = response.posts[postIndex]; 102 const post = response.posts[postIndex];
102 103
103 if (dedupeDb.includes(post.id)) { 104 if (dedupeDb.includes(post.id)) {
104 await new Promise((resolve) => setTimeout(resolve, 1000)); 105 await delay(1000);
105 return getRandomPost(query); 106 return getRandomPost(query);
106 } 107 }
107 108