【发布时间】:2017-08-10 02:34:37
【问题描述】:
我的代码使用此命令偶尔会收到 400 bad request 错误:
@owner_only
async def cmd_bootybomb(self, user_mentions, channel):
userid = (str(user_mentions))
await self.send_message(discord.Object(id = userid), bootybomb)
变量bootybomb 已从另一个文件导入,该文件只是一组设置为一个变量的链接。
我得到的错误是:
Traceback (most recent call last):
File "C:\Users\pc\Desktop\Gamefolders\BootyBot\BootyBot\musicbot\bot.py", line 1289, in on_message
response = await handler(**handler_kwargs)
File "C:\Users\pc\Desktop\Gamefolders\BootyBot\BootyBot\musicbot\bot.py", line 115, in wrapper
return await func(self, *args, **kwargs)
File "C:\Users\pc\Desktop\Gamefolders\BootyBot\BootyBot\musicbot\bot.py", line 877, in cmd_bootybomb
await self.send_message(discord.Object(id = userid), bootybomb)
File "C:\Users\pc\AppData\Local\Programs\Python\Python35\lib\site-packages\discord\client.py", line 831, in send_message
data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts)
File "C:\Users\pc\AppData\Local\Programs\Python\Python35\lib\site-packages\discord\http.py", line 137, in request
raise HTTPException(r, data)
discord.errors.HTTPException: BAD REQUEST (status code: 400)
为什么会发生这种情况以及如何解决?
【问题讨论】:
标签: python discord discord.py