2016-10-09 19:14:02 +00:00
|
|
|
"use strict";
|
|
|
|
|
2016-03-14 04:21:42 +00:00
|
|
|
exports.commands = ["msg", "say"];
|
|
|
|
|
|
|
|
exports.input = function(network, chan, cmd, args) {
|
2014-09-13 21:29:45 +00:00
|
|
|
var irc = network.irc;
|
2016-05-11 01:19:09 +00:00
|
|
|
var target = cmd === "msg" ? args.shift() : chan.name;
|
|
|
|
|
|
|
|
if (args.length === 0 || !target) {
|
|
|
|
return true;
|
2014-09-13 21:29:45 +00:00
|
|
|
}
|
2016-03-08 13:36:25 +00:00
|
|
|
|
2014-12-11 22:34:22 +00:00
|
|
|
var msg = args.join(" ");
|
2016-05-25 07:23:03 +00:00
|
|
|
|
|
|
|
if (msg.length === 0) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-03-08 13:36:25 +00:00
|
|
|
irc.say(target, msg);
|
|
|
|
|
2016-04-22 16:38:13 +00:00
|
|
|
if (!network.irc.network.cap.isEnabled("echo-message")) {
|
|
|
|
var channel = network.getChannel(target);
|
|
|
|
if (typeof channel !== "undefined") {
|
|
|
|
irc.emit("privmsg", {
|
|
|
|
nick: irc.user.nick,
|
|
|
|
target: channel.name,
|
|
|
|
message: msg
|
|
|
|
});
|
|
|
|
}
|
2014-09-13 21:29:45 +00:00
|
|
|
}
|
2016-03-06 09:24:56 +00:00
|
|
|
|
|
|
|
return true;
|
2014-09-13 21:29:45 +00:00
|
|
|
};
|