簡體   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