[英]how i add a img that a user sent in a discord.py embed
I'm making a suggestion discord bot, and I'd like to know if there's how I can add an image that the user posted on embed我正在提出建议 discord 机器人,我想知道我是否可以添加用户在 embed 上发布的图像
something like就像是
embed.set_image(url=image_url)
the image_url would be the image the user added to the message. image_url将是用户添加到消息中的图像。
You can use message.attachments
to get a list of message attachments:您可以使用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.