2016-01-17 16:18:43 -05:00
|
|
|
var _ = require("lodash");
|
|
|
|
|
2016-03-14 00:21:42 -04:00
|
|
|
exports.commands = ["notice"];
|
|
|
|
|
|
|
|
exports.input = function(network, chan, cmd, args) {
|
|
|
|
if (!args[1]) {
|
2014-09-13 17:29:45 -04:00
|
|
|
return;
|
|
|
|
}
|
2016-01-17 16:18:43 -05:00
|
|
|
|
|
|
|
var message = args.slice(1).join(" ");
|
2014-09-13 17:29:45 -04:00
|
|
|
var irc = network.irc;
|
2016-01-17 16:18:43 -05:00
|
|
|
irc.notice(args[0], message);
|
|
|
|
|
2016-02-14 12:09:51 -05:00
|
|
|
var targetChan = _.find(network.channels, {name: args[0]});
|
2016-01-17 16:18:43 -05:00
|
|
|
if (typeof targetChan === "undefined") {
|
|
|
|
message = "{to " + args[0] + "} " + message;
|
|
|
|
targetChan = chan;
|
|
|
|
}
|
|
|
|
|
2016-03-08 08:36:25 -05:00
|
|
|
irc.emit("notice", {
|
|
|
|
nick: irc.user.nick,
|
|
|
|
target: targetChan.name,
|
2016-03-15 05:59:36 -04:00
|
|
|
message: message
|
2016-01-17 16:18:43 -05:00
|
|
|
});
|
2016-03-06 04:24:56 -05:00
|
|
|
|
|
|
|
return true;
|
2014-09-13 17:29:45 -04:00
|
|
|
};
|