lavalink_rs
class
LavalinkClient:
The main client, where everything gets done, from events to requests to management.
async def
new( events: lavalink_rs.EventHandler, nodes: List[lavalink_rs.NodeBuilder], strategy: lavalink_rs.NodeDistributionStrategy, data: Optional[~__CD] = None) -> lavalink_rs.LavalinkClient:
async def
create_player_context( self, guild_id: Union[lavalink_rs.GuildId, int], endpoint: str, token: str, session_id: str, data: Optional[~__PD] = None) -> lavalink_rs.PlayerContext:
async def
create_player( self, guild_id: Union[lavalink_rs.GuildId, int], connection_info: ConnectionInfo) -> Player:
def
get_player_context( self, guild_id: Union[lavalink_rs.GuildId, int]) -> Optional[lavalink_rs.PlayerContext]:
async def
update_player( self, guild_id: Union[lavalink_rs.GuildId, int], update_player: UpdatePlayer, no_replace: bool) -> Player:
async def
decode_tracks( self, guild_id: Union[lavalink_rs.GuildId, int], tracks: List[str]) -> List[TrackData]:
def
handle_voice_server_update( self, guild_id: Union[lavalink_rs.GuildId, int], token: str, endpoint: Optional[str]) -> None:
def
handle_voice_state_update( self, guild_id: Union[lavalink_rs.GuildId, int], channel_id: Union[lavalink_rs.ChannelId, int, NoneType], user_id: Union[lavalink_rs.UserId, int], session_id: str) -> None:
async def
get_connection_info( self, guild_id: Union[lavalink_rs.GuildId, int], timeout: int) -> ConnectionInfo:
class
PlayerContext:
The player context.
class
EventHandler:
async def
player_update( self, client: lavalink_rs.LavalinkClient, session_id: str, event: PlayerUpdate) -> None:
Event that triggers when a player updates.
async def
track_start( self, client: lavalink_rs.LavalinkClient, session_id: str, event: TrackStart) -> None:
Event that triggers when a track starts playing.
async def
track_end( self, client: lavalink_rs.LavalinkClient, session_id: str, event: TrackEnd) -> None:
Event that triggers when a track finishes playing.
async def
track_exception( self, client: lavalink_rs.LavalinkClient, session_id: str, event: TrackException) -> None:
Event that triggers when a track raises an exception on the Lavalink server.
async def
track_stuck( self, client: lavalink_rs.LavalinkClient, session_id: str, event: TrackStuck) -> None:
Event that triggers when a track gets stuck while playing.
async def
websocket_closed( self, client: lavalink_rs.LavalinkClient, session_id: str, event: WebSocketClosed) -> None:
Event that triggers when the websocket connection to the voice channel closes.
class
Http:
class
Node:
http: lavalink_rs.Http
class
NodeBuilder:
A builder for the node.
Example
# use crate::model::UserId;
let node_builder = NodeBuilder {
hostname: "localhost:2333".to_string(),
password: "youshallnotpass".to_string(),
user_id: UserId(551759974905151548),
..Default::default()
};
NodeBuilder( hostname: str, is_ssl: bool, password: str, user_id: Union[lavalink_rs.UserId, int], session_id: Optional[str] = None, events: Optional[lavalink_rs.EventHandler] = None)
user_id: lavalink_rs.UserId
class
NodeDistributionStrategy:
def
custom( func: Callable[[lavalink_rs.LavalinkClient, Union[lavalink_rs.GuildId, int]], Awaitable[lavalink_rs.Node]]) -> lavalink_rs.NodeDistributionStrategy:
class
TrackInQueue:
A track that's inside the queue.
class
QueueRef:
A reference to the player queue
class
UserId:
A discord User ID.
class
ChannelId:
A discord Channel ID.
class
GuildId:
A discord Guild ID.