edgeport - v1.0.6
    Preparing search index...

    Function formatMessage

    • Formats an IrcMessage (or a message-shaped object) into a single line, without the trailing CRLF (the writer appends it).

      The last parameter is automatically prefixed with : when it contains a space, is empty, or itself starts with : - the cases where it must be sent as a trailing parameter. tags and prefix are emitted when present (a prefix may be a raw string or an IrcPrefix).

      Parameters

      • msg: {
            command: string;
            params?: string[];
            prefix?: string | IrcPrefix;
            tags?: Record<string, string>;
        }

        The command, params, and optional tags/prefix to serialize.

      Returns string

      The formatted line (no CRLF).

      1.0.4

      import { formatMessage } from 'edgeport/irc';

      formatMessage({ command: 'PRIVMSG', params: ['#chan', 'hello world'] });
      // 'PRIVMSG #chan :hello world'
      formatMessage({ command: 'JOIN', params: ['#chan'] }); // 'JOIN #chan'