import { TwitchBadgesList } from "../badges" ; import { Color } from "../color" ; import { TwitchEmoteList } from "../emotes" ; import { IRCMessage , requireNickname , requireParameter , } from "../irc/irc-message" ; import { tagParserFor } from "../parser/tag-values" ; export class WhisperMessage extends IRCMessage { public readonly messageText : string ; public readonly senderUsername : string ; public readonly senderUserID : string ; public readonly recipientUsername : string ; public readonly badges : TwitchBadgesList ; public readonly badgesRaw : string ; public readonly color : Color | undefined ; public readonly colorRaw : string ; public readonly displayName : string ; public readonly emotes : TwitchEmoteList ; public readonly emotesRaw : string ; public readonly messageID : string ; public readonly threadID : string ; public constructor ( ircMessage ) { super ( ircMessage ) ; this . messageText = requireParameter ( this , 1 ) ; this . senderUsername = requireNickname ( this ) ; const tagParser = tagParserFor ( this . ircTags ) ; this . senderUserID = tagParser . requireString ( "user-id" ) ; this . recipientUsername = this . ircParameters [ 0 ] ; this . badges = tagParser . requireBadges ( "badges" ) ; this . badgesRaw = tagParser . requireString ( "badges" ) ; this . color = tagParser . getColor ( "color" ) ; this . colorRaw = tagParser . requireString ( "color" ) ; this . displayName = tagParser . requireString ( "display-name" ) . trim ( ) ; this . emotes = tagParser . requireEmotes ( "emotes" , this . messageText ) ; this . emotesRaw = tagParser . requireString ( "emotes" ) ; this . messageID = tagParser . requireString ( "message-id" ) ; this . threadID = tagParser . requireString ( "thread-id" ) ; } }