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

Node

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Node(lavashark, options)

創建一個 Node 實例

Parameters

NameTypeDescription
lavasharkLavaSharkLavaShark 實例
optionsNodeOptionsNode 選項

Defined in

lib/Node.ts:118

Properties

options

Readonly options: NodeOptions

Defined in

lib/Node.ts:37


rest

rest: RESTController

Defined in

lib/Node.ts:39


retryAttempts

retryAttempts: number

Defined in

lib/Node.ts:40


state

state: NodeState

Defined in

lib/Node.ts:42


stats

stats: NodeStats

Defined in

lib/Node.ts:43


version

Optional version: string

Defined in

lib/Node.ts:36

Accessors

identifier

get identifier(): string

Returns

string

Defined in

lib/Node.ts:156


totalPenalties

get totalPenalties(): number

Returns

number

Defined in

lib/Node.ts:160

Methods

connect

connect(): void

連接到節點

Returns

void

Defined in

lib/Node.ts:198


disconnect

disconnect(): void

與節點斷開連接

Returns

void

Defined in

lib/Node.ts:229


getInfo

getInfo(): Promise<Info>

獲取 Lavalink 節點資訊

Returns

Promise<Info>

Defined in

lib/Node.ts:285


getPing

getPing(timeout?): Promise<number>

獲取節點的 ping

Parameters

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

Returns

Promise<number>

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

Defined in

lib/Node.ts:305


getRoutePlannerStatus

getRoutePlannerStatus(): Promise<RoutePlannerStatus>

獲取路徑規劃器狀態

Returns

Promise<RoutePlannerStatus>

Defined in

lib/Node.ts:332


getStats

getStats(): Promise<NodeStats>

獲取 Lavalink 節點統計信息

Returns

Promise<NodeStats>

Defined in

lib/Node.ts:294


getVersion

getVersion(): Promise<string>

獲取 Lavalink 節點版本

Returns

Promise<string>

Defined in

lib/Node.ts:275


reconnect

reconnect(): Promise<void>

與節點重新連接

Returns

Promise<void>

Defined in

lib/Node.ts:236


unmarkAllFailedAddress

unmarkAllFailedAddress(): Promise<void>

取消所有失敗的地址標記

Returns

Promise<void>

Defined in

lib/Node.ts:347


unmarkFailedAddress

unmarkFailedAddress(address): Promise<void>

取消一個失敗的地址標記

Parameters

NameTypeDescription
addressstring要取消標記的地址

Returns

Promise<void>

Defined in

lib/Node.ts:340


updateStats

updateStats(timeout?): Promise<void>

更新節點統計信息

Parameters

NameTypeDefault value
timeoutnumber1500

Returns

Promise<void>

Defined in

lib/Node.ts:354


updatseNodeSession

updatseNodeSession(): Promise<boolean>

更新節點 session

Returns

Promise<boolean>

Defined in

lib/Node.ts:246


checkOptions

checkOptions(options): void

Parameters

NameType
optionsNodeOptions

Returns

void

Defined in

lib/Node.ts:54