This commit is contained in:
parent
770813b4a7
commit
5b487125aa
7
index.js
7
index.js
|
@ -377,13 +377,14 @@ xmpp.on("stanza", (stanza) => {
|
|||
const now = new Date();
|
||||
const diff = (now - product_id.timestamp) / 1000 / 60;
|
||||
if (diff > 3) return;
|
||||
if (config.debug >= 1) console.log(`${colors.magenta("[DEBUG]")} New message from ${fromChannel}`);
|
||||
// if (config.debug >= 1) console.log(`${colors.magenta("[DEBUG]")} New message from ${fromChannel}`);
|
||||
console.log(`${colors.cyan("[INFO]")} ${getWFO(fromChannel)?.location || fromChannel} issues ${evt.name}`)
|
||||
messages++;
|
||||
|
||||
|
||||
// Handle NTFY
|
||||
if (config.ntfy.enabled) {
|
||||
if (config.debug >= 1) console.log(`${colors.magenta("[DEBUG]")} Sending NTFY for ${config.ntfy.prefix}${fromChannel}`)
|
||||
//if (config.debug >= 1) console.log(`${colors.magenta("[DEBUG]")} Sending NTFY for ${config.ntfy.prefix}${fromChannel}`)
|
||||
ntfyBody = {
|
||||
"topic": `${config.ntfy.prefix}${fromChannel}`,
|
||||
"message": bodyData.string,
|
||||
|
@ -401,7 +402,7 @@ xmpp.on("stanza", (stanza) => {
|
|||
'Authorization': `Bearer ${config.ntfy.token}`
|
||||
}
|
||||
}).then((res) => {
|
||||
if (config.debug >= 1) console.log(`${colors.magenta("[DEBUG]")} NTFY sent for ${config.ntfy.prefix}${fromChannel} with status ${res.status} ${res.statusText}`);
|
||||
//if (config.debug >= 1) console.log(`${colors.magenta("[DEBUG]")} NTFY sent for ${config.ntfy.prefix}${fromChannel} with status ${res.status} ${res.statusText}`);
|
||||
if (res.status !== 200) console.log(`${colors.red("[ERROR]")} NTFY failed for ${config.ntfy.prefix}${fromChannel} with status ${res.status} ${res.statusText}`);
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue