Question on sockets, joining channels, and bots

In my script (python) I have my bot join each channel as such:
for x in cfg.CHAN:
s.send(“JOIN #{}\r\n”.format(x).encode(“utf-8”))
chat(s, “Everthing is feeling Puntastic~!”, x)

What this does is that for each name in CHAN it opens a new socket for that channel. Does it abide by twitch ToS or do I need to do it all in one socket? And if so, how do I do that?

The loop you provide does not create a new socket. I’m assuming that has been done before the loop which would have been set to the variable “s”. So “s.send()” is just sending data to the initial socket that was set to the variable “s”.

“s” in your case is the socket. As long as the socket does not disconnect that is your main connection to Twitch’s IRC servers. Once established any/all information can be sent via s.send() as you have specified in the example above.

Anyways, I don’t recall there being any limitation specified in the ToS or in the Developer Documention. However I do think Twitch limits the number of connections that can be established from a single address/application, but would not go against ToS being that when the limit is reached the process is usually automated to drop any/all connections.

Edit:
They also drop any/all connections if there is too much data being sent to a single address/application so please be aware of that. I also do not have knowledge of the maximum amount of data that Twitch can send to a single address/application, but I was able to use the API to join the top 48 channels with thousands of chatters before disconnecting at some point in the past.

Hopefully that helped!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.