繁体   English   中英

我如何添加用户在 discord.py embed 中发送的 img

[英]how i add a img that a user sent in a discord.py embed

我正在提出建议 discord 机器人,我想知道我是否可以添加用户在 embed 上发布的图像

就像是

embed.set_image(url=image_url)

image_url将是用户添加到消息中的图像。

您可以使用message.attachments获取邮件附件列表:

@bot.command()
async def send_image(ctx):
    embed = discord.Embed(title="Your attached image")
    if len(message.attachments):
        embed.set_image(url=ctx.message.attachments[0].url)
    await ctx.send(embed=embed)

暂无
暂无

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

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