Class LavalinkNodeConnection
Represents a connection to a Lavalink node.
Inheritance
Namespace: DSharpPlus.Lavalink
Assembly: cs.temp.dll.dll
Syntax
public sealed class LavalinkNodeConnection
Properties
ConnectedGuilds
Gets a dictionary of Lavalink guild connections for this node.
Declaration
public IReadOnlyDictionary<ulong, LavalinkGuildConnection> ConnectedGuilds { get; }
Property Value
Type | Description |
---|---|
IReadOnlyDictionary<System.UInt64, LavalinkGuildConnection> |
Discord
Gets the Discord client this node connection belongs to.
Declaration
public DiscordClient Discord { get; }
Property Value
Type | Description |
---|---|
DiscordClient |
IsConnected
Gets whether the client is connected to Lavalink.
Declaration
public bool IsConnected { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
NodeEndpoint
Gets the remote endpoint of this Lavalink node connection.
Declaration
public ConnectionEndpoint NodeEndpoint { get; }
Property Value
Type | Description |
---|---|
ConnectionEndpoint |
Parent
Gets the parent extension which this node connection belongs to.
Declaration
public LavalinkExtension Parent { get; }
Property Value
Type | Description |
---|---|
LavalinkExtension |
Rest
Gets the REST client for this Lavalink connection.
Declaration
public LavalinkRestClient Rest { get; }
Property Value
Type | Description |
---|---|
LavalinkRestClient |
Statistics
Gets the current resource usage statistics.
Declaration
public LavalinkStatistics Statistics { get; }
Property Value
Type | Description |
---|---|
LavalinkStatistics |
Methods
ConnectAsync(DiscordChannel)
Connects this Lavalink node to specified Discord channel.
Declaration
public Task<LavalinkGuildConnection> ConnectAsync(DiscordChannel channel)
Parameters
Type | Name | Description |
---|---|---|
DiscordChannel | channel | Voice channel to connect to. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<LavalinkGuildConnection> | Channel connection, which allows for playback control. |
GetGuildConnection(DiscordGuild)
Gets a Lavalink connection to specified Discord channel.
Declaration
public LavalinkGuildConnection GetGuildConnection(DiscordGuild guild)
Parameters
Type | Name | Description |
---|---|---|
DiscordGuild | guild | Guild to get connection for. |
Returns
Type | Description |
---|---|
LavalinkGuildConnection | Channel connection, which allows for playback control. |
StopAsync()
Stops this Lavalink node connection and frees resources.
Declaration
public Task StopAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Events
Disconnected
Triggered when this node disconnects.
Declaration
public event AsyncEventHandler<LavalinkNodeConnection, NodeDisconnectedEventArgs> Disconnected
Event Type
Type | Description |
---|---|
AsyncEventHandler<LavalinkNodeConnection, NodeDisconnectedEventArgs> |
LavalinkSocketErrored
Triggered whenever Lavalink WebSocket throws an exception.
Declaration
public event AsyncEventHandler<LavalinkNodeConnection, SocketErrorEventArgs> LavalinkSocketErrored
Event Type
Type | Description |
---|---|
AsyncEventHandler<LavalinkNodeConnection, SocketErrorEventArgs> |
PlaybackFinished
Triggered whenever playback of a track finishes.
Declaration
public event AsyncEventHandler<LavalinkGuildConnection, TrackFinishEventArgs> PlaybackFinished
Event Type
Type | Description |
---|---|
AsyncEventHandler<LavalinkGuildConnection, TrackFinishEventArgs> |
PlaybackStarted
Triggered whenever playback of a track starts.
This is only available for version 3.3.1 and greater.
Declaration
public event AsyncEventHandler<LavalinkGuildConnection, TrackStartEventArgs> PlaybackStarted
Event Type
Type | Description |
---|---|
AsyncEventHandler<LavalinkGuildConnection, TrackStartEventArgs> |
PlayerUpdated
Triggered whenever any of the players on this node is updated.
Declaration
public event AsyncEventHandler<LavalinkGuildConnection, PlayerUpdateEventArgs> PlayerUpdated
Event Type
Type | Description |
---|---|
AsyncEventHandler<LavalinkGuildConnection, PlayerUpdateEventArgs> |
StatisticsReceived
Triggered when this node receives a statistics update.
Declaration
public event AsyncEventHandler<LavalinkNodeConnection, StatisticsReceivedEventArgs> StatisticsReceived
Event Type
Type | Description |
---|---|
AsyncEventHandler<LavalinkNodeConnection, StatisticsReceivedEventArgs> |
TrackException
Triggered whenever playback of a track encounters an error.
Declaration
public event AsyncEventHandler<LavalinkGuildConnection, TrackExceptionEventArgs> TrackException
Event Type
Type | Description |
---|---|
AsyncEventHandler<LavalinkGuildConnection, TrackExceptionEventArgs> |
TrackStuck
Triggered whenever playback of a track gets stuck.
Declaration
public event AsyncEventHandler<LavalinkGuildConnection, TrackStuckEventArgs> TrackStuck
Event Type
Type | Description |
---|---|
AsyncEventHandler<LavalinkGuildConnection, TrackStuckEventArgs> |