Skip to content

Commit db56240

Browse files
authored
Update reminder.mjs
1 parent f4aa169 commit db56240

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

reminder.mjs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@ try {
3131
await page.locator('#user_password').fill(process.env.PASSWORD)
3232
await page.locator('text=ログインする').click()
3333
await page.waitForNavigation({ waitUntil: 'networkidle2' })
34-
// TODO: Alert Upcoming Expiration Notice with Email, Slack, Discord
34+
const expireDate = await page.$eval('tr:has(.freeServerIco) .contract__term', p => p.textContent)
35+
const tomorrow = new Date(Date.now() + 86400000).toLocaleDateString('sv', { timeZone: 'Asia/Tokyo' })
36+
console.log('expireDate', expireDate, 'tomorrow', tomorrow, expireDate === tomorrow)
37+
// 如果到期日是明天,则准备续期
38+
if (expireDate === tomorrow) {
39+
// TODO: Alert Upcoming Expiration Notice with Email, Slack, Discord
40+
}
3541
} catch (e) {
3642
console.error(e)
3743
} finally {

0 commit comments

Comments
 (0)