【发布时间】:2020-09-30 09:00:48
【问题描述】:
目前正在为我们之中的一个不和谐机器人工作,遇到一个我似乎无法修复的奇怪错误。
当我尝试编辑嵌入时,我在代码的一部分中没有遇到问题,但是当我复制并粘贴代码以在另一区域执行完全相同的操作时,它给了我这个错误:
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
这是有问题的代码:
if emoji == '✅':
#Add User to lobby members list
if user in LOBBY_MEMBERS:
consoleMessage = str(user) + ' is already in the lobby.'
else:
LOBBY_MEMBERS.append(user)
consoleMessage = str(user) + ' has joined the lobby.'
updated_embed=discord.Embed(title="Among Us Lobby", description="Welcome to the among us bot!", color=0x00ff1e)
################Error does not show up here:##########################
await reaction.message.edit(embed=updated_embed)
if emoji == '❌':
if user in LOBBY_MEMBERS:
LOBBY_MEMBERS.remove(user)
consoleMessage = str(user) + ' has left the lobby.'
updated_embed=discord.Embed(title="Among Us Lobby", description="Welcome to the among us bot!", color=0x00ff1e)
################Error shows up here:##########################
await reaction.message.edit(embed=updated_embed)
else:
consoleMessage = str(user) + ' is not in the lobby. Cannot remove someone who has not joined.'
我真的是 python 新手,我不知道为什么它在代码的一部分中起作用,而在另一部分中不起作用。
【问题讨论】:
-
欢迎来到 Stack Overflow!寻求调试帮助的问题(“为什么这段代码不起作用?”)必须包括所需的行为、特定的问题或错误以及重现它所需的最短代码在问题本身。没有明确的问题陈述的问题对其他读者没有用处。请参阅:How to create a Minimal, Reproducible example。
标签: python discord discord.py