edgeport - v1.0.6
    Preparing search index...

    Interface IrcSession

    A live IRC session bound to one TCP/TLS connection.

    Obtain one from connect. A background pump reads the socket, answers PINGs, and routes messages/events, so sending and receiving can be in flight at once. It is an AsyncDisposable, so await using closes it cleanly (sending QUIT first).

    1.0.4

    interface IrcSession {
        nick: string;
        "[asyncDispose]"(): PromiseLike<void>;
        action(target: string, text: string): Promise<void>;
        changeNick(newNick: string): Promise<void>;
        close(reason?: string): Promise<void>;
        events(): AsyncIterable<IrcEvent>;
        join(channel: string, key?: string): Promise<void>;
        messages(): AsyncIterable<IrcChatMessage>;
        names(channel: string): Promise<string[]>;
        notice(target: string, text: string): Promise<void>;
        part(channel: string, reason?: string): Promise<void>;
        say(target: string, text: string): Promise<void>;
        send(command: string, ...params: string[]): Promise<void>;
        sendRaw(line: string): Promise<void>;
        topic(channel: string, text?: string): Promise<string | void>;
        whois(target: string): Promise<IrcWhois>;
    }

    Hierarchy

    • AsyncDisposable
      • IrcSession
    Index
    nick: string

    Our current nickname (updated when a NICK change we make is echoed back).

    • Returns PromiseLike<void>

    • Sends a CTCP ACTION (the /me command) to a target.

      Parameters

      • target: string

        A channel or nick.

      • text: string

        The action text (rendered as * nick text).

      Returns Promise<void>

      Resolves once the message is written.

    • Changes our nickname, resolving once the server echoes the NICK back.

      (The current nick is exposed as the read-only IrcSession.nick property; this is the mutator, named separately since a property and a method cannot share one name.)

      Parameters

      • newNick: string

        The new nickname.

      Returns Promise<void>

      Resolves once the change is confirmed.

      If the nick is in use or otherwise rejected.

      If the change is not confirmed within the session timeout.

    • Sends QUIT and closes the connection.

      Parameters

      • Optionalreason: string

        An optional quit message.

      Returns Promise<void>

      Resolves once the socket is closed.

    • Returns an async iterable of every non-chat event (JOIN/PART/QUIT/NICK/KICK/MODE/TOPIC and numerics). Like messages, each call is an independent broadcast consumer.

      Returns AsyncIterable<IrcEvent>

      An async iterable of IrcEvent.

    • Joins a channel.

      Parameters

      • channel: string

        The channel name (e.g. #ops).

      • Optionalkey: string

        The channel key/password, when it is +k protected.

      Returns Promise<void>

      Resolves once the JOIN is written.

    • Returns an async iterable of inbound chat messages (PRIVMSG/NOTICE), with CTCP parsed.

      Each call returns an independent iterator that receives every message from the moment it is created; breaking out of the for await releases it. The loop ends when the connection closes.

      Returns AsyncIterable<IrcChatMessage>

      An async iterable of IrcChatMessage.

    • Lists the members of a channel (aggregating RPL_NAMREPLY until RPL_ENDOFNAMES).

      Parameters

      • channel: string

        The channel to query.

      Returns Promise<string[]>

      The member nicks, with membership prefixes (@, +, ...) stripped.

      If the server does not answer within the session timeout.

    • Sends a NOTICE, splitting on newlines and chunking overly long lines.

      Parameters

      • target: string

        A channel or nick.

      • text: string

        The notice text.

      Returns Promise<void>

      Resolves once every line is written.

    • Leaves a channel.

      Parameters

      • channel: string

        The channel name.

      • Optionalreason: string

        An optional part message.

      Returns Promise<void>

      Resolves once the PART is written.

    • Sends a PRIVMSG, splitting on newlines and chunking overly long lines.

      Parameters

      • target: string

        A channel or nick.

      • text: string

        The message text (may contain \n/\r\n; each line is sent separately).

      Returns Promise<void>

      Resolves once every line is written.

    • Sends a structured command, applying the trailing-parameter rule to the last argument.

      Parameters

      • command: string

        The command (e.g. MODE).

      • ...params: string[]

        The parameters.

      Returns Promise<void>

      Resolves once the line is written.

    • Sends a raw pre-formatted line (no CRLF; it is appended). The escape hatch for commands the typed API does not cover.

      Parameters

      • line: string

        The line to send verbatim.

      Returns Promise<void>

      Resolves once the line is written.

    • Gets or sets a channel topic.

      With text, sets the topic and resolves once the TOPIC is written. Without text, queries the topic and resolves to it (empty string when unset).

      Parameters

      • channel: string

        The channel.

      • Optionaltext: string

        The new topic to set, or omit to query.

      Returns Promise<string | void>

      The current topic when querying; nothing when setting.

      If a query is not answered within the session timeout.

    • Queries WHOIS for a target and returns the aggregated result.

      Parameters

      • target: string

        The nick to query.

      Returns Promise<IrcWhois>

      The structured WHOIS info (fields present depend on what the server returns).

      If WHOIS is not answered within the session timeout.