Added service shortcuts
This commit is contained in:
parent
53faab2f41
commit
9b03be22b2
@ -45,6 +45,7 @@ var inputs = [
|
||||
"part",
|
||||
"quit",
|
||||
"raw",
|
||||
"services",
|
||||
"topic",
|
||||
"whois"
|
||||
];
|
||||
|
@ -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
|
||||
});
|
||||
}
|
||||
};
|
||||
|
26
src/plugins/inputs/services.js
Normal file
26
src/plugins/inputs/services.js
Normal 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
|
||||
});
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user