Extension for adding Generic LavaNode via IServiceCollection
Aaalexer opened this issue · 1 comments
Aaalexer commented
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;
}