Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从Youtube向discord机器人python发送视频_Python_Video_Discord_Bots_Discord.py - Fatal编程技术网

如何从Youtube向discord机器人python发送视频

如何从Youtube向discord机器人python发送视频,python,video,discord,bots,discord.py,Python,Video,Discord,Bots,Discord.py,我正在使用python discord bot。我需要从Youtube发送视频。我只有这个视频的url。请帮帮我。假设不存在8mb的文件不一致限制。然后你想先下载youtube视频,然后通过discord频道发送。你需要皮管 pip install pytube 在discord.py文件中: @bot.command(pass_context=True) async def send(ctx): area=ctx.message.channel await bot.send_

我正在使用python discord bot。我需要从Youtube发送视频。我只有这个视频的url。请帮帮我。

假设不存在8mb的文件不一致限制。然后你想先下载youtube视频,然后通过discord频道发送。你需要皮管

pip install pytube
在discord.py文件中:

@bot.command(pass_context=True)
async def send(ctx):
    area=ctx.message.channel
    await bot.send_file(area, r"c:\location\of\the_file_to\send.png",filename="Trial",content="Message test")

你能再详细一点吗?我的理解是,用户输入URL,你想让机器人发送视频?是的,你说得对。这样做的一个问题是不一致将文件限制为8mb。不过,我会留下一个答案,假设机器人不遵守限制,这个答案会有效。谢谢。但我能不存钱就做吗?遗憾的是,不行(我想不出其他办法)。无论如何,如果这有助于你验证我的答案吗?谢谢。
@bot.command(pass_context=True)
async def send(ctx):
    area=ctx.message.channel
    await bot.send_file(area, r"c:\location\of\the_file_to\send.png",filename="Trial",content="Message test")