summaryrefslogtreecommitdiffstats
path: root/src/index.ts
blob: 6e9ad2e809c4e5baceabea823bf6935daad9ffb7 (plain) (blame)
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
import config from "./config";
import * as jobs from "./jobs";
import * as cliArgs from "ts-command-line-args";

const args = cliArgs.parse<{
    id?: number;
    help?: boolean;
}>(
    {
        id: { type: Number, optional: true },
        help: { type: Boolean, optional: true, alias: "h" },
    },
    {
        helpArg: "help",
    }
);

(async () => {
    if (!config.mastodon.token) {
        console.error("MASTODON_TOKEN not set");
        return;
    }

    if (args.id) {
        await jobs.postSpecificPicture(args.id);
    } else {
        await jobs.postRandomPicture();
    }
})();