Files
KalBot/lib/notify.js

22 lines
452 B
JavaScript

/**
* Send a push notification via ntfy.
*/
export async function notify(message, title = 'Kalbot', priority = 'default', tags = 'robot') {
const url = process.env.NTFY_URL;
if (!url) return;
try {
await fetch(url, {
method: 'POST',
body: message,
headers: {
'Title': title,
'Priority': priority,
'Tags': tags
}
});
} catch (e) {
console.error('[Notify] Error:', e.message);
}
}