parseEmotes
Convert a message with emote codes into a message with emote images
Example
import { parseEmotes } from "emotettv";
const parsedMessage = await parseEmotes(
"hello world! VoHiYo",
{ "81274": [13-18] },
{ channelId: "98776633" }
);
const messageArr = parsedMessage.toArray();
console.log(messageArr);
API
parseEmotes(...)
parseEmotes: (
message: string,
_emotePositions?: EmotePositions | null,
_options?: Partial<ParserOptions> | null
) => Promise<{
toArray: () => ParsedEmotesMessage;
toHTML: (scale?: number, inlineStyles?: boolean, escapeHTML?: boolean) => string;
}>
Parse emotes in a message and return multiple methods to manage the results.
Returns: Promise<{
toArray()
,
toHTML(...)
}>
.toArray()
toArray: () => ParsedEmotesMessage;
Converts parsed message into an array of words and emotes.
Returns: ParsedEmotesMessage
.toHTML(...)
toHTML: (scale?: number, inlineStyles?: boolean, escapeHTML?: boolean) => string;
Converts parsed message into a ready-to-use HTML string.
scale?
number
inlineStyles?
boolean
escapeHTML?
boolean
Returns: string
Types
EmotePositions
Object map of:
key
string
ID of emote
value
string
Starting and ending position of emote on text formatted as {x}-{y}
ParsedEmotesMessage
Array of:
content
string
Word
position
string
Starting and ending position of word on text formatted as {x}-{y}
ParsedEmote
images
string[]
Image URLs of the emote in different scales (asc)
isZeroWidth?
boolean
If the emote is an overlay, only used internally
ParsedOverlay
images
string[]
Image URLs of the emote in different scales (asc)
alt
string
Original emote code
ParserOptions
channelId
string | null
ID of channel emotes will be fetched from
Providers
twitch
boolean
Enable Twitch emotes
bttv
boolean
Enable BTTV emotes
ffz
boolean
Enable FFZ emotes
seventv
boolean
Enable 7TV emotes
Last updated