Don't Starve Together

Don't Starve Together

39 ratings
Twitch Chat Integration (PyWitch)
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
840.072 KB
14 Nov, 2021 @ 5:44pm
14 Nov, 2021 @ 5:47pm
2 Change Notes ( view )

Subscribe to download
Twitch Chat Integration (PyWitch)

Description
THIS MOD REQUIRE EXTERNAL TOOLS TO WORK, FOLLOW THE INSTRUCTIONS CAREFULLY!




PyWtich: Twitch Chat Integration

This mod uses from a external tool called PyWitch Client to capture Twitch events, like chat messages, and show these events in-game.

For this version, only chat-messages are being integrated.

Everything is open source, so you can check PyWitch, PyWitch Client and PyWitch Auth in my Github! [github.com]

How to use

First, you need to download PyWitch Client from the RELASES page in my Github. You can do so by clicking this text[github.com]

[github.com]


I strongly recomend you to download it from source and run it using Python

After downloading and openning it, read the EULA. Since PyWitch Chat read from your Twitch Chat, your authorization will be required in the next step.
If you agree with the EULA, PyWitch Client will be ready to use.
Now you need to write your channel in the "channel box" (you can find your channel by acessing it on Twitch and reading the current URL).
Feel free to disable all features, leaving only PyWitch Chat enabled. The other features will be avaible in the following versions of this mod.

After that, click "Start PyWitch Server". Now a tab in your browser will be open, requesting authorization. This authorization is necessary to PyWitch Client be able to read your chat messages.

The authorization will redirect you to a tab with the name of all streamers that are using PyWitch Auth! Please consider visiting and supporting these Streamers channels!

For safety reasons, after you get your token from PyWitch Auth, it will be destroyed from the server, so if your token become invalid, a new one need to be generated.

Now, just wait for PyWitch Client to establish connection with Twitch server and its done! You can verify its working by acessing the following localhost URL:

127.0.0.1:13846/tmi [127.0.0.1]

If you see an empty json "{}", PyWitch Client started correctly
Now, send a message in your Twitch Chat and hit the refresh button in the PyWitch Client TMI URL.

If everything is working fine, you will see an json with your message and display name.

And its done!

In game, you just need to install the mod to your server and, in-game, open the PyWitch Menu by click its logo in the bottom left corner and hit the "Activate" button!

Now you will see the following Twitch Chat messages in your game!!

Upcoming features

As you can see from PyWitch and PyWitch Client, it already has some extra features. In the upcoming versions of this mod you will be able to capture Twitch Chat Redemptions in your server, making unique events and interactions to your game!

How it work

Don't Starve Together provides an internal function to perform REQUESTS on HTTP servers, which is very great to access data from server. However, Twitch Events, like chat messages and chat redemptions can only be accessed by WebSockets.
So, I developed a Python library to capture these events from Twitch. This library is called "PyWitch", and its source can be accessed by the following URL:

https://github.com/ouriquegustavo/pywitch

Ok, we are able to recover Twitch Events using a Python script... But we need to transfer that to Don't Starve Together.
To do so, I developed PyWitch Client, which is a GUI Interface combined with Web Framework (Flask). Its main purpose is to get events from Twitch using PyWitch and provide them on a localhost endpoint using Flask. Its source can be accessed by the following URL:

https://github.com/ouriquegustavo/pywitch_client

Now we can access Twitch Events from an HTTP server provided by PyWitch Client, the only remaining thing to solve is the token authentication.
Token authentication is made server side PyWitch Auth, which the source can be seen in the following URL:

https://github.com/ouriquegustavo/pywitch_auth

PyWitch Auth receives code from Twitch Authorization page and perform the required OAuth flow to generate the associated access token.
Any token is stored PyWith Auth server for more than 120 seconds. If you are not able to recover your token in this time, it will be destroyed. Every token generated in the server has an unique 128 characters state-code used for token request.
The server only will store public information about your Twitch user, like 'Display Name'. So I can recommend your live to other streamers :D

Special thanks!

I want to thanks HypeZ, 2000 and Butterflyholix for helping me testing this mod!

Enjoy!
13 Comments
Spider 21 Oct, 2023 @ 5:06pm 
Could that be stated in the description? i uh, followed all the steps and...
Gleenus  [author] 24 Nov, 2022 @ 4:13pm 
Hi 󰀒lexon1󰀒

Not anymore, since the server-side authentication was made using Heroku, and now Heroku is not free anymore
󰀦lexon1󰀦 14 Nov, 2022 @ 6:00pm 
Does the mod still work?
When i run client pywitch_client_one_file_0_7_0 and trying to authorisate with twitch i relaated to pywitch-auth.herokuapp.com and see this message: "There's nothing here, yet." And client still "waiting for authorization..." and nothing work
Dois D 14 Jul, 2022 @ 8:53pm 
gleenus,vc faria um mod pra dizer quanto de fome o merm king está? pfvrzinhoooo amo seus mods
Gleenus  [author] 1 May, 2022 @ 6:48am 
Hi @Zero, what kind of help? Can you be more clear?
Zero 28 Apr, 2022 @ 6:11pm 
Hi Gleenus, would like some help on this mod if you could help me thanks.
Butterflyholix 17 Jan, 2022 @ 4:58am 
Mod maravilhoso , ajuda demais da conta ! toma meus pontos :steamthumbsup:
Sasamih 19 Dec, 2021 @ 8:51am 
Nossa, ficou muito bom, parabens!! :dstools::tabbycat:
big chillskis 18 Nov, 2021 @ 4:43pm 
epic mod dude i love your stuff please come to brazil
Gleenus  [author] 18 Nov, 2021 @ 8:25am 
Opa Axweel!
To considerando sim, só me falta tempo uahsuash
Mas vai rolar

E logo mais vou adicionar pra ter algumas redemptions do chat que nem tinha nas minhas lives