-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Emote modifiers #23
base: main
Are you sure you want to change the base?
Emote modifiers #23
Conversation
…t in global emotes list
I'll be honest I really don't want to bother implementing emote modifiers from either BTTV or FFZ. BTTV doesn't bother providing any developer documentation on how to implement them, and FFZ does but admits:
There's also the question of should these modifiers work for emotes from any service, or just from BTTV/FFZ? FFZ also has premium modifiers for some reason, so it'd have to somehow include a check for that as well. Some of those premium FFZ modifiers also animate a bit too fast for accessibility purposes. Can they be implemented? Yes. But I just really don't like the idea of these emote services passing the work for the implementation of it on any dev that wants to use their emote services. I would much rather it be like Twitch's emote modifiers where it's pre-rendered on their servers, and then we just display the resulting image. If anything I'd rather just remove the modifiers from the output entirely so that at the very least they're not shown. I'll answer your questions anyway because I do have answers even if I don't like the idea of it all:
|
I understand - my thought was that if several widgets/users wanted modifiers, it would make more sense to implement in slime2 itself so the logic and styling are shared. But yes, if the emote services don't offer any functionality to implement these outside of their own clients, it makes little sense to try to keep up - also since it would mean having to release a update to all widgets every time a new modifier is added, either way it is done. (I asked on the BTTV side about modifiers, and while they say they'll look into improving documentation on them, they too have no plans for a prerendering endpoint. FFZ also apparently has a whole bunch of additional premium modifiers with more complex animations that are not listed in the documentation at all...) As for now, how about removing the styling from the PR, but keeping the emote modifier parsing? Valid modifiers (or invalid ones too?) could be removed from the message, but it could still store the information in the emote object as it does right now, except it doesn't apply their effects. Widget developers or users could then decide themselves what to do with that information - leave modifiers unimplemented, offer settings to let users pick which ones to allow, or even style them differently. In that case, I'd probably change to loading the modifier names from the APIs instead of hardcoding them (filtering out premium FFZ ones), so whenever new ones are added, they are handled and hidden by default without having to update the widget? I think I could also try to still offer the CSS file or something in the guides on the forum then, to help devs and users with getting started if they want to have modifiers... |
Adding a property just to indicate that it's a modifier would be fine. Just note that I won't be pulling this PR in because I'm remaking all of this in the desktop app codebase, but I'll keep it open for reference |
Hi! I've implemented BTTV emote modifiers in Twitch message parsing, so they can be displayed in chat widgets. This is more of a proof of concept right now, hence the Draft PR - I'm submitting this mainly to check whether this is something you want implemented in base slime2, and if yes, what your thoughts on a couple of problems would be.
Currently, this feature works by hardcoding the modifier emotes into the emote map returned by the BTTV service. Then it iterates over the parsed message
Part
s, removing modifier emotes and applying the styling to the following target emote (ignoring any whitespace-only text-typePart
s).The styling is returned as a string of CSS in the emote-type
Part
, so widgets can support modifiers by simply assigning that string to thestyle
attribute of their emote elements.If the style info is not used by the widget, (valid) modifier emotes will be hidden and the target emotes will be unaffected. Widgets could offer an "Enable Emote Modifiers" setting this way, by simply ignoring style info if it is not wanted. (The only exception is
z!
which works without styling, it just removes the textPart
between the emotes.)Some open todos/questions:
Part
type could be possible to share between the chats, I think.modifier_flags
bitmask instead of just by emote name), but are generally also just filters, transforms and animations, so it probably would work just fine.w!
modifier works right now by adding blank emotes before and after the scaled emote to make sure that no matter what size the widget renders emotes in, the correct amount of space is reserved. Well, only for square emotes right now - but I think that can be changed by making the blank emotes copies of the widened emote, and adding an internal-only "hidden" modifier to them so they aren't rendered.w!
andz!
is line breaks. The blank emotes forw!
can end up in different lines and mess with the spacing that way, andz!
cannot guarantee the emotes will be on the same line, so they might not actually be joined. I can't think of a way to avoid a line break with just CSS.o!
). The overlaying itself could be just atransform: translateX(-100%)
, but that would leave the empty space, and result in another possible line break problem.w!
ando!
, one solution could be to simply add a class to the emotes and having widget developers implement the CSS rules depending on their chosen emote height. This would solve most line break problems (widened emotes could be just a single element, overlaying emotes could use margins), but it wouldn't solve the issue forz!
.Part
as it will be nested in aspan
- this would require some sort of alternative textPart
, which widget developers must render without any surrounding element, so it could be handled by the browser correctly. While that would solve the line break problems, it doesn't help with overlaying emotes foro!
.Part
", and widget developers would have to add functionality to render these as adiv
element with the emotes inside. You could then apply any CSS rules to the outer container - a no-wrap forw!
andz!
, or a rule that absolutely positions children foro!
. I think this might potentially cause troubles with vertical alignment, though, but it seems like the best approach to me.Looking forward to hearing your thoughts!