Add alert

This commit is contained in:
brunosimon
2017-08-15 18:13:14 +02:00
parent 4b4977cc1b
commit 0ff61b0c99
14 changed files with 93 additions and 9 deletions
+19 -2
View File
@@ -1,7 +1,7 @@
'use strict'
const ids = require('./ids.js')
const robotNames = require('./robot-names.json')
const nodeNotifier = require('node-notifier')
const path = require('path')
class Chat
{
@@ -94,6 +94,23 @@ class Chat
}
})
// On alert
socket.on('alert', () =>
{
nodeNotifier.notify({
title: 'Keppler',
message: 'Alert!',
icon: path.join(__dirname, 'assets/images/notification-icon-200x200.png'),
wait: true
})
// Debug
if(this.config.debug >= 1)
{
console.log('chat > socket'.green.bold + ' - ' + 'alert'.cyan + ' - ' + user.name.cyan)
}
})
// On disconnect
socket.on('disconnect', () =>
{