fix: move birthday check inside main to get current date

This commit is contained in:
2026-09-25 09:06:48 +05:30
parent 35dfc880e7
commit d7aaf8b775
+2 -4
View File
@@ -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")}**.