将图像发送到discord.py中

问题描述

我正在尝试在discord.py中发送嵌入内容,但是每当我运行代码时,都不会发送任何内容。没有错误就没有。这是我的代码:

from variables.variables import client,token
import discord


@client.command()
async def test(ctx):
    imageURL = "https://discordapp.com/assets/e4923594e694a21542a489471ecffa50.svg"
    embed = discord.Embed()
    embed.set_image(url=imageURL)
    await ctx.send(embed=embed)

client.run(token)

使用上面的代码,这就是嵌入的样子:

What the embed looks like

谢谢!

解决方法

不支持

.svg。这是.png格式的同一张图片:

@client.command()
async def test(ctx):
    imageURL = "https://cdn.discordapp.com/attachments/744631318578462740/755866713182044240/ezgif-4-6eba1fde99f2.png"
    embed = discord.Embed()
    embed.set_image(url=imageURL)
    await ctx.send(embed=embed)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...