hardlounge/src/plugins/inputs/notice.js

30 lines
571 B
JavaScript
Raw Normal View History

"use strict";
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
2018-01-11 06:33:36 -05:00
let targetChan = network.getChannel(args[0]);
let message = args.slice(1).join(" ");
network.irc.notice(args[0], message);
2016-01-17 16:18:43 -05:00
if (typeof targetChan === "undefined") {
message = "{to " + args[0] + "} " + message;
targetChan = chan;
}
2016-04-22 12:38:13 -04:00
if (!network.irc.network.cap.isEnabled("echo-message")) {
2018-01-11 06:33:36 -05:00
network.irc.emit("notice", {
nick: network.irc.user.nick,
2016-04-22 12:38:13 -04:00
target: targetChan.name,
message: message,
2016-04-22 12:38:13 -04:00
});
}
2016-03-06 04:24:56 -05:00
return true;
2014-09-13 17:29:45 -04:00
};