public async Task LeaveAudio() { await UsingAudioClient.StopAsync(); UsingAudioClient = null; UsingVoiceChannel = null; //ConnectedChannels.Remove(guild.Id, out info); //await Log(LogSeverity.Info, $"Disconnected from voice on {guild.Name}."); }
public async Task SendAudioAsync(IMessageChannel channel, string path) { // Your task: Get a full path to the file if the value of 'path' is only a filename. if (!File.Exists(path)) { await channel.SendMessageAsync("File does not exist."); return; } if (UsingAudioClient != null) { //await Log(LogSeverity.Debug, $"Starting playback of {path} in {guild.Name}"); using (var ffmpeg = CreateProcess(path)) using (var stream = UsingAudioClient.CreatePCMStream(AudioApplication.Music)) { try { await ffmpeg.StandardOutput.BaseStream.CopyToAsync(stream); } finally { await stream.FlushAsync(); } } } }