【问题标题】:How to show the url of an image with python discord bot?如何使用 python discord bot 显示图像的 url?
【发布时间】:2022-12-11 20:14:47
【问题描述】:

我正在用 python 创建一个小机器人,但我有一个小问题,我希望它以链接的形式向我显示图像,但我不知道该怎么做

这是我目前使用的代码:

with io.BytesIO() as image_binary:
            img1.save(image_binary, 'PNG')
            image_binary.seek(0)
            embed=discord.Embed(title="Skin Minecraft", url="https://twitter.com/", description=f"", color=discord.Colour.random())
    
            embed.set_image(url=f"attachment://Skin-{usuariominecraft}.png")
           
            await ctx.send(embed=embed, file=discord.File(fp=image_binary, filename=f"Skin-{usuariominecraft}.png"))

我想要的是它直接向我显示链接,如下所示:

https://cdn.discordapp.com/attachments/1050554950377295932/1051229055581700216/Skin-TCGBayQ.png

我不知道该怎么做

非常感谢您!

【问题讨论】:

    标签: python


    【解决方案1】:

    您可以像这样使用不和谐格式:

    ```
    https://cdn.discordapp.com/attachments/1050554950377295932/1051229055581700216/Skin-TCGBayQ.png
    ```
    

    在不和谐的情况下,它看起来像这样:

    【讨论】:

    • 是的,但机器人生成其他图像和其他链接它并不总是相同的链接
    • 要获取链接,您可以让您的机器人在某个私人频道上传图片,然后获取 url。
    猜你喜欢
    • 2018-10-16
    • 2018-08-10
    • 2022-07-08
    • 2021-08-09
    • 2015-06-10
    • 2021-06-28
    • 2021-01-21
    • 1970-01-01
    • 2017-10-09
    相关资源
    最近更新 更多