π - Lavalink wrapper for Discord.NET which provides more options and performs better than all .NET Lavalink libraries combined.
Victoria 7.x rewrites focuses on Lavalink v4 support. Lavalink v4 introduces several changes which break Victoria's functionality on v6.x, to avoid codebase overhaul on user's end, breaking changes are minimal on Victoria' end.
ExceptionSeverity
for Lavalink exceptions- Introduced
ISRC
,SourceName
,PluginInfo
,Artwork
properties inLavaTrack
- Added
LavaNodeExtensions
,LavaPlayerExtensions
for non-API methods. - Added
GetLavalinkVersionAsync
,GetLavalinkStatsAsync
,UpdatePlayerAsync
,UpdateSessionAsync
,DestroyPlayerAsync
methods toLavaNode
.
ArtworkResolver
,LyricsResolver
have been moved to Victoria.Addons, this will be a separate package.- Removed
Bands
,TextChannel
,VoiceChannel
,IsConnected
properties fromLavaPlayer
.
Vueue
is renamed toLavaQueue
, this change my be reverted.LavaPlayer
no longer contains any methods for controlling the player.RoutePlanner
has been merged withLavaNode
.
Full example code @ https://github.com/Yucked/Victoria/tree/examples/v7
π² Program.cs
var serviceCollection = new ServiceCollection()
// .. other services
.AddLogging(x => {
x.ClearProviders();
x.AddColorfulConsole();
x.SetMinimumLevel(LogLevel.Trace);
})
.AddLavaNode()
.AddSingleton<AudioService>();
π€ Discord Service / Events Handler
private async Task OnReadyAsync() {
// connect to lavalink
await _serviceProvider.UseLavaNodeAsync();
}
πΈ AudioModule.cs
[Command("Join")]
public async Task JoinAsync() {
var voiceState = Context.User as IVoiceState;
if (voiceState?.VoiceChannel == null) {
await ReplyAsync("You must be connected to a voice channel!");
return;
}
try {
await lavaNode.JoinAsync(voiceState.VoiceChannel);
await ReplyAsync($"Joined {voiceState.VoiceChannel.Name}!");
audioService.TextChannels.TryAdd(Context.Guild.Id, Context.Channel.Id);
}
catch (Exception exception) {
await ReplyAsync(exception.ToString());
}
}