thelounge/src/plugins/inputs/notice.js

30 lines
570 B
JavaScript
Raw Normal View History

"use strict";
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-03-20 15:28:47 +01:00
var targetChan = network.getChannel(args[0]);
2016-01-17 22:18:43 +01:00
if (typeof targetChan === "undefined") {
message = "{to " + args[0] + "} " + message;
targetChan = chan;
}
2016-04-22 18:38:13 +02:00
if (!network.irc.network.cap.isEnabled("echo-message")) {
irc.emit("notice", {
nick: irc.user.nick,
target: targetChan.name,
message: message,
2016-04-22 18:38:13 +02:00
});
}
2016-03-06 10:24:56 +01:00
return true;
2014-09-13 23:29:45 +02:00
};