diff options
Diffstat (limited to 'src/services/jobs.ts')
| -rw-r--r-- | src/services/jobs.ts | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/services/jobs.ts b/src/services/jobs.ts index cf3b894..354c66d 100644 --- a/src/services/jobs.ts +++ b/src/services/jobs.ts | |||
| @@ -1,8 +1,18 @@ | |||
| 1 | import * as e621 from "../api/e621"; | 1 | import * as e621 from "../api/e926"; |
| 2 | import * as mastodon from "../api/mastodon"; | 2 | import * as mastodon from "../api/mastodon"; |
| 3 | import config from "../config"; | 3 | import config from "../config"; |
| 4 | import Sharp from "sharp"; | 4 | import Sharp from "sharp"; |
| 5 | 5 | ||
| 6 | export async function postSpecificPicture(id: number) { | ||
| 7 | console.log(`Fetching post ${id}...`); | ||
| 8 | |||
| 9 | const post = await e621.getPostById(id); | ||
| 10 | |||
| 11 | console.log(`Got ${post.id}`); | ||
| 12 | |||
| 13 | await handlePost(post); | ||
| 14 | } | ||
| 15 | |||
| 6 | export async function postRandomPicture() { | 16 | export async function postRandomPicture() { |
| 7 | console.log("Fetching random post..."); | 17 | console.log("Fetching random post..."); |
| 8 | 18 | ||
| @@ -15,16 +25,6 @@ export async function postRandomPicture() { | |||
| 15 | await handlePost(post); | 25 | await handlePost(post); |
| 16 | } | 26 | } |
| 17 | 27 | ||
| 18 | export async function postSpecificPicture(id: number) { | ||
| 19 | console.log(`Fetching post ${id}...`); | ||
| 20 | |||
| 21 | const post = await e621.getPostById(id); | ||
| 22 | |||
| 23 | console.log(`Got ${post.id}`); | ||
| 24 | |||
| 25 | await handlePost(post); | ||
| 26 | } | ||
| 27 | |||
| 28 | async function handlePost(post: e621.Post) { | 28 | async function handlePost(post: e621.Post) { |
| 29 | const source = post.sources.length ? post.sources[0] : undefined; | 29 | const source = post.sources.length ? post.sources[0] : undefined; |
| 30 | const cws = config.cw.filter((w) => post.tags.general.includes(w)); | 30 | const cws = config.cw.filter((w) => post.tags.general.includes(w)); |
