From 8544feb5d47df2399d07f69c56bb226ce923849a Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sun, 17 Oct 2021 20:12:47 +0200 Subject: Added query to exclude dragons --- src/api/e621/index.ts | 2 +- src/config.ts | 46 ++++++++++++++++++++++++++-------------------- src/index.ts | 8 ++++---- 3 files changed, 31 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/api/e621/index.ts b/src/api/e621/index.ts index 4748e87..c8e0f44 100644 --- a/src/api/e621/index.ts +++ b/src/api/e621/index.ts @@ -48,5 +48,5 @@ export async function randomPost() { const postIndex = Math.floor(Math.random() * response.posts.length); const post = response.posts[postIndex]; - return post; + return { queryIndex, post }; } diff --git a/src/config.ts b/src/config.ts index 4c9f0be..33fdc69 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,28 +1,34 @@ +const mainQuery = { + tags: [ + "feral", + "-anthro", + "-human", + "-meme", + "-humor", + "-photography_(artwork)", + "-portrait", + "-comic", + "-saliva", + "-friendship_is_magic", + "-my_little_pony", + "-type:swf", + "-type:webm", + "-type:gif", + "status:active", + "score:>=20", + "inpool:false", + ], + maxPage: 131, +}; + export default { e621: { userAgent: "@feralbot@botsin.space (by RedFoxxo)", queries: [ + mainQuery, { - tags: [ - "feral", - "-anthro", - "-human", - "-meme", - "-humor", - "-photography_(artwork)", - "-portrait", - "-comic", - "-saliva", - "-friendship_is_magic", - "-my_little_pony", - "-type:swf", - "-type:webm", - "-type:gif", - "status:active", - "score:>=20", - "inpool:false", - ], - maxPage: 131, + tags: [...mainQuery.tags, "-western_dragon"], + maxPage: 96, }, ], }, diff --git a/src/index.ts b/src/index.ts index 42081e6..34cd5f1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,17 +4,17 @@ import config from "./config"; (async () => { if (!config.mastodon.token) { - console.error("MASTODON_TOKEN not set"); - return; + console.error("MASTODON_TOKEN not set"); + return; } console.log("Fetching post..."); - const post = await e621.randomPost(); + const { queryIndex, post } = await e621.randomPost(); const source = post.sources.length ? post.sources[0] : undefined; const cws = config.cw.filter((w) => post.tags.general.includes(w)); - console.log(`Got ${post.id}`); + console.log(`Got ${post.id} via query ${queryIndex}`); console.log(`Downloading image...`); const file = await e621.client.get(post.file.url).buffer(); -- cgit v1.2.3-70-g09d2