SharpLink 1.0.0-beta-0002

This is a prerelease version of SharpLink.
There is a newer prerelease version of this package available.
See the version list below for details.
Install-Package SharpLink -Version 1.0.0-beta-0002
dotnet add package SharpLink --version 1.0.0-beta-0002
<PackageReference Include="SharpLink" Version="1.0.0-beta-0002" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SharpLink --version 1.0.0-beta-0002
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SharpLink, 1.0.0-beta-0002"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install SharpLink as a Cake Addin
#addin nuget:?package=SharpLink&version=1.0.0-beta-0002&prerelease

// Install SharpLink as a Cake Tool
#tool nuget:?package=SharpLink&version=1.0.0-beta-0002&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

SharpLink

A lavalink wrapper for Discord.Net!

NuGet Pre Release

Getting Started

Here is some example code to help get you started with SharpLink.

First you want to make sure you have the LavalinkManager set up.

DiscordSocketClient client = new DiscordSocketClient();

// You must pass the socket client over to the manager for reference
LavalinkManager lavalinkManager = new LavalinkManager(client, new LavalinkManagerConfig()
{
    // You do not have to pass a config. Default config is as provided at https://github.com/Frederikam/Lavalink/blob/master/LavalinkServer/application.yml.example
    RESTHost = "localhost",
    RESTPort = 2333,
    WebSocketHost = "localhost",
    WebSocketPort = 80,
    Authorization = "YOUR_SECRET_AUTHORIZATION_KEY",
    TotalShards = 1 // Please set this to the total amount of shards your bot uses
});

Once a LavalinkManager is set up it will need to be started. It is recommended you put this in the ready event.

client.Ready += async () =>
{
    await lavalinkManager.StartAsync();
}

From there you can connect to audio channels, play music, and do whatever else you wish to do. Here is an example to connect and play music on a voice channel.

// First we check if the guild has a player
LavalinkPlayer player = lavalinkManager.GetPlayer(GUILD_ID);

// Looks like we don't have a player let's join the channel the user is in
if (player == null)
{
    player = await lavalinkManager.JoinAsync(VOICE_CHANNEL);
}

// Now that we have a player we can go ahead and grab a track and play it
LavalinkTrack track = await lavalinkManager.GetTrackAsync("IDENTIFIER");
await player.PlayAsync(track);

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0-beta-0005 1,625 8/15/2018
1.0.0-beta-0004 540 7/9/2018
1.0.0-beta-0002 566 6/23/2018
1.0.0-beta-0001 513 6/3/2018
1.0.0-beta 489 5/31/2018

- Fixed bug in ResumeAsync
- Events are better and use a custom AsyncEvent delegate
- Logging improvements
- Fixed bug with players not being cleaned up properly
- Event name changes (PlayerEnd => TrackEnd, PlayerException => TrackException, PlayerStuck => TrackStuck)
- DiscordShardedClient support
- Renamed GetTrack to GetTrackAsync
- Added GetTracksAsync