fix decoding
parent
98efc6a871
commit
df68318c7f
12
main.py
12
main.py
|
@ -286,17 +286,17 @@ class IRCBot():
|
|||
|
||||
def ping_pong(self):
|
||||
while True:
|
||||
char = self.s.recv(1).decode("UTF-8")
|
||||
char = self.s.recv(1)
|
||||
if not char:
|
||||
exit(f"{self.nick}: no response from IRC server")
|
||||
line = ""
|
||||
line = b""
|
||||
while char:
|
||||
if char == "\n":
|
||||
if char == b"\n":
|
||||
break
|
||||
elif char != "\r":
|
||||
elif char != b"\r":
|
||||
line += char
|
||||
char = self.s.recv(1).decode("UTF-8")
|
||||
line = line.strip()
|
||||
char = self.s.recv(1)
|
||||
line = line.decode("UTF-8").strip()
|
||||
if line.startswith("PING"):
|
||||
pong = "PONG " + line[5:]
|
||||
self.sendline(pong)
|
||||
|
|
Loading…
Reference in New Issue