Added CTCP replies
This commit is contained in:
parent
6badf7079c
commit
53e08ebff3
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "shout",
|
"name": "shout",
|
||||||
"description": "A web IRC client",
|
"description": "A web IRC client",
|
||||||
"version": "0.13.0",
|
"version": "0.14.0",
|
||||||
"author": "Mattias Erming",
|
"author": "Mattias Erming",
|
||||||
"preferGlobal": true,
|
"preferGlobal": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
@ -30,7 +30,7 @@
|
|||||||
"mkdirp": "^0.5.0",
|
"mkdirp": "^0.5.0",
|
||||||
"moment": "~2.7.0",
|
"moment": "~2.7.0",
|
||||||
"read": "^1.0.5",
|
"read": "^1.0.5",
|
||||||
"slate-irc": "~0.6.0",
|
"slate-irc": "~0.7.0",
|
||||||
"socket.io": "~1.0.6",
|
"socket.io": "~1.0.6",
|
||||||
"superagent": "^0.18.2"
|
"superagent": "^0.18.2"
|
||||||
},
|
},
|
||||||
|
@ -9,6 +9,7 @@ module.exports = Client;
|
|||||||
|
|
||||||
var id = 0;
|
var id = 0;
|
||||||
var events = [
|
var events = [
|
||||||
|
"ctcp",
|
||||||
"error",
|
"error",
|
||||||
"image",
|
"image",
|
||||||
"join",
|
"join",
|
||||||
|
24
src/plugins/irc-events/ctcp.js
Normal file
24
src/plugins/irc-events/ctcp.js
Normal 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;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user