diff --git a/backend/Music/Commands/Leave.cs b/backend/Music/Commands/Leave.cs index ad9ace5be..d24ee5e1b 100644 --- a/backend/Music/Commands/Leave.cs +++ b/backend/Music/Commands/Leave.cs @@ -11,6 +11,7 @@ public class LeaveCommand : MusicCommand public async Task Leave() { await Player.StopAsync(); + await Player.DisconnectAsync(); await RespondInteraction("Left this session, the queue has been cleaned"); } diff --git a/backend/Music/Commands/Volume.cs b/backend/Music/Commands/Volume.cs index 62804413e..56e0ad666 100644 --- a/backend/Music/Commands/Volume.cs +++ b/backend/Music/Commands/Volume.cs @@ -6,7 +6,7 @@ namespace Music.Commands; public class VolumeCommand : MusicCommand { - [SlashCommand("volume", description: "Sets the player volume (0 - 1000%)", runMode: RunMode.Async)] + [SlashCommand("volume", description: "Sets the player volume (0 - 1000%)")] [BotChannel] public async Task Volume(int volume = 100) { diff --git a/backend/Music/Extensions/GetPlayer.cs b/backend/Music/Extensions/GetPlayer.cs index a5be5e944..1777f6131 100644 --- a/backend/Music/Extensions/GetPlayer.cs +++ b/backend/Music/Extensions/GetPlayer.cs @@ -5,6 +5,10 @@ using Music.Services; using Discord; using Lavalink4NET.DiscordNet; +using Lavalink4NET.Integrations.SponsorBlock; +using System.Collections.Immutable; +using System.Numerics; +using Lavalink4NET.Integrations.SponsorBlock.Extensions; namespace Music.Extensions; @@ -29,7 +33,21 @@ public static async ValueTask GetPlayerAsync(this IAudioServ await context.Interaction.FollowupAsync("Connecting to voice channel."); music.SetStartTimeAsCurrent(context.Guild.Id); - return await audio.GetPlayerAsync(context, music, true); + + var player = await audio.GetPlayerAsync(context, music, true); ; + + var categories = ImmutableArray.Create( + SegmentCategory.Intro, + SegmentCategory.Sponsor, + SegmentCategory.SelfPromotion, + SegmentCategory.OfftopicMusic + ); + + await player + .UpdateSponsorBlockCategoriesAsync(categories) + .ConfigureAwait(false); + + return player; } var errorMessage = result.Status switch diff --git a/backend/Music/MusicModule.cs b/backend/Music/MusicModule.cs index 9e1fef9a6..daa80ca1c 100644 --- a/backend/Music/MusicModule.cs +++ b/backend/Music/MusicModule.cs @@ -7,7 +7,9 @@ using Lavalink4NET.InactivityTracking; using Lavalink4NET.InactivityTracking.Extensions; using Lavalink4NET.InactivityTracking.Trackers.Idle; +using Lavalink4NET.Integrations.SponsorBlock.Extensions; using Lavalink4NET.Lyrics; +using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using System.Net; @@ -54,6 +56,8 @@ public override void AddServices(IServiceCollection services, CachedServices cac .AddLavalink(); } + public override void ConfigureModules(List modules, WebApplication app) => app.UseSponsorBlock(); + public static IPAddress GetMyIp() { var services = new List()