JTV 2 Receiving Messages

Yeah, I see that they send (SPECIALUSER, USERCOLOR, and EMOTESET) a lot. I was sending messages in successions. I’ve come to realize that it may have something to do with my code, it shouldn’t, but I receive the message from twitch sometimes with a new line following the EMOTESET this I am able to detect. When they do not send the new line right after EMOTESET I’m struggling to detect this even though I’m using a regex to detect the message.

data = data.receive() #my receive function is below

re.match(':[_\d\w]+![_\d\w]+@[\d\w]+\.tmi\.twitch\.tv\s[P]', data) 


def receive(self):
    try:
        data = self.sock.recv(4096)
        data = data.decode("utf-8")
        if 'PING' in data:
            self.sock.send(data.replace('PONG', 'PING').encode("utf-8"))
            return None
        return data
    except KeyboardInterrupt:
        print("User Interrupt")
        exit(1)
    except:
        return None