fix: move birthday check inside main to get current date
This commit is contained in:
@@ -8,15 +8,11 @@ const NTFY_URL = process.env.NTFY_URL
|
||||
const TOPIC = process.env.NTFY_TOPIC
|
||||
const TOKEN = process.env.NTFY_TOKEN
|
||||
|
||||
const isBirthday = dayjs().format("MM-DD") === "09-23"
|
||||
|
||||
if (!TOKEN || !NTFY_URL || !TOPIC) {
|
||||
console.error("ntfy token, url or topic not set")
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function main() {
|
||||
const [usd, usage, weather] = await Promise.all([
|
||||
getUSD(),
|
||||
@@ -24,6 +20,8 @@ async function main() {
|
||||
getWeather()
|
||||
])
|
||||
|
||||
const isBirthday = dayjs().format("MM-DD") === "09-23"
|
||||
|
||||
const message = `${isBirthday ? `Happy Birthday, SilicoFlare! You are now ${dayjs().diff(dayjs("2003-09-23"), "years")} years old.` : "Good Morning, SilicoFlare!"}
|
||||
|
||||
Today is **${dayjs().format("dddd, DD MMMM YYYY")}**.
|
||||
|
||||
Reference in New Issue
Block a user