freifunk-bot

Modular parser for the hackerspace door status with handlers for multiple services
git clone git://archive.git.mtrnord.blog/MTRNord/freifunk-bot.git
Log | Files | Refs | README | LICENSE

commit 4b8ed44fec47f9e325d4ad0144225bc1773c3a2d
parent a4de510ab25a88a31a3acf53322204fbc03bb307
Author: Marcel Radzio <marcel@radzio-sh.de>
Date:   Fri, 11 Dec 2015 15:34:24 +0100

add new commands

Diffstat:
Mhandlers/irc.js | 20++++++++++++++++++--
Mmain.js | 4++--
2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/handlers/irc.js b/handlers/irc.js @@ -20,7 +20,7 @@ module.exports = { bot.send('nick', 'DoorBot'); bot.say('NickServ', 'identify DoorBotPass'); bot.join('#hackerspace'); - bot.say('#hackerspace', 'Door Bot is starting to watch on the Door Status'); + //bot.say('#hackerspace', 'Door Bot is starting to watch on the Door Status'); }) }, ircSend: function (door_status){ @@ -34,7 +34,23 @@ module.exports = { bot.addListener('message', function (from, to, message) { if (message == "!help"){ console.log(from + ' => ' + to + ': ' + message); - bot.say(from, "Here is your Help!\nCommand List:\n- !help - Shows this page.\n- !DoorStatus - Shows the actual Door Status in an PM\n- !DoorStatus channel - Shows the actual Door Status in the channel drom where it was run"); + bot.say(from, "Here is your Help!\nCommand List:\n- !help - Shows this page.\n- !DoorStatus - Shows the actual Door Status in an PM\n- !DoorStatus channel - Shows the actual Door Status in the channel drom where it was run\n- !where - Shows the address of the Nordlab e.V.\n- !who - Shows who is allowed to come to the Nordlab e.V.\n- !when - Shows who the Nordlab e.V. Hackerspace usually is open"); + } + if (message == "!hilfe"){ + console.log(from + ' => ' + to + ': ' + message); + bot.say(from, "Hier ist die Hilfe!\nBefehl-liste:\n- !hilfe - Zeigt diese Seite.\n- !DoorStatus - Sendet eine PM mit dem aktuellen Status\n- !DoorStatus channel - Sendet in den Channel wo der Befehl ausgeführt wurde den aktuellen Status\n- !where - Zeigt die Addresse vom Nordlab e.V.\n- !who - Zeigt wer alles kommen darf Nordlab e.V.\n- !when - Zeigt wann der Nordlab e.V. Hackerspace geöffnet hat"); + } + if (message == "!where"){ + console.log(from + ' => ' + to + ': ' + message); + bot.say(from, "You can find the Hackerspace in:\nOffener Kanal Flensburg\nSt.-Jürgen-Straße 95\n24937 Flensburg\nAt the very Top of the building"); + } + if (message == "!who"){ + console.log(from + ' => ' + to + ': ' + message); + bot.say(from, "Everybody can come to the Norlab e.V."); + } + if (message == "!when"){ + console.log(from + ' => ' + to + ': ' + message); + bot.say(from, "The Hackerpace of Norlab e.V. is usually opened every Monday at 18pm o'clock."); } if (message == "!DoorStatus"){ request.get('http://www.nordlab-ev.de/doorstate/status.txt', function (error, response, body) { diff --git a/main.js b/main.js @@ -36,7 +36,7 @@ request.get('http://www.nordlab-ev.de/doorstate/status.txt', function (error, re } //ADD MODULE RUNTIMES DOWN HERE pushbullet.pushbulletSend(door_status); - //irc.ircSend(door_status); + irc.ircSend(door_status); }else{ door_status2 = door_status; } @@ -56,7 +56,7 @@ request.get('http://www.nordlab-ev.de/doorstate/status.txt', function (error, re process.on("SIGINT", function () { irc.ircStopp(); process.exit(); - }); + }).setMaxListeners(0); setTimeout(function() { MakePush(); }, 10000); }).setMaxListeners(0); }