24 lines
873 B
JavaScript
24 lines
873 B
JavaScript
Umi.Message = function(msgId, time, user, text, channel, highlight, botInfo, isAction) {
|
|
msgId = (msgId || '').toString();
|
|
time = time === null ? new Date() : new Date(parseInt(time || 0) * 1000);
|
|
user = user || {};
|
|
text = (text || '').toString();
|
|
channel = (channel || '').toString();
|
|
highlight = !!highlight;
|
|
isAction = !!isAction;
|
|
|
|
const msgIdInt = parseInt(msgId);
|
|
|
|
return {
|
|
getId: function() { return msgId; },
|
|
getIdInt: function() { return msgIdInt; },
|
|
getTime: function() { return time; },
|
|
getUser: function() { return user; },
|
|
getText: function() { return text; },
|
|
getChannel: function() { return channel; },
|
|
shouldHighlight: function() { return highlight; },
|
|
getBotInfo: function() { return botInfo; },
|
|
isAction: function() { return isAction; },
|
|
};
|
|
};
|