Class LavalinkGuildConnection
Represents a Lavalink connection to a channel.
Inheritance
Namespace: DSharpPlus.Lavalink
Assembly: cs.temp.dll.dll
Syntax
public sealed class LavalinkGuildConnection
Properties
Channel
Gets the voice channel associated with this connection.
Declaration
public DiscordChannel Channel { get; }
Property Value
Type | Description |
---|---|
DiscordChannel |
CurrentState
Gets the current player state.
Declaration
public LavalinkPlayerState CurrentState { get; }
Property Value
Type | Description |
---|---|
LavalinkPlayerState |
Guild
Gets the guild associated with this connection.
Declaration
public DiscordGuild Guild { get; }
Property Value
Type | Description |
---|---|
DiscordGuild |
IsConnected
Gets whether this channel is still connected.
Declaration
public bool IsConnected { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Node
Gets the Lavalink node associated with this connection.
Declaration
public LavalinkNodeConnection Node { get; }
Property Value
Type | Description |
---|---|
LavalinkNodeConnection |
Methods
AdjustEqualizerAsync(LavalinkBandAdjustment[])
Adjusts the specified bands in the audio equalizer. This will alter the sound output, and might incur a lot of CPU usage.
Declaration
public Task AdjustEqualizerAsync(params LavalinkBandAdjustment[] bands)
Parameters
Type | Name | Description |
---|---|---|
LavalinkBandAdjustment[] | bands | Bands adjustments to make. You must specify one adjustment per band at most. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
DisconnectAsync(Boolean)
Disconnects the connection from the voice channel.
Declaration
public Task DisconnectAsync(bool shouldDestroy = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | shouldDestroy | Whether the connection should be destroyed on the Lavalink server when leaving. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
GetTracksAsync(FileInfo)
Loads tracks from a local file.
Declaration
public Task<LavalinkLoadResult> GetTracksAsync(FileInfo file)
Parameters
Type | Name | Description |
---|---|---|
FileInfo | file | File to load tracks from. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<LavalinkLoadResult> | A collection of tracks from the file. |
GetTracksAsync(String, LavalinkSearchType)
Searches for specified terms.
Declaration
public Task<LavalinkLoadResult> GetTracksAsync(string searchQuery, LavalinkSearchType type = LavalinkSearchType.Youtube)
Parameters
Type | Name | Description |
---|---|---|
System.String | searchQuery | What to search for. |
LavalinkSearchType | type | What platform will search for. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<LavalinkLoadResult> | A collection of tracks matching the criteria. |
GetTracksAsync(Uri)
Loads tracks from specified URL.
Declaration
public Task<LavalinkLoadResult> GetTracksAsync(Uri uri)
Parameters
Type | Name | Description |
---|---|---|
Uri | uri | URL to load tracks from. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<LavalinkLoadResult> | A collection of tracks from the URL. |
PauseAsync()
Pauses the player.
Declaration
public Task PauseAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
PlayAsync(LavalinkTrack)
Queues the specified track for playback.
Declaration
public Task PlayAsync(LavalinkTrack track)
Parameters
Type | Name | Description |
---|---|---|
LavalinkTrack | track | Track to play. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
PlayPartialAsync(LavalinkTrack, TimeSpan, TimeSpan)
Queues the specified track for playback. The track will be played from specified start timestamp to specified end timestamp.
Declaration
public Task PlayPartialAsync(LavalinkTrack track, TimeSpan start, TimeSpan end)
Parameters
Type | Name | Description |
---|---|---|
LavalinkTrack | track | Track to play. |
TimeSpan | start | Timestamp to start playback at. |
TimeSpan | end | Timestamp to stop playback at. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
ResetEqualizerAsync()
Resets the audio equalizer to default values.
Declaration
public Task ResetEqualizerAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
ResumeAsync()
Resumes playback.
Declaration
public Task ResumeAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
SeekAsync(TimeSpan)
Seeks the current track to specified position.
Declaration
public Task SeekAsync(TimeSpan position)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | position | Position to seek to. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
SetVolumeAsync(Int32)
Sets the playback volume. This might incur a lot of CPU usage.
Declaration
public Task SetVolumeAsync(int volume)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | volume | Volume to set. Needs to be greater or equal to 0, and less than or equal to 100. 100 means 100% and is the default value. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
StopAsync()
Stops the player completely.
Declaration
public Task StopAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Events
DiscordWebSocketClosed
Triggered whenever Discord Voice WebSocket connection is terminated.
Declaration
public event AsyncEventHandler<LavalinkGuildConnection, WebSocketCloseEventArgs> DiscordWebSocketClosed
Event Type
Type | Description |
---|---|
AsyncEventHandler<LavalinkGuildConnection, WebSocketCloseEventArgs> |
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 Lavalink updates player status.
Declaration
public event AsyncEventHandler<LavalinkGuildConnection, PlayerUpdateEventArgs> PlayerUpdated
Event Type
Type | Description |
---|---|
AsyncEventHandler<LavalinkGuildConnection, PlayerUpdateEventArgs> |
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> |