Page 1 of 1

stream.mattkc.com custom clients, bridges and hacking.

Posted: Mon Jan 16, 2023 10:16 pm
by janLuna
I made this thread for everyone to share anything they make for the stream chat!
I've personally made a client and IRC bridge but I've yet to put them on GitHub, will post update here when i do!

Re: stream.mattkc.com custom clients and bridges.

Posted: Mon Jan 16, 2023 11:47 pm
by y2k4
Did some testing and here is what I found:

Web Socket URL: wss://server.mattkc.com:2002

Connect handshake process (new line indicates new message to send to web socket):

Code: Select all

{"type":"hello","data":{"last_message":-1},"auth":"google","token":"[Google OAuth Token]"}

{"type":"status","data":{},"auth":"google","token":"[Google OAuth Token]"}
To send message:

Code: Select all

{"type":"message","data":"[MESSAGE HERE]","auth":"google","token":"[Google OAuth Token]"}

Re: stream.mattkc.com custom clients and bridges.

Posted: Sat Jan 21, 2023 12:24 am
by janLuna
UPDATE: the data value for the message type shoud be

Code: Select all

{"text":"message text"}
with an optional reply value which is an id for the message you want to reply to

As for the structure of an incoming chat/donation message, here's an example one

Code: Select all

{
  "data":{
    "auth": 50,
    "author": 'janLuna',
    "author_color": 'B00B69',
    "author_id": 954,
    "author_level": 50,
    "donate_value": "",
    "id": 19923,
    "message": 'oh',
    "reply": 0,
    "time": 1674259423516
  },
  "type": 'chat'
}
type is always chat, even for donations
explanations for each field in the data object are:
auth - message author's permission level, 0 for normal users, 50 for mods, 100 for admins (matt)
author - the author's username
author_color - a hex string of the author color
author_id - seems to be an ID number to identify the author regardless of username
author_level - the same as auth
donate_value - amount of money donated, as a string, representing i believe dollars (matt why), empty string if it's not a donation
id - ID number representing the message, this is what is used for replies
message - the text of the message, with encoded HTML entities (so stuff like & and > for & and > respectively)
reply - ID of the message it's replying to, 0 if there is no reply
time - unix timestamp for when the message was sent

Incoming join/part messages are way simpler:

Code: Select all

{"data":{"name":"username"}, "type":"join"}

Code: Select all

{"data":{"name":"username"}, "type":"part"}

Re: stream.mattkc.com custom clients and bridges.

Posted: Sat Jan 21, 2023 2:36 pm
by janLuna
UPDATE: i uploaded the IRC bridge, IRCkc, to GitHub, so you can now run your own instances, mostly important for other ChatKC instances whenever Matt actually makes it open source

Re: stream.mattkc.com custom clients and bridges.

Posted: Mon Jan 23, 2023 4:19 am
by voxalice
Not sure if this fits here, but I made a small userscript that adds timestamps to the stream website.
https://github.com/Voxalice/misc-usersc ... ps.user.js