Multiple Messages Sent from one line of code in chatbot

sock.send should be nearer

socket.send("PRIVMSG #channel :message\r\n")

You don’t need to send the parts before PRIVMSG. It shoukd start PRIVMSG