Closed mccxiv closed 8 years ago
The BetterTTV extension has code for this as it completely takes over the chat. Perhaps we could learn from how it's set up there.
Yes, it would be possible to add this feature to tmi.js.
I think there is an issue with your code though.. I'm pretty sure your function would generate two indexes if you try with "KappaKappa" but it shouldn't because it's not a valid emote.
Another issue with my implementation, twitch seems to assume the string has already been html escaped... Not sure if you took that into account in the commit
{
id: 9,
code: "\<\;3"
},
Oh, right.. I will fix this :+1:
Except it's not that simple, the character ranges should be for the unescaped version of the message. Realizing these things as I try to fix my code :cry:
Hmm, if I try to send test <3 Kappa
.. the ranges seem to be okay:
{ badges: { broadcaster: '1' },
color: '#FFFFFF',
'display-name': 'Schmoopiie',
'emote-sets': '0,27',
mod: true,
subscriber: false,
turbo: false,
'user-type': 'mod',
'badges-raw': 'broadcaster/1',
username: 'schmoopiie',
emotes: { '9': [ '5-6' ], '25': [ '8-12' ] },
'emotes-raw': '9:5-6/25:8-12',
'message-type': 'chat' }
Cool, yours works :+1: Time for me to pull from #next
:+1:
Added in v1.0.1 and v1.1.0
Thanks :smile:
When listening to https://docs.tmijs.org/v1.0.0/Events.html#chat the userstate object won't contain any emotes for self messages.
Today we have the technology to make it happen! I wanted to make a PR but I'm too newb to figure out where things are in the codebase...
Here's the unoptimized function I'm using to generate them, if you need inspiration:
twitchEmotes
being the data from this endpoint using the current user's emote sets.