ThomasDavisA / simple-twitch-chat-visualizer

0 stars 0 forks source link

Added emote list to sent object and formatting out of messages #57

Closed ThomasDavisA closed 3 years ago

ThomasDavisA commented 3 years ago

This is the first iteration of handling emotes in messages. Currently, all emotes are removed from the message and now presented to the client in an array of objects. The object contains:

This also does some basic formatting with some left over spaces that emotes leave. However, there are still plenty of edge cases with handling the message before sending it off to the client.

With emotes being handled now, we can think about how emotes can be handled client-side i.e., a kobold showering emotes, or something else. Note that currently, if there is an emote only message sent, I am handling it by injecting a 'Yip!' message, but the client should potentially handle the case of an empty message (ie not displaying a bubble with only spaces or no spaces).

ThomasDavisA commented 3 years ago

I need to go ahead and change how the emotelist works. Ensure the emotes stay in the message instead, but provide the url for the client to render the emotes in the chat bubbles. I should also ensure the client is sent a flag when the message is emotes only.

mdavisprog commented 3 years ago

Started looking into getting this to work on clients. Noticed that the server will need to send the associated emote string that maps to the emote image. For example, a message like 'Hello HeyGuys. How are you?' will let the client know that an emote exists in the message, but does not know where to place the emote. Since 'HeyGuys' is an emote, the client will need to know that an emote object should replace the 'HeyGuys' string in the message. This will be more important if there are multiple emotes in one message.

ThomasDavisA commented 3 years ago

Okay, I've gone ahead and placed the emote string for each emote it detects. Hopefully the current iteration looks good. Right now I'm just amending my commits and force pushing to change the code, so hopefully that is okay.

mdavisprog commented 3 years ago

Edit: Just tested this locally and it seems javascript will automatically add the property with the value if placed in the object directly. May not need to do this.

The emoteString inside the object is not assigned to a property. It should be assigned like:

emoteString: emoteString

Also, I recommend not force pushing when making these small changes and commits for now. We can always squash them later before merging into the main branch.