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: "",
|
2014-07-24 00:16:00 +00:00
|
|
|
time: moment().utc().format("HH:mm:ss"),
|
2014-07-08 20:50:41 +00:00
|
|
|
type: Msg.Type.MESSAGE
|
2014-06-26 23:05:47 +00:00
|
|
|
}, attr));
|
|
|
|
}
|