Change tease to random frequency with 2-day minimum spacing

Replaces 2x_week cap with random posting: enforces minDays gap
then 50% chance each eligible day for natural randomness.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Matt Jackson
2026-03-07 23:05:31 +00:00
parent aba0415fe5
commit 1067ec2f78
2 changed files with 9 additions and 19 deletions

21
bot.js
View File

@@ -35,25 +35,14 @@ function shouldRun(promptConfig) {
return true;
}
if (promptConfig.frequency === "2x_week") {
// Max 2 per week
const dayOfWeek = now.getDay();
const mondayOffset = dayOfWeek === 0 ? 6 : dayOfWeek - 1;
const monday = new Date(now);
monday.setDate(monday.getDate() - mondayOffset);
monday.setHours(0, 0, 0, 0);
const thisWeekPosts = history.filter((h) => new Date(h.date) >= monday);
if (thisWeekPosts.length >= 2) return false;
// Min 2 days between posts
if (promptConfig.frequency === "random" && promptConfig.minDays) {
if (history.length > 0) {
const lastPost = new Date(history[history.length - 1].date);
const daysSinceLast = (now - lastPost) / (1000 * 60 * 60 * 24);
if (daysSinceLast < 2) return false;
if (daysSinceLast < promptConfig.minDays) return false;
}
return true;
// Random chance so it doesn't always fire on the minimum day
return Math.random() < 0.5;
}
return true;
@@ -236,7 +225,7 @@ async function main() {
}
if (!shouldRun(promptConfig)) {
console.log(`"${promptName}" already hit its limit this week. Skipping.`);
console.log(`"${promptName}" skipped (too soon or random skip). Next time.`);
process.exit(0);
}