17 lines
506 B
TypeScript
17 lines
506 B
TypeScript
import { sendMsg } from "./push/qq";
|
|
import { sendWebPush } from "./webpush";
|
|
|
|
export function push(message: string) {
|
|
console.log(`[NOTIFICATION] ${new Date().toISOString()}: ${message}`)
|
|
|
|
const msg = `[WinUpdate] ${new Date().toLocaleString()}\n${message}`;
|
|
|
|
if (process.env.QQ_BOT_URL && process.env.QQ_BOT_TARGET_ID) {
|
|
sendMsg(msg, process.env.QQ_BOT_TARGET_ID, process.env.QQ_BOT_URL);
|
|
}
|
|
|
|
// Send Web Push
|
|
sendWebPush(message).catch(err => console.error("Web Push Error:", err));
|
|
}
|
|
|