【发布时间】:2020-12-09 16:07:35
【问题描述】:
所以我不知道这里有什么错误。如果您查看下面的代码,您会看到我将前缀定义为前缀,但它只显示 str 前缀。帮助。
代码:
@client.command()
async def test(ctx):
with open('main code\pp.json', 'r') as f:
prefixes = json.load(f)
prefixes[str(ctx.guild.id)] = prefix
embed = discord.Embed(colour = discord.Color.red())
embed.set_author(name="test")
embed.add_field(name="testing", value=f"{prefix}")
await ctx.send(embed=embed)
结果只是“前缀”而不是 json 文件中的前缀
【问题讨论】:
-
你在哪里定义
prefix?
标签: python python-3.x discord discord.py discord.py-rewrite