Closed cletusc closed 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.
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);
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.
8641b600555e5262c4dfad6f7be05b9bf8920b2f is what did the major rework on the emote portion. The UI will be handled separately.
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