从 json 文件读取数据然后写入嵌入?

reading data from json file then writing into an embed?

所以我正在开发一个 discord 机器人的新功能,它会告诉你服务器中的所有派对(氏族),氏族信息存储在 json 文件中,我想通过 send_message() 将其发送给用户,但它不断返回此错误:discord.ext.commands.errors.CommandInvokeError:命令引发异常:HTTPException:BAD REQUEST(状态代码:400) 经过一番研究,这意味着消息中有超过 2000 个字符,我想知道我的代码有什么问题,欢迎任何建议,感谢阅读本文。 #I_Love_Troubleshooting

@client.command(pass_context=True)
async def partylist(ctx):
    user = ctx.message.author
    await partylist(user)


async def partylist(user):
    partylist = discord.Embed(
        colour = discord.Colour.orange()
    )
    partylist.set_author(name="Parties")
    with open(url2, 'r') as w:
        file = json.load(w)
        for item in file:
            partylist.add_field(name=item,value="",inline=False)
    w.close()
    await client.say(user,embed=partylist)

#This is the json file
{"clan2": {"Members": "ShareYourGraves#9977"}, "clan1": {"Members": "||CATENARY||#9105,"}}

我建议你只向用户发送有限数量的信息,让他们通过不同的命令获得更详细的信息,或者让他们在网页上查看

data={"clan2": {"Members": "ShareYourGraves#9977"}, "clan1": {"Members": "||CATENARY||#9105,"}}

async def send_data(user):
    emb=discord.Embed(title='Data')
    clans=[name for name in data]
    emb.add_field(name='clan names',value=" ,".join(clans))
    await bot.send_message(user,embed=emb)