嵌入尺寸过大时如何解决“错误请求(状态代码:400)”

时间:2019-01-29 11:16:28

标签: python python-3.x embed discord discord.py

我有一个discord机器人(使用discord.py),它为用户提供了一个“个人资料”,其中包括他们赢得了多少场比赛(这场比赛并不重要),得分,联赛以及输掉了多少场比赛。嵌入式领域没有太多内容,因此我很困惑为什么会收到此错误。

这将是一款在游戏中管理联赛的机器人(得分,联赛等),我已经尝试用其他东西(只是两个连字符“-”)替换“ \ u200b”的字符串,但是并非如此(它做同样的事情,\ u200b应该仍然可以工作)。

    rankid = 5
    leagueid = 4
    logourl = author.avatar_url
    name = 'Duffy'
    score = 100
    wins = 10
    losses = 10

    if rankid == 0:
        rank = ''
    elif rankid == 1:
        rank = ' Skilled'
    elif rankid == 2:
        rank = ' Adept'
    elif rankid == 3:
        rank = ' Expert'
    elif rankid == 4:
        rank == ' Legendary'
    elif rankid == 5:
        rank = ' Godly'

    if leagueid == 1:
        col = 0xa5744e
        league = '- Bronze League -'
    elif leagueid == 2:
        col = 0xa4bdc4
        league = '- Silver League -'
    elif leagueid == 3:
        col = 0xdae68b
        league = '- Gold League -'
    elif leagueid == 4:
        col = 0xdfd5d60
        league = '- QC Member -'


    embed = discord.Embed(title="-----------------", colour=discord.Colour(col), description="Rank:"+rank+" Duck")

    embed.set_thumbnail(url=logourl)
    embed.set_author(name="Profile of: "+name)

    embed.add_field(name=league, value="​\u200b")
    embed.add_field(name="Score", value=str(score))
    embed.add_field(name="Wins", value=str(wins), inline=True)
    embed.add_field(name="Losses", value=str(losses), inline=True)


    await client.send_message(message.channel,embed=embed)

为我提供了所需的嵌入字段(相反,discord内不执行任何操作并吐出错误:discord.errors.HTTPException:BAD REQUEST(状态码:400))

0 个答案:

没有答案