繁体   English   中英

在嵌入 discord.py 中上传文件(不是图像)

[英]Uploading a file in a embed discord.py (not a image)

我正在尝试直接在嵌入中上传文件,我可以上传文件,但我找不到将其放入嵌入中的方法。 我想要的不是显示文件而是上传它以便我们可以下载它,是否可以嵌入? 谢谢

我可以将文件附加到嵌入中,但它不会将其放入嵌入中,它只是同时发送它

问题解决了,你不能这样做,这是另一种方式,更紧凑。

@client.command()
async def file(ctx, arg):
    file = discord.File(arg)
    embed = discord.Embed(title='Title', description='a description', color=0xfce303)
    await ctx.send(embed=embed, file=file)

如果您想将文件放入嵌入中,这是不可能的,discord 本身不允许这样做。 您可以同时发送文件和消息。 就是这样:

@client.command()
async def name(ctx):
    embed = discord.Embed(colour=0x00000)
    embed.title = f"your title"
    embed.description = f"your desc"
    await ctx.send(embed=embed)
    await ctx.file.send("filename.txt")

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM