hardlounge/src/plugins/inputs/action.js

39 lines
632 B
JavaScript
Raw Normal View History

2014-09-13 21:29:45 +00:00
var Msg = require("../../models/msg");
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 client = this;
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
);
2015-09-30 22:39:57 +00:00
2014-09-13 21:29:45 +00:00
var msg = new Msg({
type: Msg.Type.ACTION,
from: irc.me,
text: text
});
chan.messages.push(msg);
client.emit("msg", {
chan: chan.id,
msg: msg
});
break;
}
};