public async Task JoinAsync() { if ((Context.User as IVoiceState) == null) { await ReplyAsync("You must be in a voice channel first!"); } else { await borkAudio.ConnectAsync(Context.Guild, (Context.User as IVoiceState).VoiceChannel, Context.Channel); } }
public async Task Join() { var user = Context.User as SocketGuildUser; if (user.VoiceChannel is null) { await ReplyAsync(Config.pre.error + " You need to connect to a voice channel."); return; } else { await _musicService.LeaveAsync(user.VoiceChannel); await _musicService.ConnectAsync(user.VoiceChannel, Context.Channel as ITextChannel); await SetVolume(Config.mem.musicVolume, false); await ReplyAsync(Config.pre.success + $" Now connected to {user.VoiceChannel.Name}"); } }