thelounge/lib/plugins/inputs/action.js

39 lines
674 B
JavaScript
Raw Normal View History

var Msg = require("../../models/msg");
2014-07-02 22:00:11 +00:00
module.exports = function(network, chan, cmd, args) {
if (cmd != "slap" && cmd != "me") {
return;
}
var client = this;
var irc = network.irc;
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;
}
var text = slap || args.join(" ");
irc.action(
chan.name,
text
);
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;
}
2014-06-26 23:05:47 +00:00
};