Yucked/Victoria

Extension for adding Generic LavaNode via IServiceCollection

Aaalexer opened this issue · 1 comments

There isn't shortcut method to add LavaNode to IServiceCollection with custom player class. Just add new overload like this:

public static IServiceCollection AddLavaNode<T>(this IServiceCollection serviceCollection,
                                                Action<LavaConfig> action = default) 
                                                where T : LavaPlayer
{
    var lavaConfig = new LavaConfig();
    action?.Invoke(lavaConfig);
    serviceCollection.AddSingleton(lavaConfig);
    serviceCollection.AddSingleton<LavaNode<T>>();
    return serviceCollection;
}

Added in cf23ef7