Compare commits

..

1 Commits

Author SHA1 Message Date
Myx
68580d0e24 Fix deadlock and auto leave voice channel after 3 min
* Fix for thread being busy handling discord commands blocking audioplayer to timeout
* Auto leave if alone in voice channel after 3 min
2024-08-12 02:01:12 +02:00

View File

@@ -45,16 +45,9 @@ public class PlayHandler : IRequestHandler<PlayCommand>
async void PlayMusic()
{
await _audioService.StartAsync(cancellationToken);
var context = command.Message;
_context = context;
if ((context.User as SocketGuildUser)?.VoiceChannel == null)
{
await context.SendMessageAsync("You must be in a voice channel to use this command.", _client);
return;
}
await _audioService.StartAsync(cancellationToken);
var searchQuery = context.GetOptionValueByName(Option.Input);
@@ -63,7 +56,7 @@ public class PlayHandler : IRequestHandler<PlayCommand>
await context.SendMessageAsync("Please provide search terms.", _client);
return;
}
var player = await _audioService.GetPlayerAsync(_client, context, connectToVoiceChannel: true);
if (player is null) return;