def _handle_privmsg(self, message): prefix, command, parameters = Irc.split_message(message) sender, user, ident = Irc.split_prefix(prefix) channel, msg = parameters.split(" ", 1) self.send_event("privmsg", msg[1:], sender, channel) if prefix is None: logger.debug("Malformed PRIVMSG: %s", message) return tokens = parameters.split(' ') # Handles the case of ": <text>". Someone started their message with a space. if tokens[1] == ':': privmsg_command = tokens[2] message = "{} {}".format(privmsg_command, " ".join(tokens[2:])) else: privmsg_command = tokens[1][1:] message = "{} {}".format(privmsg_command, " ".join(tokens[2:])) # CTCP PRIVMSGs if privmsg_command == '\x01PING': self._send_message(Irc.ctcp_pong(sender, message)) if privmsg_command == '\x01ACTION': pass elif privmsg_command[0] == '\x01': logger.debug('Missing CTCP command %s', privmsg_command)