`Traceback (most recent call last):
File "D:\software\anaconda3\envs\midjourney-api\lib\site-packages\discord\http.py", line 803, in static_login
data = await self.request(Route('GET', '/users/@me'))
File "D:\software\anaconda3\envs\midjourney-api\lib\site-packages\discord\http.py", line 745, in request
raise HTTPException(response, data)
discord.errors.HTTPException: 401 Unauthorized (error code: 0): 401: Unauthorized
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\wwwroot\midjourney-api\task_bot.py", line 13, in
bot.run(BOT_TOKEN)
File "D:\software\anaconda3\envs\midjourney-api\lib\site-packages\discord\client.py", line 860, in run
asyncio.run(runner())
File "D:\software\anaconda3\envs\midjourney-api\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "D:\software\anaconda3\envs\midjourney-api\lib\asyncio\base_events.py", line 649, in run_until_complete
return future.result()
File "D:\software\anaconda3\envs\midjourney-api\lib\site-packages\discord\client.py", line 849, in runner
await self.start(token, reconnect=reconnect)
File "D:\software\anaconda3\envs\midjourney-api\lib\site-packages\discord\client.py", line 777, in start
await self.login(token)
File "D:\software\anaconda3\envs\midjourney-api\lib\site-packages\discord\client.py", line 612, in login
data = await self.http.static_login(token)
File "D:\software\anaconda3\envs\midjourney-api\lib\site-packages\discord\http.py", line 807, in static_login
raise LoginFailure('Improper token has been passed.') from exc
discord.errors.LoginFailure: Improper token has been passed.
`
问题简述
我确定我使用的USER_TOKEN是正确的,因为我使用curl去请求 https://discord.com/api/v9/users/@me这个路径是正常返回了信息,但是当我执行
python task_bot.py
时就会产生这个报错:`Traceback (most recent call last): File "D:\software\anaconda3\envs\midjourney-api\lib\site-packages\discord\http.py", line 803, in static_login data = await self.request(Route('GET', '/users/@me')) File "D:\software\anaconda3\envs\midjourney-api\lib\site-packages\discord\http.py", line 745, in request raise HTTPException(response, data) discord.errors.HTTPException: 401 Unauthorized (error code: 0): 401: Unauthorized
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "D:\wwwroot\midjourney-api\task_bot.py", line 13, in
bot.run(BOT_TOKEN)
File "D:\software\anaconda3\envs\midjourney-api\lib\site-packages\discord\client.py", line 860, in run
asyncio.run(runner())
File "D:\software\anaconda3\envs\midjourney-api\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "D:\software\anaconda3\envs\midjourney-api\lib\asyncio\base_events.py", line 649, in run_until_complete
return future.result()
File "D:\software\anaconda3\envs\midjourney-api\lib\site-packages\discord\client.py", line 849, in runner
await self.start(token, reconnect=reconnect)
File "D:\software\anaconda3\envs\midjourney-api\lib\site-packages\discord\client.py", line 777, in start
await self.login(token)
File "D:\software\anaconda3\envs\midjourney-api\lib\site-packages\discord\client.py", line 612, in login
data = await self.http.static_login(token)
File "D:\software\anaconda3\envs\midjourney-api\lib\site-packages\discord\http.py", line 807, in static_login
raise LoginFailure('Improper token has been passed.') from exc
discord.errors.LoginFailure: Improper token has been passed.
`
复现方式
python task_bot.py
环境信息
Python 3.10.13
)额外信息
No response
一点点的自我检查