Lavalink4net (#3)

* Update readme.md

Test

Migrate from Victoria

* Small fix

---------

Co-authored-by: Myx <info@azaaxin.com>
This commit is contained in:
2024-08-11 16:06:52 +02:00
committed by GitHub
parent d72676c7e0
commit 9bcebea6b0
22 changed files with 337 additions and 315 deletions

View File

@@ -0,0 +1,29 @@
using Discord.WebSocket;
using Lavalink4NET;
using Lavalink4NET.Players;
using MediatR;
namespace Lunaris2.Handler.MusicPlayer.ResumeCommand;
public record ResumeCommand(SocketSlashCommand Message) : IRequest;
public class ResumeHandler(DiscordSocketClient client, IAudioService audioService) : IRequestHandler<ResumeCommand>
{
public async Task Handle(ResumeCommand command, CancellationToken cancellationToken)
{
var context = command.Message;
var player = await audioService.GetPlayerAsync(client, context, connectToVoiceChannel: true);
if (player is null)
return;
if (player.State is not PlayerState.Paused)
{
await context.SendMessageAsync("Player is not paused.", client);
return;
}
await player.ResumeAsync(cancellationToken);
await context.SendMessageAsync("Resumed.", client);
}
}