| 2 | const fs = require('fs'); |
| 3 | const notifyPath = '/scripts/logs/notify.txt'; |
| 4 | async function image_update_notify() { |
| 5 | if (fs.existsSync(notifyPath)) { |
| 6 | const content = await fs.readFileSync(`${notifyPath}`, 'utf8');//读取notify.txt内容 |
| 7 | if (process.env.NOTIFY_CONTENT && !content.includes(process.env.NOTIFY_CONTENT)) { |
| 8 | await notify.sendNotify("⚠️Docker镜像版本更新通知⚠️", process.env.NOTIFY_CONTENT); |
| 9 | await fs.writeFileSync(`${notifyPath}`, process.env.NOTIFY_CONTENT); |
| 10 | } |
| 11 | } else { |
| 12 | if (process.env.NOTIFY_CONTENT) { |
| 13 | notify.sendNotify("⚠️Docker镜像版本更新通知⚠️", process.env.NOTIFY_CONTENT) |
| 14 | await fs.writeFileSync(`${notifyPath}`, process.env.NOTIFY_CONTENT); |
| 15 | } |
| 16 | } |
| 17 | } |
| 18 | !(async() => { |
| 19 | await image_update_notify(); |
| 20 | })().catch((e) => console.log(e)) |