Format log of send messages like received messages

This commit is contained in:
2025-10-18 23:48:46 +02:00
parent cde6e0db7e
commit 03e7c72c5b
+5 -5
View File
@@ -80,11 +80,11 @@ def connect_to_channel_and_check_topic():
# Send NICK and USER # Send NICK and USER
nick = f"NICK {IRC_NICK}\r\n".encode() nick = f"NICK {IRC_NICK}\r\n".encode()
log(".", nick) log(".", f"> {nick}")
sock.sendall(nick) sock.sendall(nick)
irc_user = f"USER {IRC_USER} 0 * :{IRC_REALNAME}\r\n".encode() irc_user = f"USER {IRC_USER} 0 * :{IRC_REALNAME}\r\n".encode()
log(".", irc_user) log(".", f"> {irc_user}")
sock.sendall(irc_user) sock.sendall(irc_user)
topic = None topic = None
@@ -105,14 +105,14 @@ def connect_to_channel_and_check_topic():
resp = line.replace("PING", "PONG") resp = line.replace("PING", "PONG")
pong = f"{resp}\r\n".encode() pong = f"{resp}\r\n".encode()
sock.sendall(pong) sock.sendall(pong)
log(".", pong) log(".", f"> {pong}")
# Check for end of MOTD or welcome to join channel # Check for end of MOTD or welcome to join channel
if " 001 " in line and not joined: if " 001 " in line and not joined:
# Join channel # Join channel
join = f"JOIN {IRC_CHANNEL}\r\n".encode() join = f"JOIN {IRC_CHANNEL}\r\n".encode()
sock.sendall(join) sock.sendall(join)
log(".", join) log(".", f"> {join}")
joined = True joined = True
# Capture topic sent by server upon joining # Capture topic sent by server upon joining
@@ -134,7 +134,7 @@ def connect_to_channel_and_check_topic():
time.sleep(wait_time) time.sleep(wait_time)
bye = b"QUIT :Bye!\r\n" bye = b"QUIT :Bye!\r\n"
sock.sendall(bye) sock.sendall(bye)
log(".", bye) log(".", f"> {bye}")
sock.close() sock.close()
log("*", "Disconnected") log("*", "Disconnected")
return return