hardlounge/src/plugins/inputs/action.js

32 lines
515 B
JavaScript
Raw Normal View History

2014-09-13 21:29:45 +00:00
module.exports = function(network, chan, cmd, args) {
2015-09-30 22:39:57 +00:00
if (cmd !== "slap" && cmd !== "me") {
2014-09-13 21:29:45 +00:00
return;
}
2015-09-30 22:39:57 +00:00
2014-09-13 21:29:45 +00:00
var irc = network.irc;
2015-09-30 22:39:57 +00:00
2014-09-13 21:29:45 +00:00
switch (cmd) {
case "slap":
var slap = "slaps " + args[0] + " around a bit with a large trout";
/* fall through */
case "me":
if (args.length === 0) {
break;
}
2015-09-30 22:39:57 +00:00
2014-09-13 21:29:45 +00:00
var text = slap || args.join(" ");
irc.action(
chan.name,
text
);
2016-02-23 10:38:51 +00:00
irc.emit("message", {
2014-09-13 21:29:45 +00:00
from: irc.me,
2016-02-23 10:38:51 +00:00
to: chan.name,
message: "\u0001ACTION " + text
2014-09-13 21:29:45 +00:00
});
break;
}
2016-03-06 09:24:56 +00:00
return true;
2014-09-13 21:29:45 +00:00
};