【发布时间】:2018-08-19 16:34:35
【问题描述】:
我正在创建一个不和谐的机器人,它应该能够播放来自 youtube 的音乐。我已经创建了播放音乐的代码,但我仍然需要下载音乐。当我下载它时,我得到这个输出:
Downloading (VIDEO NAME) - YouTube.mp4 to C:\Users\Laurin\source\repos\DiscordBot\DiscordBot\bin\Release\netcoreapp2.0\win10-x64
Downloaded. Saving to disk
16:46:15 Gateway A MessageReceived handler is blocking the gateway task.
我当前的代码:
[Command("yt")]
public async Task ytCommand([Remainder] string url)
{
SaveVideoToDisk(url);
}
void SaveVideoToDisk(string link)
{
var youTube = YouTube.Default; // starting point for YouTube actions
var video = youTube.GetVideo(link); // gets a Video object with info about the video
Console.WriteLine("Downloading " + video.FullName + " to " + Directory.GetCurrentDirectory());
byte[] bytes = video.GetBytes();
Console.WriteLine("Downloaded. Saving to disk");
File.WriteAllBytes(Directory.GetCurrentDirectory() + video.FullName, bytes);
}
我正在使用libvideo/VideoLibrary 下载视频
【问题讨论】:
-
为什么这个问题被否决了?
-
@Unknown 我也不知道
-
我没有投反对票,但我怀疑这与您没有提出问题有关,因此您在这篇文章上浪费了大家的时间,因为没有办法回答它。 Stack Overflow 不是一个讨论论坛,它是一个问答网站,您可以在其中提出可以回答而不是讨论的特定编程问题。请阅读How do I ask a good question? 和What topics can I ask about here?,然后编辑您的问题以符合网站指南。
标签: c# .net console-application discord.net