Compare commits

...

1 Commits
0.1.8 ... 0.1.9

Author SHA1 Message Date
1e2c10a7ea Require user to be in chat to queue (#5)
Co-authored-by: Myx <info@azaaxin.com>
2024-08-12 19:16:11 +02:00

View File

@@ -45,10 +45,17 @@ public class PlayHandler : IRequestHandler<PlayCommand>
async void PlayMusic() async void PlayMusic()
{ {
await _audioService.StartAsync(cancellationToken);
var context = command.Message; var context = command.Message;
_context = context; _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); var searchQuery = context.GetOptionValueByName(Option.Input);
if (string.IsNullOrWhiteSpace(searchQuery)) if (string.IsNullOrWhiteSpace(searchQuery))