尽管少于2000个字符,但嵌入会导致不一致错误400

时间:2019-03-04 09:06:43

标签: python-3.x discord.py

与标题中所述完全相同。我有一个麻烦的嵌入。它在大多数情况下都可以运行,但是尽管每次它抛出不和谐的400并破坏所有内容时,尽管有时会馈入完全相同的数据。

我试图创建一个回归循环来捕获异常,然后一直运行直到它起作用为止。这工作了一段时间,但并非一直如此。

async def ManageRollRoyalleRoll(thePlayer):
    output=None
    try:
        output = await MakeRollRoyalleRoll(thePlayer)
    except discord.Forbidden:
        output = await ManageRollRoyalleRoll(thePlayer)
    return output

我应该使用另一个不一致的异常吗?因为在这里和其他站点拖网一周后,这才是我能想到的。

谢谢

1 个答案:

答案 0 :(得分:0)

最终找到了。

async def ManageRollRoyalleRoll(thePlayer):
    output=None
    try:
        output = await MakeRollRoyalleRoll(thePlayer)
    except discord.errors.HTTPException:
        output = await ManageRollRoyalleRoll(thePlayer)
    return output

这就像梦一样。