diff options
Diffstat (limited to 'src/index.ts')
-rw-r--r-- | src/index.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/index.ts b/src/index.ts index e2fee01..3b8b0a8 100644 --- a/src/index.ts +++ b/src/index.ts | |||
@@ -19,7 +19,9 @@ const args = cliArgs.parse<{ | |||
19 | async function postRandomPicture() { | 19 | async function postRandomPicture() { |
20 | console.log("Fetching random post..."); | 20 | console.log("Fetching random post..."); |
21 | 21 | ||
22 | const { queryIndex, post } = await e621.getRandomPost(); | 22 | const queryIndex = Math.floor(Math.random() * config.e621.queries.length); |
23 | const query = config.e621.queries[queryIndex]; | ||
24 | const post = await e621.getRandomPost(query); | ||
23 | 25 | ||
24 | console.log(`Got ${post.id} via query ${queryIndex}`); | 26 | console.log(`Got ${post.id} via query ${queryIndex}`); |
25 | 27 | ||
@@ -27,9 +29,9 @@ async function postRandomPicture() { | |||
27 | } | 29 | } |
28 | 30 | ||
29 | async function postSpecificPicture(id: number) { | 31 | async function postSpecificPicture(id: number) { |
30 | console.log("Fetching post ${id}..."); | 32 | console.log(`Fetching post ${id}...`); |
31 | 33 | ||
32 | const post = await e621.getPost(id); | 34 | const post = await e621.getPostById(id); |
33 | 35 | ||
34 | console.log(`Got ${post.id}`); | 36 | console.log(`Got ${post.id}`); |
35 | 37 | ||