2014-06-26 23:05:47 +00:00
|
|
|
var _ = require("lodash");
|
|
|
|
var moment = require("moment");
|
|
|
|
|
|
|
|
Msg.Type = {
|
2014-06-29 19:41:02 +00:00
|
|
|
ACTION: "action",
|
2014-06-26 23:05:47 +00:00
|
|
|
ERROR: "error",
|
|
|
|
JOIN: "join",
|
|
|
|
KICK: "kick",
|
|
|
|
MESSAGE: "message",
|
|
|
|
MODE: "mode",
|
|
|
|
MOTD: "motd",
|
|
|
|
NICK: "nick",
|
|
|
|
NOTICE: "notice",
|
|
|
|
PART: "part",
|
|
|
|
QUIT: "quit",
|
|
|
|
TOPIC: "topic",
|
|
|
|
WHOIS: "whois"
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = Msg;
|
|
|
|
|
|
|
|
function Msg(attr) {
|
|
|
|
_.merge(this, _.extend({
|
|
|
|
from: "",
|
2014-07-08 20:50:41 +00:00
|
|
|
text: "",
|
|
|
|
time: moment().format("HH:mm"),
|
|
|
|
type: Msg.Type.MESSAGE
|
2014-06-26 23:05:47 +00:00
|
|
|
}, attr));
|
|
|
|
}
|