discord notifications more verbose
parent
1684ebe8ea
commit
54f51557e3
|
|
@ -0,0 +1,84 @@
|
||||||
|
module.exports = {
|
||||||
|
"person": "🙅♂️",
|
||||||
|
"bicycle": "🚲",
|
||||||
|
"car": "🚗",
|
||||||
|
"motorcycle": "🏍",
|
||||||
|
"airplane": "✈️",
|
||||||
|
"bus": "🚌",
|
||||||
|
"train": "🚂",
|
||||||
|
"truck": "🚚",
|
||||||
|
"boat": "⛵",
|
||||||
|
"traffic light": "🚦",
|
||||||
|
"fire hydrant": "🚒",
|
||||||
|
"stop sign": "🛑",
|
||||||
|
"parking meter": "🅿️",
|
||||||
|
"bench": "🪑",
|
||||||
|
"bird": "🐦",
|
||||||
|
"cat": "🐈",
|
||||||
|
"dog": "🐕",
|
||||||
|
"horse": "🐎",
|
||||||
|
"sheep": "🐏",
|
||||||
|
"cow": "🐄",
|
||||||
|
"elephant": "🐘",
|
||||||
|
"bear": "🐻",
|
||||||
|
"zebra": "🦓",
|
||||||
|
"giraffe": "🦒",
|
||||||
|
"backpack": "🎒",
|
||||||
|
"umbrella": "☂️",
|
||||||
|
"handbag": "👜",
|
||||||
|
"tie": "👔",
|
||||||
|
"suitcase": "🧳",
|
||||||
|
"frisbee": "🥏",
|
||||||
|
"skis": "🎿",
|
||||||
|
"snowboard": "🏂",
|
||||||
|
"sports ball": "⚽",
|
||||||
|
"kite": "🪁",
|
||||||
|
"skateboard": "🛹",
|
||||||
|
"surfboard": "🏄",
|
||||||
|
"tennis racket": "🎾",
|
||||||
|
"bottle": "🍼",
|
||||||
|
"wine glass": "🍷",
|
||||||
|
"cup": "☕",
|
||||||
|
"fork": "🍴",
|
||||||
|
"knife": "🔪",
|
||||||
|
"spoon": "🥄",
|
||||||
|
"bowl": "🍲",
|
||||||
|
"banana": "🍌",
|
||||||
|
"apple": "🍏",
|
||||||
|
"sandwich": "🥪",
|
||||||
|
"orange": "🍊",
|
||||||
|
"broccoli": "🥦",
|
||||||
|
"carrot": "🥕",
|
||||||
|
"hot dog": "🌭",
|
||||||
|
"pizza": "🍕",
|
||||||
|
"donut": "🍩",
|
||||||
|
"cake": "🍰",
|
||||||
|
"chair": "🪑",
|
||||||
|
"couch": "🛋",
|
||||||
|
"potted plant": "🪴",
|
||||||
|
"bed": "🛏",
|
||||||
|
"toilet": "🚽",
|
||||||
|
"tv": "📺",
|
||||||
|
"laptop": "💻",
|
||||||
|
"mouse": "🖱",
|
||||||
|
"remote": "📱",
|
||||||
|
"keyboard": "⌨️",
|
||||||
|
"cell phone": "📱",
|
||||||
|
"microwave": "🌊",
|
||||||
|
"toaster": "🍞",
|
||||||
|
"refrigerator": "🍽",
|
||||||
|
"book": "📚",
|
||||||
|
"clock": "⏰",
|
||||||
|
"vase": "🏺",
|
||||||
|
"scissors": "✂️",
|
||||||
|
"teddy bear": "🧸",
|
||||||
|
"hair drier": "💨",
|
||||||
|
"toothbrush": "🪥",
|
||||||
|
"baseball bat": "🏏",
|
||||||
|
"baseball glove": "🥅",
|
||||||
|
"dining table": "🍽",
|
||||||
|
"oven": "🔥",
|
||||||
|
"sink": "🚰",
|
||||||
|
"Clock Format": "⏲",
|
||||||
|
"_default": "🏃♂️"
|
||||||
|
}
|
||||||
|
|
@ -1552,6 +1552,7 @@
|
||||||
"MQTT Outbound": "MQTT Outbound",
|
"MQTT Outbound": "MQTT Outbound",
|
||||||
"MQTT Client": "MQTT Client",
|
"MQTT Client": "MQTT Client",
|
||||||
"Buffer Time from Event": "Buffer Time from Event",
|
"Buffer Time from Event": "Buffer Time from Event",
|
||||||
|
"detected": "detected",
|
||||||
"fieldTextEventFilters": "Enable to have all Events honor your Event Filter rules.",
|
"fieldTextEventFilters": "Enable to have all Events honor your Event Filter rules.",
|
||||||
"fieldTextBufferTimeFromEvent": "The amount of seconds to record before the trigger happened. If this is consistently inaccurate you will need to look at the <a target='_blank' href='https://hub.shinobi.video/articles/view/DmWIID78VtvEfnf'>optimization guide</a> or force encoding on the server.",
|
"fieldTextBufferTimeFromEvent": "The amount of seconds to record before the trigger happened. If this is consistently inaccurate you will need to look at the <a target='_blank' href='https://hub.shinobi.video/articles/view/DmWIID78VtvEfnf'>optimization guide</a> or force encoding on the server.",
|
||||||
"fieldTextMode": "This is the primary task of the monitor.",
|
"fieldTextMode": "This is the primary task of the monitor.",
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ module.exports = (s,config,lang) => {
|
||||||
isEven,
|
isEven,
|
||||||
fetchTimeout,
|
fetchTimeout,
|
||||||
} = require('../basic/utils.js')(process.cwd(),config)
|
} = require('../basic/utils.js')(process.cwd(),config)
|
||||||
|
const glyphs = require('../../definitions/glyphs.js')
|
||||||
async function saveImageFromEvent(options,frameBuffer){
|
async function saveImageFromEvent(options,frameBuffer){
|
||||||
const monitorId = options.mid || options.id
|
const monitorId = options.mid || options.id
|
||||||
const groupKey = options.ke
|
const groupKey = options.ke
|
||||||
|
|
@ -828,7 +829,27 @@ module.exports = (s,config,lang) => {
|
||||||
|
|
||||||
return newRegions;
|
return newRegions;
|
||||||
}
|
}
|
||||||
|
function getTagWithIcon(tag){
|
||||||
|
var icon = glyphs[tag.toLowerCase()] || glyphs._default
|
||||||
|
return `${icon} ${tag}`;
|
||||||
|
}
|
||||||
|
function getObjectTagsFromMatrices(d){
|
||||||
|
if(d.details.reason === 'motion'){
|
||||||
|
return [getTagWithIcon(lang.Motion)]
|
||||||
|
}else{
|
||||||
|
const matrices = d.details.matrices
|
||||||
|
return [...new Set(matrices.map(matrix => getTagWithIcon(matrix.tag)))];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function getObjectTagNotifyText(d){
|
||||||
|
const monitorId = d.mid || d.id
|
||||||
|
const monitorName = s.group[d.ke].rawMonitorConfigurations[monitorId].name
|
||||||
|
const tags = getObjectTagsFromMatrices(d)
|
||||||
|
return `${tags.join(', ')} ${lang.detected} in ${monitorName}`
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
|
getObjectTagNotifyText,
|
||||||
|
getObjectTagsFromMatrices,
|
||||||
countObjects: countObjects,
|
countObjects: countObjects,
|
||||||
isAtleastOneMatrixInRegion,
|
isAtleastOneMatrixInRegion,
|
||||||
convertRegionPointsToNewDimensions,
|
convertRegionPointsToNewDimensions,
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ var fs = require("fs")
|
||||||
var Discord = require("discord.js")
|
var Discord = require("discord.js")
|
||||||
module.exports = function(s,config,lang,getSnapshot){
|
module.exports = function(s,config,lang,getSnapshot){
|
||||||
const {
|
const {
|
||||||
|
getObjectTagNotifyText,
|
||||||
getEventBasedRecordingUponCompletion,
|
getEventBasedRecordingUponCompletion,
|
||||||
} = require('../events/utils.js')(s,config,lang)
|
} = require('../events/utils.js')(s,config,lang)
|
||||||
//discord bot
|
//discord bot
|
||||||
|
|
@ -56,6 +57,8 @@ module.exports = function(s,config,lang,getSnapshot){
|
||||||
//discord bot
|
//discord bot
|
||||||
const isEnabled = filter.discord || monitorConfig.details.detector_discordbot === '1' || monitorConfig.details.notify_discord === '1'
|
const isEnabled = filter.discord || monitorConfig.details.detector_discordbot === '1' || monitorConfig.details.notify_discord === '1'
|
||||||
if(s.group[d.ke].discordBot && isEnabled && !s.group[d.ke].activeMonitors[d.id].detector_discordbot){
|
if(s.group[d.ke].discordBot && isEnabled && !s.group[d.ke].activeMonitors[d.id].detector_discordbot){
|
||||||
|
const monitorName = s.group[d.ke].rawMonitorConfigurations[d.id].name
|
||||||
|
const notifyText = getObjectTagNotifyText(d)
|
||||||
var detector_discordbot_timeout
|
var detector_discordbot_timeout
|
||||||
if(!monitorConfig.details.detector_discordbot_timeout||monitorConfig.details.detector_discordbot_timeout===''){
|
if(!monitorConfig.details.detector_discordbot_timeout||monitorConfig.details.detector_discordbot_timeout===''){
|
||||||
detector_discordbot_timeout = 1000 * 60 * 10;
|
detector_discordbot_timeout = 1000 * 60 * 10;
|
||||||
|
|
@ -70,11 +73,11 @@ module.exports = function(s,config,lang,getSnapshot){
|
||||||
if(d.screenshotBuffer){
|
if(d.screenshotBuffer){
|
||||||
sendMessage({
|
sendMessage({
|
||||||
author: {
|
author: {
|
||||||
name: s.group[d.ke].rawMonitorConfigurations[d.id].name,
|
name: monitorName,
|
||||||
icon_url: config.iconURL
|
icon_url: config.iconURL
|
||||||
},
|
},
|
||||||
title: lang.Event+' - '+d.screenshotName,
|
title: notifyText,
|
||||||
description: lang.EventText1+' '+d.currentTimestamp,
|
description: notifyText+' '+d.currentTimestamp,
|
||||||
fields: [],
|
fields: [],
|
||||||
timestamp: d.currentTime,
|
timestamp: d.currentTime,
|
||||||
footer: {
|
footer: {
|
||||||
|
|
@ -84,7 +87,7 @@ module.exports = function(s,config,lang,getSnapshot){
|
||||||
},[
|
},[
|
||||||
{
|
{
|
||||||
attachment: d.screenshotBuffer,
|
attachment: d.screenshotBuffer,
|
||||||
name: d.screenshotName+'.jpg'
|
name: notifyText + '.jpg'
|
||||||
}
|
}
|
||||||
],d.ke)
|
],d.ke)
|
||||||
}
|
}
|
||||||
|
|
@ -106,20 +109,21 @@ module.exports = function(s,config,lang,getSnapshot){
|
||||||
if(videoPath){
|
if(videoPath){
|
||||||
sendMessage({
|
sendMessage({
|
||||||
author: {
|
author: {
|
||||||
name: s.group[d.ke].rawMonitorConfigurations[d.id].name,
|
name: monitorName,
|
||||||
icon_url: config.iconURL
|
icon_url: config.iconURL
|
||||||
},
|
},
|
||||||
title: videoName,
|
title: `${notifyText}`,
|
||||||
|
description: notifyText,
|
||||||
fields: [],
|
fields: [],
|
||||||
timestamp: d.currentTime,
|
timestamp: d.currentTime,
|
||||||
footer: {
|
footer: {
|
||||||
icon_url: config.iconURL,
|
icon_url: config.iconURL,
|
||||||
text: "Shinobi Systems"
|
text: "Shinobi Systems"
|
||||||
}
|
}
|
||||||
},[
|
},[
|
||||||
{
|
{
|
||||||
attachment: videoPath,
|
attachment: videoPath,
|
||||||
name: videoName
|
name: notifyText + '.mp4'
|
||||||
}
|
}
|
||||||
],d.ke)
|
],d.ke)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue