cletusc / Userscript--Twitch-Chat-Emotes

Adds a button to Twitch that allows you to "click-to-insert" an emote.
http://cletusc.github.io/Userscript--Twitch-Chat-Emotes/
MIT License
36 stars 20 forks source link

Investigate 01/15/15 Twitch changes #72

Closed cletusc closed 9 years ago

cletusc commented 9 years ago

Reports of the emote menu not working have hit everywhere. Need to find out what Twitch changed that broke the addon.

This is very high priority--I am working on it!

Cross references: night/betterttv#160 https://community.nightdev.com/t/chat-cant-be-read/2785/8?u=cletusc

cletusc commented 9 years ago

This is partially fixed; it works, but only for native emotes; will have to implement a special API for 3rd parties to add emotes. There is plenty to rework on this still, but it's at least part of the way there.

cletusc commented 9 years ago

Docs for the emotes API still needs to be done. emoteMenu.registerEmoteGetter(name, fn) where name is your addon name, and fn is a function that returns an array of usable emote objects in this format:

[
    {
        text: 'text-to-put-in-chat-on-click',
        channel: 'the channel it should be grouped under',
        url: 'theEmote.jpg'
    },
    // ...
]

Some sample code for BetterTTV I made shows the basic usage:

function getter() {
  var emotes = [];
  var raw = BetterTTV.chat.store.bttvEmotes;
  Object.keys(raw).forEach(function (key) {
    var emote = raw[key];
    emote.text = emote.regex;
    // If not all emotes are usable, do that check here and
    // only push if the emote can actually be used.
    // ...
    emotes.push(emote);
  });
  return emotes;
}

emoteMenu.registerEmoteGetter('BetterTTV', getter);
cletusc commented 9 years ago

Part of the sorting and how the emotes are being handed should be reworked to make it more clear. All this logic should be thrown in src/modules/emotes.js somehow. The createEmote should also be reworked to be more rugged. For some reason, getters specifying a channel doesn't actually group those channels if a sub exists.

Get the emote handling reworked, then the createEmote can be reworked, possibly in a src/modules/ui.js or something.

cletusc commented 9 years ago

8641b600555e5262c4dfad6f7be05b9bf8920b2f is what did the major rework on the emote portion. The UI will be handled separately.