-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathankuendigung.js
More file actions
38 lines (36 loc) · 1.24 KB
/
Copy pathankuendigung.js
File metadata and controls
38 lines (36 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Description:
// Schicke Nachrichten an ausgewaehlte Raeume
// Dependencies:
// None
// Configuration:
// HUBOT_ANNOUNCE_ROOMS - Liste der Raeume, durch Komma getrennt
// Commands:
// hubot Nachricht "<Nachricht>" "<Raum>[,<Raum>]" - Sendet die Nachricht an den / die angegebenen Räume
// hubot Nachricht an alle "<Nachricht>" - Sendet die Nachricht an die vorgegebenen Räume
// Author:
// Morgan Delagrange
// Christian Koehler
module.exports = function(robot) {
robot.respond(/Nachricht "(.*)" "(.*)"/i, function(msg) {
var allRooms, announcement, i, len, results, room;
announcement = msg.match[1];
allRooms = msg.match[2].split(',');
results = [];
for (i = 0, len = allRooms.length; i < len; i++) {
room = allRooms[i];
results.push(robot.messageRoom(room, announcement));
}
return results;
});
robot.respond(/Nachricht an alle "(.*)"/i, function(msg) {
var allRooms, announcement, i, len, results, room;
announcement = msg.match[1];
allRooms = process.env.HUBOT_ANNOUNCE_ROOMS.split(',');
results = [];
for (i = 0, len = allRooms.length; i < len; i++) {
room = allRooms[i];
results.push(robot.messageRoom(room, announcement));
}
return results;
});
};