您好,我无法在嵌入缩略图中使用图像文件。 我不断收到错误消息:
PermissionError: [Errno 13] Permission denied: './img/'
文件在此文件夹中。
这是我正在使用的代码:
@commands.command(invoke_without_command=True, case_insensitive=True)
@checks.is_channel_mod()
async def changelog(self, ctx):
with open("changelog.txt") as f:
changelog = f.read()
embed = discord.Embed(description=changelog, title='**__CHANGELOG__**', colour=discord.Color(random.randint(0x000000, 0xFFFFFF)))
embed.add_field(name="__**Have a Suggestion?**__", value="Please tell us about it in <#555371532390760473>", inline=False)
embed.set_thumbnail(url="attachment://changelog.png")
return {
"file": discord.File("./img/")
}
await ctx.send(embed=embed)
答案 0 :(得分:0)
我似乎已经知道了,这是我的答案:
@commands.command(invoke_without_command=True, case_insensitive=True)
@checks.is_channel_mod()
async def changelog(self, ctx):
with open("changelog.txt") as f:
changelog = f.read()
f = discord.File(f"./img/changelog.png", f"changelog.png")
embed = discord.Embed(description=changelog, title='**__CHANGELOG__**', colour=discord.Color(random.randint(0x000000, 0xFFFFFF)))
embed.add_field(name="__**Have a Suggestion?**__", value="Please tell us about it in <#555371532390760473>", inline=False)
embed.set_thumbnail(url=f"attachment://changelog.png")
await ctx.send(file=f, embed=embed)