This is a proof of concept for my websocket client PR, showing the various things you can do with the feature, such as getting shocked when you're tased by security because you were a dumb fucking clown.
Yeah, you're reading it right.
The important parts here besides the configs, are the phrases. The Buttplug.io integration has more phrases than the PiShock one.
The script listens to the messages coming from the websocket client, and parses the HTML for each chat message so it can be ran through the phrase parser.
Here's a few payloads that tgchat typically sends.
{ type: 'chat/updateMessageCount', payload: { adminchat: 1 } }
{ type: 'ping/reply', payload: { index: 7 } }
{ type: 'ping/soft', payload: { afk: 318 } }
{ type: 'ping/soft', payload: { afk: 358 } }
{ type: 'ping/soft', payload: { afk: 398 } }
{ type: 'ping/soft', payload: { afk: 438 } }
{
type: 'chat/message',
payload: '{"sequence":2305,"content":{"type":"adminlog","html":"<span class=\\"admin\\"><span class=\\"prefix\\">ADMIN LOG:</span> <span class=\\"message\\">Storyteller failed to pick an event for track of Roleset.</span></span>"}}'
}
{
type: 'chat/message',
payload: `{"sequence":2304,"content":{"html":"<span class='emote'><b>Bepsi Bepington</b> coughs!</span>"}}`
}
{
type: 'chat/message',
payload: `{"sequence":2302,"content":{"html":"<span class='deadsay'><b>Shuttle Loan</b><span class='linkify'> has just been randomly triggered!</span></span>"}}`
}
{
type: 'chat/message',
payload: `{"sequence":2303,"content":{"html":"<div class='chat_alert_default'><span class='announcement_header'><span class='major_announcement_title'>Central Command Update</span><span class='subheader_announcement_text'>CentCom Spacepizza Division</span></span><span class='major_announcement_text'>Cargo: It looks like a neighbouring station accidentally delivered their pizza to you instead.</span></div>"}}`
}
This repo will not be fully fleshed out, nor officially supported but if I'm bored enough, I'll help you.. or if you pay me ;3
ok lol
- Run
pnpm install --recursive
in the root of the repo - Configure the services you want to run
- Configure pishock
- Copy
config.all.example.json
toconfig.all.json
and add/remove the ones you want (there's only two right now) - Run
pnpm run --recursive build
- Then run
pnpm run all
to finally run all services at once. Then connect your client to the websocket port that it's listening on.
You can also run WS_PORT=8080 pnpm run all
to start with a different websocket port.
Open SS13, go to the settings menu and find the Experimental tab
change the server to localhost:8094
(or whatever address you're hosting this on, for example 192.168.1.83:8095
), and click "Force Reconnect".
In the logs, the program should show a new client has connected, and all messages coming from the chatbox, will be parsed through:
- Buttplug: buttplug/phrases.js
- Pishock: pishock/src/phrases.ts
SS13 servers wanting to add the websocket client to their server should follow this PR, or simply send all message packages it receives in a similar format to how TGUI sends messages: Monkestation/Monkestation2.0#5744
- Add support for custom phrases in a JSON file or something