import LavaShark from './LavaShark'; import { RESTController } from './rest/RESTController'; import type { Info, NodeOptions, NodeStats, RoutePlannerStatus, version } from '../@types'; export declare enum NodeState { CONNECTING = 0, CONNECTED = 1, DISCONNECTED = 2 } export default class Node { #private; version?: version; readonly options: NodeOptions; rest: RESTController; retryAttempts: number; state: NodeState; stats: NodeStats; static checkOptions(options: NodeOptions): void; /** * Create a new Node instance * @param {LavaShark} lavashark - The LavaShark instance * @param {object} options - The node options * @param {string} [options.id] - The lavalink node identifier * @param {string} options.hostname - The lavalink node hostname * @param {number} options.port - The lavalink node port * @param {string} [options.password] - The lavalink node password * @param {boolean} [options.secure] - Whether the lavalink node uses TLS/SSL or not * @param {string} [options.region] - The lavalink node region * @param {boolean} [options.resuming] - Whether to resume the session after the client disconnects * @param {number} [options.resumeTimeout] - The resume timeout, in seconds * @param {number} [options.maxRetryAttempts] - The max number of reconnect attempts * @param {number} [options.retryAttemptsInterval] - The interval between reconnect attempts, in milliseconds * @param {boolean} [options.followRedirects] - Whether to follow redirects (3xx status codes) * @param {boolean} [options.sendSpeakingEvents=false] - Tells the lavalink node to send speaking events (Supported in my custom lavalink fork) */ constructor(lavashark: LavaShark, options: NodeOptions); get identifier(): string; get totalPenalties(): number; private calcPenalties; /** * Connect to node */ connect(): void; /** * Disconnect from node * @param {boolean} full - Fully disconnect the node. Removes it from the nodes list and stops the periodic reconnection */ disconnect(full?: boolean): void; /** * Reconnects the node */ reconnect(): Promise; /** * Update session exists */ updatseNodeSession(): Promise; private KeepingNodeAwake; private stopKeepingNodeAwake; /** * Get the Lavalink Node version * @returns {Promise} */ getVersion(): Promise; /** * Get the Lavalink Node information * @returns {Promise} */ getInfo(): Promise; /** * Get the Lavalink Node stats * @returns {Promise} */ getStats(): Promise; /** * Get the ping for the node * @param {number} timeout - Timeout value in milliseconds * @returns {Promise} - Node latency, in milliseconds */ getPing(timeout?: number): Promise; /** * Gets the route planner status * @returns {Promise} */ getRoutePlannerStatus(): Promise; /** * Unmarks a failed address * @param {string} address - The address to unmark */ unmarkFailedAddress(address: string): Promise; /** * Unmarks all failed address */ unmarkAllFailedAddress(): Promise; /** * Update node stats */ updateStats(timeout?: number): Promise; private pollTrack; private handlePlayerEvent; private handleTrackStart; private handleTrackEnd; private handleTrackStuck; private handleTrackException; private handleWSClose; private open; private message; private error; private close; private upgrade; private pong; }