This repository was archived by the owner on Mar 11, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscheduled.ts
More file actions
35 lines (31 loc) · 1.3 KB
/
scheduled.ts
File metadata and controls
35 lines (31 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* This file contains tasks that are scheduled, so Pylon can run them automatically at a specified time.
* Pylon is limited to 5 schedules at once. It may be necessary to combine schedules as more commands are created.
* Functions need to be exported to be run from here.
*/
import { deleteExpiredHangmans } from './commands/hangman';
import { deleteExpiredHotOrNots } from './commands/hotornot';
import { spawnJazzObjects, showJazzObjects } from './commands/jazz';
import { deleteExpiredStandoffs } from './commands/standoff';
import { tvShowRandomVideo } from './commands/tv';
// Run every hour
pylon.tasks.cron('delete_expired_embeds', '0 0 * * * *', async () => {
deleteExpiredHangmans();
deleteExpiredHotOrNots();
deleteExpiredStandoffs();
});
// Run every day at 14:00 UTC (0:00 AEST)
pylon.tasks.cron('delete_daily_claims', '0 0 14 * * * *', async () => {
let database = new pylon.KVNamespace('economy');
database.delete('dailyClaims');
});
// Run every day at 00:00 UTC (10:00 AEST)
pylon.tasks.cron('jazz_and_tv', '0 0 0 * * * *', async () => {
// Spawn Jazztronauts objects
spawnJazzObjects()
.then(() => {
showJazzObjects(null, true);
})
.catch(() => {}); // Do not do anything if the error is thrown for now.
// Show random video from TV
tvShowRandomVideo(null, null);
});