Finish experimental version of voice utils
This commit is contained in:
parent
1ee627a915
commit
ceff1cc3b9
3 changed files with 33 additions and 12 deletions
|
@ -57,10 +57,12 @@ namespace Geekbot.net.Commands
|
|||
|
||||
await audioClient.StopAsync();
|
||||
await ReplyAsync("Disconnected from channel!");
|
||||
_audioUtils.Cleanup(Context.Guild.Id);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_errorHandler.HandleCommandException(e, Context);
|
||||
_audioUtils.Cleanup(Context.Guild.Id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,15 +82,20 @@ namespace Geekbot.net.Commands
|
|||
await ReplyAsync("I'm not in a voice channel at the moment");
|
||||
return;
|
||||
}
|
||||
|
||||
var message = await Context.Channel.SendMessageAsync("Just a second, i'm still a bit slow at this");
|
||||
var ffmpeg = _audioUtils.CreateStreamFromYoutube(url, Context.Guild.Id);
|
||||
var output = ffmpeg.StandardOutput.BaseStream;
|
||||
await message.ModifyAsync(msg => msg.Content = "**Playing!** Please note that this feature is experimental");
|
||||
var discord = audioClient.CreatePCMStream(Discord.Audio.AudioApplication.Mixed);
|
||||
await output.CopyToAsync(discord);
|
||||
await discord.FlushAsync();
|
||||
_audioUtils.Cleanup(Context.Guild.Id);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_errorHandler.HandleCommandException(e, Context);
|
||||
_audioUtils.Cleanup(Context.Guild.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue