Added service shortcuts

This commit is contained in:
Mattias Erming 2014-12-11 23:34:22 +01:00
parent 53faab2f41
commit 9b03be22b2
3 changed files with 30 additions and 4 deletions

View File

@ -45,6 +45,7 @@ var inputs = [
"part",
"quit",
"raw",
"services",
"topic",
"whois"
];

View File

@ -1,5 +1,4 @@
var _ = require("lodash");
var Msg = require("../../models/msg");
module.exports = function(network, chan, cmd, args) {
if (cmd != "say" && cmd != "msg") {
@ -19,14 +18,14 @@ module.exports = function(network, chan, cmd, args) {
} else {
target = chan.name;
}
var text = args.join(" ");
irc.send(target, text);
var msg = args.join(" ");
irc.send(target, msg);
var channel = _.find(network.channels, {name: target});
if (typeof channel !== "undefined") {
irc.emit("message", {
from: irc.me,
to: channel.name,
message: text
message: msg
});
}
};

View File

@ -0,0 +1,26 @@
var _ = require("lodash");
module.exports = function(network, chan, cmd, args) {
if (cmd != "ns" && cmd != "cs" && cmd != "hs") {
return;
}
var target = ({
"ns": "nickserv",
"cs": "chanserv",
"hs": "hostserv",
})[cmd];
if (!target || args.length === 0 || args[0] === "") {
return;
}
var irc = network.irc;
var msg = args.join(" ");
irc.send(target, msg);
var channel = _.find(network.channels, {name: target});
if (typeof channel !== "undefined") {
irc.emit("message", {
from: irc.me,
to: channel.name,
message: msg
});
}
};