diff --git a/libs/notifications/discordBot.js b/libs/notifications/discordBot.js index ce144051..0f39e60a 100644 --- a/libs/notifications/discordBot.js +++ b/libs/notifications/discordBot.js @@ -66,6 +66,28 @@ module.exports = function(s,config,lang,getSnapshot){ clearTimeout(s.group[d.ke].activeMonitors[d.id].detector_discordbot); s.group[d.ke].activeMonitors[d.id].detector_discordbot = null },detector_discordbot_timeout) + await getSnapshot(d,monitorConfig) + if(d.screenshotBuffer){ + sendMessage({ + author: { + name: s.group[d.ke].rawMonitorConfigurations[d.id].name, + icon_url: config.iconURL + }, + title: lang.Event+' - '+d.screenshotName, + description: lang.EventText1+' '+d.currentTimestamp, + fields: [], + timestamp: d.currentTime, + footer: { + icon_url: config.iconURL, + text: "Shinobi Systems" + } + },[ + { + attachment: d.screenshotBuffer, + name: d.screenshotName+'.jpg' + } + ],d.ke) + } if(monitorConfig.details.detector_discordbot_send_video === '1'){ let videoPath = null let videoName = null @@ -102,28 +124,6 @@ module.exports = function(s,config,lang,getSnapshot){ ],d.ke) } } - await getSnapshot(d,monitorConfig) - if(d.screenshotBuffer){ - sendMessage({ - author: { - name: s.group[d.ke].rawMonitorConfigurations[d.id].name, - icon_url: config.iconURL - }, - title: lang.Event+' - '+d.screenshotName, - description: lang.EventText1+' '+d.currentTimestamp, - fields: [], - timestamp: d.currentTime, - footer: { - icon_url: config.iconURL, - text: "Shinobi Systems" - } - },[ - { - attachment: d.screenshotBuffer, - name: d.screenshotName+'.jpg' - } - ],d.ke) - } } } const onTwoFactorAuthCodeNotificationForDiscord = function(r){ diff --git a/libs/notifications/email.js b/libs/notifications/email.js index 86d4e41d..172aee73 100644 --- a/libs/notifications/email.js +++ b/libs/notifications/email.js @@ -149,6 +149,13 @@ module.exports = function(s,config,lang,getSnapshot){ } }) } + await getSnapshot(d,monitorConfig) + sendMail([ + { + filename: d.screenshotName + '.jpg', + content: d.screenshotBuffer + } + ]) if(monitorConfig.details.detector_mail_send_video === '1'){ let videoPath = null let videoName = null @@ -188,13 +195,6 @@ module.exports = function(s,config,lang,getSnapshot){ }) } } - await getSnapshot(d,monitorConfig) - sendMail([ - { - filename: d.screenshotName + '.jpg', - content: d.screenshotBuffer - } - ]) }) } } diff --git a/libs/notifications/emailByUser.js b/libs/notifications/emailByUser.js index ada1c17d..6f78f0c1 100644 --- a/libs/notifications/emailByUser.js +++ b/libs/notifications/emailByUser.js @@ -150,6 +150,13 @@ module.exports = function (s, config, lang, getSnapshot) { }), },files || [],d.ke) } + await getSnapshot(d,monitorConfig) + sendMail([ + { + filename: d.screenshotName + '.jpg', + content: d.screenshotBuffer + } + ]) if(monitorConfig.details.detector_mail_send_video === '1'){ let videoPath = null let videoName = null @@ -178,13 +185,6 @@ module.exports = function (s, config, lang, getSnapshot) { }) } } - await getSnapshot(d,monitorConfig) - sendMail([ - { - filename: d.screenshotName + '.jpg', - content: d.screenshotBuffer - } - ]) } }; diff --git a/libs/notifications/telegram.js b/libs/notifications/telegram.js index 88bd4c6f..c84629d0 100644 --- a/libs/notifications/telegram.js +++ b/libs/notifications/telegram.js @@ -68,6 +68,19 @@ module.exports = function(s,config,lang,getSnapshot){ clearTimeout(s.group[d.ke].activeMonitors[d.id].detector_telegrambot); s.group[d.ke].activeMonitors[d.id].detector_telegrambot = null },detector_telegrambot_timeout) + await getSnapshot(d,monitorConfig) + if(d.screenshotBuffer){ + sendMessage({ + title: lang.Event+' - '+d.screenshotName, + description: lang.EventText1+' '+d.currentTimestamp, + },[ + { + type: 'photo', + attachment: d.screenshotBuffer, + name: d.screenshotName+'.jpg' + } + ],d.ke) + } if(monitorConfig.details.detector_telegrambot_send_video === '1'){ // await asyncSetTimeout(3000) let videoPath = null @@ -96,19 +109,6 @@ module.exports = function(s,config,lang,getSnapshot){ ],d.ke) } } - await getSnapshot(d,monitorConfig) - if(d.screenshotBuffer){ - sendMessage({ - title: lang.Event+' - '+d.screenshotName, - description: lang.EventText1+' '+d.currentTimestamp, - },[ - { - type: 'photo', - attachment: d.screenshotBuffer, - name: d.screenshotName+'.jpg' - } - ],d.ke) - } } } const onTwoFactorAuthCodeNotificationForTelegram = function(r){