#!/usr/bin/python3

import socket

class IRCClient(object):
    def __init__(self, username, nickname=None, real_name=None, channel=None):
        self.username = username
        self.nickname = nickname or username
        self.real_name = real_name or username
        self.channel = "#nyu-distributed-systems"
        self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

    def connect(self, address, port):
        self.socket.connect((address, port))
        self.send("NICK %s" % self.nickname)
        self.send("USER %s 0 * :%s" % (self.username, self.real_name))
        self.send("JOIN %s" % self.channel)

    def send(self, data):
        self.socket.send((data + "\r\n").encode())

    def poll(self):
        buffer = ""
        while True:
            buffer += self.socket.recv(8192).decode()
            while "\r\n" in buffer:
                #line, _, buffer = buffer.partition("\r\n")
                line, buffer = buffer.split("\r\n", maxsplit=1)
                print(line)
                command, *params = line.split()
                if command == "PING":
                    self.send("PONG %s" % params[0])

client = IRCClient("wz634ReadBot", "wz634ReadBot", "Waron Zeng", "#nyu-distributed-systems")
client.connect("irc.freenode.net", 6667)
client.poll()
@@ -992,16 +992,17 @@
         
+#
 print(li
@@ -1005,16 +1005,16 @@
 t(line)%0A
-
         
@@ -1053,16 +1053,122 @@
 split()%0A
+                print(%22=======================%5Cr%5Cn%22)%0A                print(%22=======================%5Cr%5Cn%22)%0A
         
@@ -1249,16 +1249,87 @@
 rams%5B0%5D)
+%0A                else:%0A                    print(line)%0A                
 %0A%0Aclient
@@ -1456,16 +1456,16 @@
 , 6667)%0A
-
 client.p
@@ -1469,8 +1469,9 @@
 t.poll()
+%0A

Update ircReadScript.py