Chatterino / chatterino2

Chat client for https://twitch.tv
MIT License
2.05k stars 449 forks source link

FrankerFaceZ - Support "Featured channel" emotes #1150

Closed Trung0246 closed 4 years ago

Trung0246 commented 5 years ago

Currently the channel that's have FFZ featured emotes is ESAMarathon

Example: Image 1, Image 2

Comparing emotes menu (currently on Window 10 1803):

I had tried "Reload Channel Emotes", "Manual reconnect", created new tabs, closing the Chatterino window and open again; but nothing worked.

P.S: ESA mods often live update featured FFZ emotes for current runner's stream emote without warning, is it possible to know when its time to update emotes list?

pajlada commented 5 years ago

It looks like the FrankerFaceZ makes a websocket connection when joining a channel, which spits out a "follow_sets" command, that instructs the extension to also load emotes from the other streamer.

Do you know how ESA mods go about updating featured FFZ emotes for current runner's stream?

Trung0246 commented 5 years ago

Probably they ran a command (starts with ! ), I saw they did that once before, but unsure if that would be true.

I think one of the bots they installed did this, could DMs them to ask more

pajlada commented 5 years ago

Thanks, will try to follow up with FFZ people to see what this feature is and how/if we can support it

pajlada commented 5 years ago

FrankerFaceZ allows a set of allowlisted channels (e.g. ESAMarathon) to use not only their own set of FrankerFaceZ Channel Emotes, but also the FrankerFaceZ Channel Emotes of the Twitch Streamer(s) currently being featured on the stream.

With help from some FrankerFaceZ people, and with a bit of investigating the protocol seems really straight forward.

Messages are structured like this: nonce command arguments nonce is a signed integer command is a string command arguments is a JSON value (e.g. ["chatterino", "test"] or {"randers":["lol"]})

  1. Connect with a WebSocket client to a random endpoint from https://github.com/FrankerFaceZ/FrankerFaceZ/blob/21ee6fcfb7e5ab843c5052dddac587177bb18a2f/src/utilities/constants.js#L70
  2. Send the hello command with a string array as arguments. The string array should contain two string values. First value is the version of our app (we'd send chatterino-2.0.4-dfkjghjsg). Second value is our Client ID. We would most likely just randomize a UUID and send this all the time.
  3. Send the ready command, with a number as the argument. I think this should just be 0. Not sure what it means
  4. Subscribe to channels we're interested in. Command is sub, arguments is a string in the form of "room.pajlada" (replacing pajlada with the channel name you're interested in)
  5. You will now receive messages about what extra emote sets can be used in this channel. Nonce will be -1, command will be follow_sets, arguments will be a JSON object. The JSON object (map<string, vector<string>>). The value of the member is a list of what extra emote sets to load.
fourtf commented 4 years ago

This issue is out of scope of the Chatterino project.