mirror of
https://github.com/Myxelium/Lunaris2.0.git
synced 2026-07-08 05:45:10 +00:00
Refactor
This commit is contained in:
29
Bot/Registration/MusicPlayerRegistration.cs
Normal file
29
Bot/Registration/MusicPlayerRegistration.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Lavalink4NET.Extensions;
|
||||
using Lunaris2.Handler.MusicPlayer;
|
||||
using Lunaris2.Service;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Lunaris2.Registration;
|
||||
|
||||
public static class MusicPlayerRegistration
|
||||
{
|
||||
public static IServiceCollection AddMusicPlayer(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services
|
||||
.AddLavalink()
|
||||
.ConfigureLavalink(options =>
|
||||
{
|
||||
options.BaseAddress = new Uri(
|
||||
$"http://{configuration["LavaLinkHostname"]}:{configuration["LavaLinkPort"]}"
|
||||
);
|
||||
options.WebSocketUri = new Uri($"ws://{configuration["LavaLinkHostname"]}:{configuration["LavaLinkPort"]}/v4/websocket");
|
||||
options.Passphrase = configuration["LavaLinkPassword"] ?? "youshallnotpass";
|
||||
options.Label = "Node";
|
||||
})
|
||||
.AddSingleton<MusicEmbed>()
|
||||
.AddSingleton<VoiceChannelMonitorService>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user