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