edgeport - v1.0.6
    Preparing search index...

    Function parseMessage

    • Parses one IRC line into an IrcMessage.

      Handles a leading @tags block (semicolon-separated, IRCv3-unescaped), a leading :prefix, the command (alphabetic verbs are uppercased; a 3-digit numeric is kept verbatim), the space-separated middle params, and the final :trailing param (which keeps its spaces). The line must not include the terminating CRLF (the framed reader strips it).

      Parameters

      • line: string

        A single IRC line without its CRLF terminator.

      Returns IrcMessage

      The parsed message.

      1.0.4

      import { parseMessage } from 'edgeport/irc';

      const msg = parseMessage('@time=2024-01-01T00:00:00.000Z :nick!u@h PRIVMSG #chan :hello world');
      msg.command; // 'PRIVMSG'
      msg.params; // ['#chan', 'hello world']
      msg.prefix?.nick; // 'nick'
      msg.tags?.time; // '2024-01-01T00:00:00.000Z'