thelounge/src/models/msg.js

31 lines
514 B
JavaScript
Raw Normal View History

2014-06-27 01:05:47 +02:00
var _ = require("lodash");
var moment = require("moment");
Msg.Type = {
2014-06-29 21:41:02 +02:00
ACTION: "action",
2014-06-27 01:05:47 +02:00
ERROR: "error",
2014-08-17 23:40:08 +02:00
IMAGE: "image",
2014-06-27 01:05:47 +02:00
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 22:50:41 +02:00
text: "",
2014-07-24 02:16:00 +02:00
time: moment().utc().format("HH:mm:ss"),
2014-07-08 22:50:41 +02:00
type: Msg.Type.MESSAGE
2014-06-27 01:05:47 +02:00
}, attr));
}