thelounge/src/plugins/inputs/notice.js
Jérémie Astori 1dc92d8934
Enforce dangling commas with ESLint
¯\_(ツ)_/¯
2017-11-15 01:35:15 -05:00

30 lines
570 B
JavaScript

"use strict";
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 = network.getChannel(args[0]);
if (typeof targetChan === "undefined") {
message = "{to " + args[0] + "} " + message;
targetChan = chan;
}
if (!network.irc.network.cap.isEnabled("echo-message")) {
irc.emit("notice", {
nick: irc.user.nick,
target: targetChan.name,
message: message,
});
}
return true;
};