Player
Table of contents
Constructors
Properties
- current
- filters
- guildId
- moving
- node
- paused
- playing
- position
- queue
- repeatMode
- selfDeaf
- selfMute
- state
- textChannelId
- voiceChannelId
- voiceState
Accessors
Methods
- addTracks
- connect
- destroy
- disconnect
- moveNode
- pause
- ping
- play
- prioritizePlay
- resume
- seek
- sendVoiceUpdate
- setRepeatMode
- setSelfDeaf
- setSelfMute
- setVoiceChannel
- skip
- update
- checkOptions
Constructors
constructor
• new Player(lavashark
, options
)
創建一個 Player 實例
Parameters
Name | Type | Description |
---|---|---|
lavashark | LavaShark | LavaShark 實例 |
options | PlayerOptions | Player 選項 |
Defined in
Properties
current
• current: null
| Track
Defined in
filters
• Readonly
filters: Filters
Defined in
guildId
• Readonly
guildId: string
Defined in
moving
• moving: boolean
Defined in
node
• node: null
| Node
Defined in
paused
• paused: boolean
Defined in
playing
• playing: boolean
Defined in
position
• position: number
Defined in
queue
• queue: Queue
Defined in
repeatMode
• repeatMode: RepeatMode
Defined in
selfDeaf
• Optional
selfDeaf: boolean
Defined in
selfMute
• Optional
selfMute: boolean
Defined in
state
• state: ConnectionState
Defined in
textChannelId
• Optional
textChannelId: null
| string
Defined in
voiceChannelId
• voiceChannelId: string
Defined in
voiceState
• voiceState: VoiceState
Defined in
Accessors
exactPosition
• get
exactPosition(): number
根據上次 playerUpdate 數據包獲取準確的 track 位置
Returns
number
Defined in
queueDuration
• get
queueDuration(): number
獲取隊列的持續時間,以毫秒為單位
Returns
number
Deprecated
- Use
queue.duration
instead
Defined in
volume
• get
volume(): number
獲取播放器的音量
Returns
number
Defined in
Methods
addTracks
▸ addTracks(tracks
, requester
): void
將一個或多個歌曲添加到隊列
Parameters
Name | Type | Description |
---|---|---|
tracks | default | Track |
requester | unknown | 歌曲的請求者 |
Returns
void
Defined in
connect
▸ connect(): Promise
<void
>
連接到語音頻道
Returns
Promise
<void
>
Defined in
destroy
▸ destroy(): void
摧毀 Player
Returns
void
Defined in
disconnect
▸ disconnect(): void
與語音通道斷開連接
Returns
void
Defined in
moveNode
▸ moveNode(node
): Promise
<void
>
Parameters
Name | Type | Description |
---|---|---|
node | Node | 將 Player 移動到的目標節點 |
Returns
Promise
<void
>
Defined in
pause
▸ pause(state?
): Promise
<boolean
>
暫停或取消暫停 Player
Parameters
Name | Type | Default value | Description |
---|---|---|---|
state? | boolean | true | 是暫停還是取消暫停 Player |
Returns
Promise
<boolean
>
Defined in
ping
▸ ping(): Promise
<number
>
獲取 Lavalink 客戶端與節點之間的延遲
Returns
Promise
<number
>
- 以毫秒為單位
Defined in
play
▸ play(options?
): Promise
<void
>
播放曲目
Parameters
Name | Type | Description |
---|---|---|
options? | PlayOptions | Play options |
Returns
Promise
\<void
>
Defined in
prioritizePlay
▸ prioritizePlay(track
, requester
): Promise
\<boolean
>
優先播放新曲目
Parameters
Name | Type | Description |
---|---|---|
track | Track | 要優先播放的曲目 |
requester | User | 歌曲的請求者 |
Returns
Promise
<void
>
Defined in
resume
▸ resume(): Promise
<boolean
>
恢復播放
Returns
Promise
\<boolean
>
Defined in
seek
▸ seek(position
): Promise
<void
>
在音軌中跳轉到特定位置
Parameters
Name | Type | Description |
---|---|---|
position | number | The position to seek, in milliseconds |
Returns
Promise
<void
>
Defined in
sendVoiceUpdate
▸ sendVoiceUpdate(): Promise
<void
>
Returns
Promise
<void
>
Defined in
setRepeatMode
▸ setRepeatMode(mode
): void
為這個隊列設置重複模式
Parameters
Name | Type | Description |
---|---|---|
mode | RepeatMode | 要設置的重複模式 |
Returns
void
Defined in
setSelfDeaf
▸ setSelfDeaf(state
): void
設置機器人的自身拒聽狀態
Parameters
Name | Type | Description |
---|---|---|
state | boolean | 是否拒聽 |
Returns
void
Defined in
setSelfMute
▸ setSelfMute(state
): void
設置機器人的自身靜音狀態
Parameters
Name | Type | Description |
---|---|---|
state | boolean | 是否靜音 |
Returns
void
Defined in
setVoiceChannel
▸ setVoiceChannel(channelId
): void
設置 Player 的語音頻道
Parameters
Name | Type | Description |
---|---|---|
channelId | string | 語音頻道 ID |
Returns
void
Defined in
skip
▸ skip(amount?
): Promise
<boolean
>
跳過正在播放的歌曲
Parameters
Name | Type | Description |
---|---|---|
amount? | number | 要跳過的歌曲數量 |
Returns
Promise
<boolean
>
Defined in
update
▸ update(state
): void
Update player state
Parameters
Name | Type | Description |
---|---|---|
state | PlayerState | playerUpdate event |
Returns
void
Inner
Defined in
checkOptions
▸ checkOptions(options
): void
Parameters
Name | Type |
---|---|
options | PlayerOptions |
Returns
void