···3636 ```sh
3737 BLUESKY_USERNAME="your_bluesky_username"
3838 BLUESKY_PASSWORD="your_bluesky_password"
3939+ MIN_DELAY_HOURS=1
4040+ MAX_DELAY_HOURS=3
3941 ```
404241432. **Fill in Your Bluesky Credentials:**
+30-20
src/index.ts
···1111 service: "https://bsky.social",
1212});
13131414+// Function to get the maximum delay hours from environment
1515+function getMaxDelayHours() {
1616+ return parseInt(process.env.MAX_DELAY_HOURS) || 1; // Default to 1 if not set or invalid
1717+}
1818+1919+// Function to get the minimum delay hours from environment
2020+function getMinDelayHours() {
2121+ return parseInt(process.env.MIN_DELAY_HOURS) || 3; // Default to 3 if not set or invalid
2222+}
2323+2424+// Function to generate a random delay before the next post
2525+function getRandomDelay() {
2626+ const minHours = getMinDelayHours(); // Get minimum delay hours
2727+ const maxHours = getMaxDelayHours(); // Get maximum delay hours
2828+2929+ // Convert hours to seconds
3030+ const minDelaySeconds = minHours * 60 * 60;
3131+ const maxDelaySeconds = maxHours * 60 * 60;
3232+3333+ let randomDelay;
3434+ do {
3535+ // Generate a random number within the desired range (inclusive)
3636+ randomDelay =
3737+ Math.floor(Math.random() * (maxDelaySeconds - minDelaySeconds + 1)) +
3838+ minDelaySeconds;
3939+ } while (randomDelay < minDelaySeconds || randomDelay > maxDelaySeconds);
4040+4141+ return randomDelay;
4242+}
4343+1444// Main function for generating and posting wolf noise strings
1545async function main() {
1646 console.log("Main function called.");
···5686 console.error("Error during posting:", error);
5787 // You can optionally implement retry logic or notify someone here
5888 }
5959-}
6060-6161-// Function to generate a random delay before the next post
6262-function getRandomDelay() {
6363- const minHours = 1; // Minimum hours for delay
6464- const maxHours = 3; // Maximum hours for delay
6565-6666- // Convert hours to seconds
6767- const minDelaySeconds = minHours * 60 * 60;
6868- const maxDelaySeconds = maxHours * 60 * 60;
6969-7070- let randomDelay;
7171- do {
7272- // Generate a random number within the desired range (inclusive)
7373- randomDelay =
7474- Math.floor(Math.random() * (maxDelaySeconds - minDelaySeconds + 1)) +
7575- minDelaySeconds;
7676- } while (randomDelay < minDelaySeconds || randomDelay > maxDelaySeconds);
7777-7878- return randomDelay;
7989}
80908191// Function to run the main function in a loop with random delays