Class: PlayerManager

Table of contents

Constructors

Methods

Constructors

constructor

new PlayerManager(): PlayerManager

Creates a new instance of PlayerManager.

Returns

PlayerManager - The created instance of PlayerManager.

Methods

init

init(): void

Initializes the PlayerManager instance.

Returns

void

handleVoiceServerUpdate

handleVoiceServerUpdate(update: any, guildId: string): void

Handles voice server updates.

Parameters

NameTypeDescription
updateanyVoice server update data.
guildIdstringID of the guild.

Returns

void

handlePlayerDisconnect

handlePlayerDisconnect(guildId: string): void

Handles player disconnection.

Parameters

NameTypeDescription
guildIdstringID of the guild.

Returns

void

handlePlayerMove

handlePlayerMove(newChannelId: string, oldChannelId: string, guildId: string): void

Handles player movement between voice channels.

Parameters

NameTypeDescription
newChannelIdstringID of the new voice channel.
oldChannelIdstringID of the old voice channel.
guildIdstringID of the guild.

Returns

void

updateVoiceStates

updateVoiceStates(guildId: string, update: any): void

Updates voice states.

Parameters

NameTypeDescription
guildIdstringID of the guild.
updateanyVoice state update data.

Returns

void

attemptConnection

attemptConnection(guildId: string): Promise<boolean>

Attempts a connection to a voice channel.

Parameters

NameTypeDescription
guildIdstringID of the guild.

Returns

Promise<boolean> - A promise resolving to a boolean indicating whether the connection attempt was successful.

has

has(guildId: string): boolean

Checks if a player exists for a guild.

Parameters

NameTypeDescription
guildIdstringID of the guild.

Returns

boolean - Indicates whether a player exists for the guild.

get

get(guildId: string): MoonlinkPlayer | null

Gets the player instance for a guild.

Parameters

NameTypeDescription
guildIdstringID of the guild.

Returns

MoonlinkPlayer | null - The player instance for the guild, or null if not found.

create

create(data: createOptions): MoonlinkPlayer

Creates a new player instance.

Parameters

NameTypeDescription
datacreateOptionsOptions for creating the player.

Returns

MoonlinkPlayer - The created player instance.

delete

delete(guildId: string): void

Deletes a player instance for a guild.

Parameters

NameTypeDescription
guildIdstringID of the guild.

Returns

void