···14141515// Main function for generating and posting wolf noise strings
1616async function main() {
1717+ console.log("Main function called.");
1818+1719 // Check for empty environment variables and abort if needed
1820 if (!process.env.BLUESKY_USERNAME || !process.env.BLUESKY_PASSWORD) {
1921 console.error(
···2830 identifier: process.env.BLUESKY_USERNAME!,
2931 password: process.env.BLUESKY_PASSWORD!,
3032 });
3333+ console.log("Logged in to Bluesky.");
31343235 // Generate a random wolf noise string
3336 let randomNoise;
···5154 // You can optionally implement retry logic or notify someone here
5255 }
5356}
5454-5555-// Run the main function immediately
5656-main();
57575858// Function to generate a random delay before the next post
5959function getRandomDelay() {
···7676const scheduleExpression = "0 * * * *"; // Every hour (used as a base for randomisation)
77777878const job = new CronJob(scheduleExpression, async () => {
7979+ console.log("Cron job triggered.");
7980 // Calculate a random delay before running the main function
8081 const delay = getRandomDelay();
8182 console.log(`Next post scheduled in approximately ${(delay / 3600).toFixed(2)} hours.`);
···8485 await new Promise((resolve) => setTimeout(resolve, delay * 1000));
85868687 // Run the main function
8787- main();
8888+ await main(); // Ensure to await the main function
8889});
89909091// Start the cron job
9191-job.start();
9292+console.log("Starting the cron job.");
9393+job.start();