How would you do chat alerts?

I have a addon for twitch but i would like it so i could print text in the chat box kinda like how BTTV would do if part of it would break and such.

I need these chat alerts so i can tell people that use this addon for mini news and such.

No one? I really need this for news alerts to get to the people that use my addon and such.

I am not exactly Web savvy, but I believe this is done by simply populating the window with text. If you inspect a single message in Chrome you can see that each message generates a list item looking something like this:

<li id="ember1551" class="ember-view chat-line">
    <div class="indicator"></div>
    <span class="timestamp float-left">6:03</span> 
    <span class="badges float-left"></span>
    <span class="from" style="color:#1E90FF">Livewhiletrue</span>
    <span class="colon">:</span>
    <span class="message" style="undefined">my test message</span>

This is buried deep within a heriarchy, and I don’t know if this is generated in a consistent way. If it is you could traverse the DOM until you find the parent of these list items and generate a message like the above.

The thing here is that the chat DOM is handled by Ember, which means that manipulating it manually might give unexpected results.
Also you might have issues with your addon clashing with other addons, such as bttv.

An option would be if you find a way to manipulate the existing data which ember uses to render the chat. But that requires a lot of digging through the source.

I think a better idea for posting news would be if you just add a notice div somewhere, rather than hijacking the actual chat log.

But then again, you could probably just wing it and append a <li> to .chat-lines.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.