Wired Wednesday and Five Dollar Friday Telegram kickoffs at 5 AM CT (kickHour setting, was hard-coded 9 AM)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
// purchase indexes and labelled in the credit log. The day's wave is shown live (landing strip,
|
// purchase indexes and labelled in the credit log. The day's wave is shown live (landing strip,
|
||||||
// Overview card, /api/friday), posted to Telegram at every ten packs and wrapped up at midnight,
|
// Overview card, /api/friday), posted to Telegram at every ten packs and wrapped up at midnight,
|
||||||
// and five Fridays in a row earn the Five Fridays badge. Thursday 6 PM CT: an on-site notice and
|
// and five Fridays in a row earn the Five Fridays badge. Thursday 6 PM CT: an on-site notice and
|
||||||
// an email to active members (drip unsubscribes honoured). Friday 9 AM CT: the Telegram kickoff.
|
// an email to active members (drip unsubscribes honoured). Friday 5 AM CT: the Telegram kickoff.
|
||||||
//
|
//
|
||||||
// Settings (siteConfig): fridayPromo '1'|'0', fridayBonusPct (20), fridayStart 'YYYY-MM-DD' (first
|
// Settings (siteConfig): fridayPromo '1'|'0', fridayBonusPct (20), fridayStart 'YYYY-MM-DD' (first
|
||||||
// Friday, 2026-09-25). Everything reads the chain index, never a marketing counter.
|
// Friday, 2026-09-25). Everything reads the chain index, never a marketing counter.
|
||||||
@@ -29,6 +29,7 @@ function cfg() {
|
|||||||
return {
|
return {
|
||||||
on: String(c.fridayPromo == null ? '1' : c.fridayPromo) === '1',
|
on: String(c.fridayPromo == null ? '1' : c.fridayPromo) === '1',
|
||||||
pct: Math.max(0, Number(c.fridayBonusPct) || 20),
|
pct: Math.max(0, Number(c.fridayBonusPct) || 20),
|
||||||
|
kickHour: Math.min(23, Math.max(0, Number(c.fridayKickHour == null ? 5 : c.fridayKickHour) || 0)), // Central hour of the Telegram kickoff (Marty 2026-10-07: 5 AM, was 9)
|
||||||
start: String(c.fridayStart || '2026-09-25'),
|
start: String(c.fridayStart || '2026-09-25'),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -102,7 +103,7 @@ function earnedBadge(memberId) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// scheduled moments, checked every few minutes: Thursday 18:00 CT notice + email, Friday 09:00 CT kickoff,
|
// scheduled moments, checked every few minutes: Thursday 18:00 CT notice + email, Friday kickoff at kickHour (5 AM CT),
|
||||||
// Saturday 00:xx CT wrap-up of the Friday that just ended
|
// Saturday 00:xx CT wrap-up of the Friday that just ended
|
||||||
async function tick() {
|
async function tick() {
|
||||||
const c = cfg(); if (!c.on) return;
|
const c = cfg(); if (!c.on) return;
|
||||||
@@ -114,7 +115,7 @@ async function tick() {
|
|||||||
const text = 'Tomorrow is Five Dollar Friday on InstantAdPay.\n\nAny ad package of $5 or more bought on Friday (Central time) earns +' + c.pct + '% bonus credits, added the moment the purchase settles. Your $5 pays your sponsor line the second it clears, and your line’s $5s pay you. Friday is when we all push at once.\n\nLine up your pack: https://instantadpay.com/my#buy\nWatch the wave on the live ledger: https://instantadpay.com/ledger';
|
const text = 'Tomorrow is Five Dollar Friday on InstantAdPay.\n\nAny ad package of $5 or more bought on Friday (Central time) earns +' + c.pct + '% bonus credits, added the moment the purchase settles. Your $5 pays your sponsor line the second it clears, and your line’s $5s pay you. Friday is when we all push at once.\n\nLine up your pack: https://instantadpay.com/my#buy\nWatch the wave on the live ledger: https://instantadpay.com/ledger';
|
||||||
await broadcast(subject, text);
|
await broadcast(subject, text);
|
||||||
}
|
}
|
||||||
if (wd === 'Fri' && h >= 9 && day >= c.start && !S.sent['kick:' + day] && await claimOnce('fri:kick:' + day)) {
|
if (wd === 'Fri' && h >= c.kickHour && day >= c.start && !S.sent['kick:' + day] && await claimOnce('fri:kick:' + day)) {
|
||||||
S.sent['kick:' + day] = now; save();
|
S.sent['kick:' + day] = now; save();
|
||||||
X.telegram('\u{1F4B5} <b>It’s Five Dollar Friday.</b> Any ad package from $5 up earns <b>+' + c.pct + '% credits</b> today, and every pack pays its sponsor line in the same transaction. Buy yours, then watch the ledger fill up: https://instantadpay.com/my#buy').catch(() => {});
|
X.telegram('\u{1F4B5} <b>It’s Five Dollar Friday.</b> Any ad package from $5 up earns <b>+' + c.pct + '% credits</b> today, and every pack pays its sponsor line in the same transaction. Buy yours, then watch the ledger fill up: https://instantadpay.com/my#buy').catch(() => {});
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-3
@@ -35,6 +35,7 @@ function cfg() {
|
|||||||
on: String(c.wednesdayPromo == null ? '1' : c.wednesdayPromo) === '1',
|
on: String(c.wednesdayPromo == null ? '1' : c.wednesdayPromo) === '1',
|
||||||
pct: Math.max(0, Number(c.wednesdayBonusPct) || 25),
|
pct: Math.max(0, Number(c.wednesdayBonusPct) || 25),
|
||||||
minCents: Math.max(0, Number(c.wednesdayMinCents) || 2000),
|
minCents: Math.max(0, Number(c.wednesdayMinCents) || 2000),
|
||||||
|
kickHour: Math.min(23, Math.max(0, Number(c.wednesdayKickHour == null ? 5 : c.wednesdayKickHour) || 0)), // Central hour of the Telegram kickoff (Marty 2026-10-07: 5 AM, was 9)
|
||||||
start: String(c.wednesdayStart || '2026-09-30'),
|
start: String(c.wednesdayStart || '2026-09-30'),
|
||||||
notice: String(c.wednesdayNotice || '0') === '1',
|
notice: String(c.wednesdayNotice || '0') === '1',
|
||||||
noticeHour: Math.min(23, Math.max(0, Number(c.wednesdayNoticeHour == null ? 18 : c.wednesdayNoticeHour) || 0)), // Central hour the Tuesday notice + email go out (Marty 09-29: earlier than 6 PM)
|
noticeHour: Math.min(23, Math.max(0, Number(c.wednesdayNoticeHour == null ? 18 : c.wednesdayNoticeHour) || 0)), // Central hour the Tuesday notice + email go out (Marty 09-29: earlier than 6 PM)
|
||||||
@@ -100,7 +101,7 @@ async function onEvent(ev) {
|
|||||||
return bonus;
|
return bonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tuesday 18:00 CT notice + email (when approved), Wednesday 09:00 CT kickoff (when approved),
|
// Tuesday 18:00 CT notice + email (when approved), Wednesday kickoff at kickHour (5 AM CT) (when approved),
|
||||||
// Thursday 00:xx CT wrap-up of the Wednesday that just ended
|
// Thursday 00:xx CT wrap-up of the Wednesday that just ended
|
||||||
async function tick() {
|
async function tick() {
|
||||||
const c = cfg(); if (!c.on) return;
|
const c = cfg(); if (!c.on) return;
|
||||||
@@ -111,7 +112,7 @@ async function tick() {
|
|||||||
if (c.tuePost) X.telegram(headsUpText(c)).catch(() => {});
|
if (c.tuePost) X.telegram(headsUpText(c)).catch(() => {});
|
||||||
await broadcast('Tomorrow is Wired Wednesday', noticeText(c));
|
await broadcast('Tomorrow is Wired Wednesday', noticeText(c));
|
||||||
}
|
}
|
||||||
if (c.kick && wd === 'Wed' && h >= 9 && day >= c.start && !S.sent['kick:' + day] && await claimOnce('wed:kick:' + day)) {
|
if (c.kick && wd === 'Wed' && h >= c.kickHour && day >= c.start && !S.sent['kick:' + day] && await claimOnce('wed:kick:' + day)) {
|
||||||
S.sent['kick:' + day] = now; save();
|
S.sent['kick:' + day] = now; save();
|
||||||
X.telegram(kickoffText(c)).catch(() => {});
|
X.telegram(kickoffText(c)).catch(() => {});
|
||||||
}
|
}
|
||||||
@@ -158,7 +159,7 @@ async function broadcast(subject, text) {
|
|||||||
// what Marty reviews before switching the notice and kickoff on
|
// what Marty reviews before switching the notice and kickoff on
|
||||||
function previews() { const c = cfg(); return { notice: { subject: 'Tomorrow is Wired Wednesday', text: noticeText(c) }, headsUp: headsUpText(c).replace(/<[^>]+>/g, ''), kickoff: kickoffText(c).replace(/<[^>]+>/g, ''), noticeHour: c.noticeHour, tuePost: c.tuePost }; }
|
function previews() { const c = cfg(); return { notice: { subject: 'Tomorrow is Wired Wednesday', text: noticeText(c) }, headsUp: headsUpText(c).replace(/<[^>]+>/g, ''), kickoff: kickoffText(c).replace(/<[^>]+>/g, ''), noticeHour: c.noticeHour, tuePost: c.tuePost }; }
|
||||||
|
|
||||||
// admin: post the kickoff now instead of waiting for 09:00 CT; marks the day sent so the tick never repeats it (Marty, 2026-09-30)
|
// admin: post the kickoff now instead of waiting for the kickoff hour; marks the day sent so the tick never repeats it (Marty, 2026-09-30)
|
||||||
async function kickNow() {
|
async function kickNow() {
|
||||||
const c = cfg(); const now = Date.now(); const day = dayOf(now);
|
const c = cfg(); const now = Date.now(); const day = dayOf(now);
|
||||||
if (!isWednesday(now)) return { error: 'It is not Wednesday in Central time.' };
|
if (!isWednesday(now)) return { error: 'It is not Wednesday in Central time.' };
|
||||||
|
|||||||
Reference in New Issue
Block a user