API Reference / MessageFragment
Interface: MessageFragment
Defined in: types.ts:181
Twitch messages are generally made up of multiple parts, called fragments. For example, a message with a Twitch emote in the middle will actually have three fragments: a text fragment, the twitch emote, and another text fragment.
If your data is coming directly from Twitch's EventSub, each message's fragments property is already compatible with this type.
Alternatively, if your data is coming from their IRC feed, you can just pass the entire body string into getProxiedMessage without worrying about fragments at all.
In the unlikely event you're working with raw HTML, the message's children can be mapped back into these fragments.
Properties
type
type:
MessageFragmentType|AnyString
Defined in: types.ts:188
What this fragment represents (text, an emote, etc.). Pluralmind will gracefully ignore any fragments that aren't relevant to it. For a list of relevant fragment types, check out MessageFragmentType.
text?
optionaltext?:string
Defined in: types.ts:195
The text value of this fragment. For emote fragments, this is the emote's name, and for mention fragments, this is the mention text. It can be safely omitted for any fragments that it doesn't apply to.