PING twitch chat bot

hi guys how can i fix the pong message from the server?. (python 2.7.10)

if “PING” in line:
s.send(s, line.replace(“PING”, PONG))

i used this code but it doesn’t recognize pong command.
thx for the help

There is no response from a PONG as PONG is the response to a PING

ok but how can i fix it?

Fix what.

You haven’t described a problem other than “pong is not a recognized command”, is that what your code is saying or what Twitch is saying or what? What is not recognising pong as a command.

What is the actual issue you are having?

this is my main program, after 5/10 min twitch ping my bot and interrupt the connection.

As per the docs.

About once every five minutes, the server will send you a PING . To ensure that your connection to the server is not prematurely terminated, reply with PONG .

You should reply to a PING with a PONG

But you should also send your OWN PINGs to which Twitch will PONG in case you missed a PING/PONG this’ll help keep your connection alive.

Also shouldn’t your code be

s.send(s, line.replace(“PING”, “PONG”))

As otherwise it tries to replace PING with a undefined variable?

ok understant but atm i’m so confused ahahah.

how can i send my own pings to twitch?
which command i need?

sorry i’m not a good developer :sleepy:


god it was so easy , thank you very much!

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