Node Manager API Reference

class lavaplay.node_manager.Node(*, host: Optional[str] = '127.0.0.1', port: int, password: str, user_id: Optional[int], resume_key: Optional[str] = None, resume_timeout: int = 180, shards_count: int = 1, ssl: bool = False, loop: Optional[AbstractEventLoop] = None, **kwargs)[source]

Represents a Lavalink client used to manage nodes and connections.

Parameters

host: str

ip address for lavalink server, default ip address for lavalink is 127.0.0.1

port: int

The port to use for websocket and REST connections.

password: str

The password used for authentication.

user_id: int | None

The bot id when you keep None you need to set on a started event on ur library used.

num_shards: int

The count shards for websocket

is_ssl: bool

Is server using ssl

set_event_loop(loop: AbstractEventLoop) None[source]

Set the event loop for the client requird set after call connect(),

Parameters

loop: asyncio.AbstractEventLoop

The event loop to use.

create_player(guild_id: int) Player[source]

Create a player for guild id.

Parameters

guild_id: int

The guild id for player.

destroy_player(guild_id: int) None[source]

Destroy a player for guild id.

Parameters

guild_id: int

The guild id for player.

get_player(guild_id: int) Player[source]

Get player for guild id.

Parameters

guild_id: int

The guild id for player.

get_players() List[Player][source]

Get all players.

change_player(guild_id: int, player: Player) None[source]

Change player for guild id.

Parameters

guild_id: int

The guild id for player.

player: Player

The player to change.

async search_youtube(query: str) Optional[Union[List[Track], TrackLoadFailed]][source]

Search for tracks with youtube.

Parameters

query: str

words for search with youtube. if not found result retrun empty list

Exceptions

lavaplayer.exceptions.TrackLoadFailed

If the track could not be loaded.

async search_soundcloud(query: str) Optional[Union[List[Track], TrackLoadFailed]][source]

Search for tracks with soundcloud.

Parameters

query: str

words for search with soundcloud. if not found result retrun empty list

Exceptions

lavaplayer.exceptions.TrackLoadFailed

If the track could not be loaded.

async search_youtube_music(query: str) Optional[Union[List[Track], PlayList, TrackLoadFailed]][source]

Search for tracks with youtube music.

Parameters

query: str

words for search with youtube music. if not found result retrun empty list

Exceptions

lavaplayer.exceptions.TrackLoadFailed

If the track could not be loaded.

async get_tracks(query: str) Optional[Union[List[Track], PlayList, TrackLoadFailed]][source]

Load tracks for unknow sits or youtube or soundcloud or radio.

Parameters

query: str

track url, if not found result retrun empty list

Exceptions

lavaplayer.exceptions.TrackLoadFailed

If the track could not be loaded.

async decodetrack(track: str) Track[source]

This method is used to decode a track from base64 only server can resolve, to info can anyone understanding it

Parameters

track: str

track result from base64

async decodetracks(tracks: List[Dict]) List[Track][source]

This method is used to decode a tracks from base64 only server can resolve, to info can anyone understanding it

Parameters

tracks: list

tracks result from base64

async auto_search_tracks(query: str) Union[List[Track], None, PlayList][source]

Load tracks for youtube search or other urls.

Parameters

query: str

url or words to search, if not found result retrun empty list

Exceptions

lavaplayer.exceptions.TrackLoadFailed

If the track could not be loaded.

listen(event: Union[str, Event]) Callable[[...], Awaitable][source]

The register function for listener handler

Parameters

event: Any | str

event name or class for event

property is_connect: bool

Check if the client is connect to the voice server.

async info() Info[source]

Get info from lavalink server.

async version() str[source]

Get version from lavalink server.

connect()[source]

Connect to the lavalink websocket

async close()[source]

Disconnect from the lavalink websocket