跳至主要内容
版本:v2.1.0

Node

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Node(lavashark, options): Node

創建一個 Node 實例

Parameters

NameTypeDescription
lavasharkLavaSharkLavaShark 實例
optionsNodeOptionsNode 選項

Returns

Node

Defined in

lib/Node.ts:117

Properties

options

Readonly options: NodeOptions

Defined in

lib/Node.ts:38


rest

rest: RESTController

Defined in

lib/Node.ts:40


retryAttempts

retryAttempts: number

Defined in

lib/Node.ts:41


state

state: NodeState

Defined in

lib/Node.ts:43


stats

stats: NodeStats

Defined in

lib/Node.ts:44


version

Optional version: string

Defined in

lib/Node.ts:37

Accessors

identifier

get identifier(): string

Returns

string

Defined in

lib/Node.ts:157


totalPenalties

get totalPenalties(): number

Returns

number

Defined in

lib/Node.ts:161

Methods

connect

connect(): void

連接到節點

Returns

void

Defined in

lib/Node.ts:199


disconnect

disconnect(): void

與節點斷開連接

Returns

void

Defined in

lib/Node.ts:230


getInfo

getInfo(): Promise<Info>

獲取 Lavalink 節點資訊

Returns

Promise<Info>

Defined in

lib/Node.ts:286


getPing

getPing(timeout?): Promise<number>

獲取節點的 ping

Parameters

NameTypeDefault valueDescription
timeoutnumber1500超時值,以毫秒為單位

Returns

Promise<number>

  • 與節點的延遲,以毫秒為單位

Defined in

lib/Node.ts:306


getRoutePlannerStatus

getRoutePlannerStatus(): Promise<RoutePlannerStatus>

獲取路徑規劃器狀態

Returns

Promise<RoutePlannerStatus>

Defined in

lib/Node.ts:333


getStats

getStats(): Promise<NodeStats>

獲取 Lavalink 節點統計信息

Returns

Promise<NodeStats>

Defined in

lib/Node.ts:295


getVersion

getVersion(): Promise<string>

獲取 Lavalink 節點版本

Returns

Promise<string>

Defined in

lib/Node.ts:276


reconnect

reconnect(): Promise<void>

與節點重新連接

Returns

Promise<void>

Defined in

lib/Node.ts:237


unmarkAllFailedAddress

unmarkAllFailedAddress(): Promise<void>

取消所有失敗的地址標記

Returns

Promise<void>

Defined in

lib/Node.ts:348


unmarkFailedAddress

unmarkFailedAddress(address): Promise<void>

取消一個失敗的地址標記

Parameters

NameTypeDescription
addressstring要取消標記的地址

Returns

Promise<void>

Defined in

lib/Node.ts:341


updateStats

updateStats(timeout?): Promise<void>

更新節點統計信息

Parameters

NameTypeDefault value
timeoutnumber1500

Returns

Promise<void>

Defined in

lib/Node.ts:355


updatseNodeSession

updatseNodeSession(): Promise<boolean>

更新節點 session

Returns

Promise<boolean>

Defined in

lib/Node.ts:247


checkOptions

checkOptions(options): void

Parameters

NameType
optionsNodeOptions

Returns

void

Defined in

lib/Node.ts:55