mirror of
https://github.com/thelounge/thelounge.git
synced 2024-06-26 17:20:22 +02:00
28 lines
525 B
JavaScript
28 lines
525 B
JavaScript
var _ = require("lodash");
|
|
|
|
exports.commands = ["notice"];
|
|
|
|
exports.input = function(network, chan, cmd, args) {
|
|
if (!args[1]) {
|
|
return;
|
|
}
|
|
|
|
var message = args.slice(1).join(" ");
|
|
var irc = network.irc;
|
|
irc.notice(args[0], message);
|
|
|
|
var targetChan = _.find(network.channels, {name: args[0]});
|
|
if (typeof targetChan === "undefined") {
|
|
message = "{to " + args[0] + "} " + message;
|
|
targetChan = chan;
|
|
}
|
|
|
|
irc.emit("notice", {
|
|
nick: irc.user.nick,
|
|
target: targetChan.name,
|
|
msg: message
|
|
});
|
|
|
|
return true;
|
|
};
|