catch empty lines and thelike
This commit is contained in:
parent
57ba56bf2b
commit
f5d6f2deb0
7
irc.py
7
irc.py
@ -170,7 +170,12 @@ class Client:
|
|||||||
self.__server.sendline("PONG " + line.split()[1])
|
self.__server.sendline("PONG " + line.split()[1])
|
||||||
continue
|
continue
|
||||||
|
|
||||||
(msg_from, msg_type, msg_to, *msg) = line[1:].split()
|
try:
|
||||||
|
(msg_from, msg_type, msg_to, *msg) = line[1:].split()
|
||||||
|
except ValueError:
|
||||||
|
print("[E] Invalid message received:", line)
|
||||||
|
continue
|
||||||
|
|
||||||
if len(msg) > 0 and msg[0].startswith(":"):
|
if len(msg) > 0 and msg[0].startswith(":"):
|
||||||
msg[0] = msg[0][1:]
|
msg[0] = msg[0][1:]
|
||||||
message = " ".join(msg)
|
message = " ".join(msg)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user