1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

Add topic event support for IRC node

This commit is contained in:
git@end.re 2015-11-16 09:33:59 +01:00
parent b6bbcbd52f
commit 304c379b0d
2 changed files with 9 additions and 0 deletions

View File

@ -75,6 +75,10 @@
<td>kick</td> <td>kick</td>
<td>a user is kicked from a channel</td> <td>a user is kicked from a channel</td>
</tr> </tr>
<tr>
<td>topic</td>
<td>a topic has been changed on a joined channel</td>
</tr>
<tr> <tr>
<td>names</td> <td>names</td>
<td>retrieves the list of users when the bot joins a channel</td> <td>retrieves the list of users when the bot joins a channel</td>

View File

@ -166,6 +166,11 @@ module.exports = function(RED) {
node.send([null,msg]); node.send([null,msg]);
//node.log(who+' '+RED._("irc.errors.hasleft")+' '+channel+': '+reason); //node.log(who+' '+RED._("irc.errors.hasleft")+' '+channel+': '+reason);
}); });
node.ircclient.addListener('topic', function (channel, topic, nick, message) {
var msg = { "payload": { "type":"topic", "who":nick, "channel":channel, "topic":topic, "message":message } };
node.send([null,msg]);
//node.log(nick+' '+RED._("irc.errors.topicchanged")+' '+channel+': '+topic);
});
node.ircclient.addListener('quit', function(nick, reason, channels, message) { node.ircclient.addListener('quit', function(nick, reason, channels, message) {
var msg = { "payload": { "type":"quit", "who":nick, "channel":channels, "reason":reason } }; var msg = { "payload": { "type":"quit", "who":nick, "channel":channels, "reason":reason } };
node.send([null,msg]); node.send([null,msg]);