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