{"size": 507, "ext": "js", "max_stars_repo_path": "src/index.js", "max_stars_repo_name": "AadilVarsh/Reno", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/index.js", "max_issues_repo_name": "AadilVarsh/Reno", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/index.js", "max_forks_repo_name": "AadilVarsh/Reno", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 31.6875, "max_line_length": 79, "alphanum_fraction": 0.6627218935}
import cron from "node-cron";

import apodToday from "./apod.js";
import { readFileSync } from "fs";
import { createEmbed, createWebhookBody, postWebhook } from "./hookManager.js";

cron.schedule(process.env.CRON_TRIGGER, () => {
    apodToday().then(async (apodData) => {
        const { hooks } = JSON.parse(readFileSync("hooks.json", "utf-8"));
        const embed = createEmbed(apodData);
        const webhookBody = createWebhookBody(embed);

        await postWebhook(hooks, webhookBody);
    });
});
