Skip to content

Commit

Permalink
Add variations to messages (#7)
Browse files Browse the repository at this point in the history
* Add variations to summary message

* Add variations to thanks message

* Add variations to milestone message
  • Loading branch information
MattIPv4 authored Nov 13, 2024
1 parent 7a414db commit 5450a57
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 16 deletions.
8 changes: 6 additions & 2 deletions src/scheduled/milestone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@ const milestoneScheduled = async (
const content = [
`# ${emojiRegular(env, "hype")} ${money("£", recentMilestone, false)}`,
"",
`${emojiRegular(env, "mascot")} Jingle Jam ${stats.event.year} just hit a new milestone, with ${totalRaised} raised so far through the Yogscast and fundraisers.`,
`:black_small_square: There have already been ${collections} Games Collections claimed, and our ${countFundraisers} fundraisers have raised ${totalFundraisers}!`,
Math.random() < 0.5
? `${emojiRegular(env, "mascot")} Jingle Jam ${stats.event.year} just hit a new milestone, with ${totalRaised} raised so far through the Yogscast and fundraisers.`
: `${emojiRegular(env, "mascot")} A new milestone has been reached! Jingle Jam ${stats.event.year} has raised ${totalRaised} so far through the Yogscast and fundraisers.`,
Math.random() < 0.5
? `:black_small_square: There have already been ${collections} Games Collections claimed, and our ${countFundraisers} fundraisers have raised ${totalFundraisers}!`
: `:black_small_square: ${collections} Games Collections have already been claimed, and our ${countFundraisers} fundraisers have raised ${totalFundraisers}!`,
"",
thanks(new Date(stats.event.end), stats.event.year, env),
].join("\n");
Expand Down
32 changes: 22 additions & 10 deletions src/scheduled/summary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,28 @@ const summaryScheduled = async (
const content = [
`# ${emojiRegular(env, "mascot")} Jingle Jam ${stats.event.year} Day ${daysSinceLaunch} Summary`,
"",
`${emojiRegular(env, "happy")} ${
ended ? "We" : "We've"
} raised a total of ${totalRaised} for charity over the ${timeElapsed} of Jingle Jam ${
stats.event.year
}${ended ? "!" : " so far!"}`,
`:black_small_square: There ${
ended ? "were" : "have already been"
} ${collections} Games Collections redeemed, and ${fundraisers} fundraisers ${
ended ? "joined" : "have joined"
} to raise money for charity.`,
Math.random() < 0.5
? `${emojiRegular(env, "happy")} ${
ended ? "We" : "We've"
} raised a total of ${totalRaised} for charity over the ${timeElapsed} of Jingle Jam ${
stats.event.year
}${ended ? "!" : " so far!"}`
: `${emojiRegular(env, "happy")} ${
ended ? "We" : "We've"
} raised ${totalRaised} for charity in just ${timeElapsed} of Jingle Jam ${
stats.event.year
}!`,
Math.random() < 0.5
? `:black_small_square: There ${
ended ? "were" : "have already been"
} ${collections} Games Collections redeemed, and ${fundraisers} fundraisers ${
ended ? "joined" : "have joined"
} to raise money for charity.`
: `:black_small_square: ${collections} Games Collections ${
ended ? "were" : "have already been"
} redeemed, and ${fundraisers} fundraisers ${
ended ? "joined" : "have joined"
} the cause.`,
"",
causesBreakdown(stats, env),
"",
Expand Down
12 changes: 8 additions & 4 deletions src/util/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,14 @@ export const thanks = (end: Date, year: number, env: Env) => {

// Otherwise, show the time remaining
return (
`${emojiRegular(env, "love")} Thank you for supporting some wonderful causes!` +
`\n:mega: There ${
/^(\D*1|less) /.test(timeRemaining) ? "is" : "are"
} still ${timeRemaining} remaining to get involved and grab the collection at <https://jinglejam.co.uk/donate>`
(Math.random() < 0.5
? `${emojiRegular(env, "love")} Thank you for supporting some wonderful causes!`
: `${emojiRegular(env, "love")} Your support means the world to these amazing causes. Thank you!`) +
(Math.random() < 0.5
? `\n:mega: There ${
/^(\D*1|less) /.test(timeRemaining) ? "is" : "are"
} still ${timeRemaining} remaining to get involved and grab the collection at <https://jinglejam.co.uk/donate>`
: `\n:mega: Keep the momentum going! With ${timeRemaining} left, grab your collection at <https://jinglejam.co.uk/donate>`)
);
};

Expand Down

0 comments on commit 5450a57

Please sign in to comment.