add date check and fix send next post not working

This commit is contained in:
Fran Jurmanović
2023-10-14 01:04:04 +02:00
parent 162708812d
commit dd0b7cde36
6 changed files with 41 additions and 11 deletions

View File

@@ -22,12 +22,20 @@ const logger = pino(
fileTransport
);
async function jobRunner() {
try {
await sendNextMessage(client);
} catch (err) {
logger.error(err);
}
}
const taskPlugin = new Elysia({ prefix: "/job" })
.use(
cron({
name: "job",
pattern: config.CRON_LEGICA,
run: () => sendNextMessage(client),
run: jobRunner,
paused: true,
timezone: config.TIMEZONE,
})
@@ -143,9 +151,11 @@ const taskPlugin = new Elysia({ prefix: "/job" })
}
},
{
body: t.Object({
url: t.String(),
}),
body: t.Optional(
t.Object({
url: t.Optional(t.String()),
})
),
detail: {
summary: "Send legica-dana post to discord channels",
},