@twurple/chat
Version:
Interact with the Twitch Messaging Interface (aka Twitch chat).
30 lines (29 loc) • 927 B
JavaScript
import { Message } from 'ircv3';
import { ChatUser } from "../../../ChatUser.mjs";
import { parseEmoteOffsets } from "../../../utils/emoteUtil.mjs";
export class UserNotice extends Message {
constructor(command, contents, config) {
super(command, contents, config, {
channel: { type: 'channel' },
text: { trailing: true, optional: true },
});
}
get id() {
return this._tags.get('id');
}
get date() {
const timestamp = this._tags.get('tmi-sent-ts');
return new Date(Number(timestamp));
}
get userInfo() {
return new ChatUser(this._tags.get('login'), this._tags);
}
get channelId() {
var _a;
return (_a = this._tags.get('room-id')) !== null && _a !== void 0 ? _a : null;
}
get emoteOffsets() {
return parseEmoteOffsets(this._tags.get('emotes'));
}
}
UserNotice.COMMAND = 'USERNOTICE';