Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
Render user actions separately
Browse files Browse the repository at this point in the history
  • Loading branch information
xPaw committed Jan 17, 2016
1 parent 2f5b166 commit 06ce48c
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/plugins/inputs/notice.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,30 @@
var _ = require("lodash");
var Msg = require("../../models/msg");

module.exports = function(network, chan, cmd, args) {
if (cmd !== "notice" || !args[1]) {
return;
}

var message = args.slice(1).join(" ");
var irc = network.irc;
irc.notice(args[0], args.slice(1).join(" "));
irc.notice(args[0], message);

var targetChan = _.findWhere(network.channels, {name: args[0]});
if (typeof targetChan === "undefined") {
message = "{to " + args[0] + "} " + message;
targetChan = chan;
}

var msg = new Msg({
type: Msg.Type.NOTICE,
mode: targetChan.getMode(irc.me),
from: irc.me,
text: message
});
targetChan.messages.push(msg);
this.emit("msg", {
chan: targetChan.id,
msg: msg
});
};

0 comments on commit 06ce48c

Please sign in to comment.