Added CTCP replies

This commit is contained in:
Mattias Erming 2014-09-03 14:43:27 -07:00
parent 6badf7079c
commit 53e08ebff3
3 changed files with 27 additions and 2 deletions

View File

@ -1,7 +1,7 @@
{
"name": "shout",
"description": "A web IRC client",
"version": "0.13.0",
"version": "0.14.0",
"author": "Mattias Erming",
"preferGlobal": true,
"bin": {
@ -30,7 +30,7 @@
"mkdirp": "^0.5.0",
"moment": "~2.7.0",
"read": "^1.0.5",
"slate-irc": "~0.6.0",
"slate-irc": "~0.7.0",
"socket.io": "~1.0.6",
"superagent": "^0.18.2"
},

View File

@ -9,6 +9,7 @@ module.exports = Client;
var id = 0;
var events = [
"ctcp",
"error",
"image",
"join",

View File

@ -0,0 +1,24 @@
var pkg = require(process.cwd() + "/package.json");
module.exports = function(irc, network) {
irc.on("message", function(data) {
if (data.message.indexOf("\001") !== 0) {
return;
}
var msg = data.message.replace(/\001/g, "");
var split = msg.split(" ");
switch (split[0]) {
case "VERSION":
irc.ctcp(
data.from,
"VERSION " + pkg.name + " " + pkg.version
);
break;
case "PING":
if (split.length == 2) {
irc.ctcp(data.from, "PING " + split[1]);
}
break;
}
});
};