ediziks / BingGPT-Discord-Bot

BingGPT Discord Bot that can handle /ask & /imagine prompts using reverse engineered API of Microsoft's Bing Chat under the hood
The Unlicense
120 stars 14 forks source link

How to fix this error, discord.errors.HTTPException: 401 Unauthorized (error code: 0): 401: Unauthorized ? #18

Closed umer007khan closed 6 months ago

umer007khan commented 1 year ago

While deploying bot i am facing error during bot launching as mentioned below, pls guide me how to resolve it.

[2023-07-05 14:11:37] [INFO ] discord.client: logging in using static token Traceback (most recent call last): File "/home/mint/.local/lib/python3.10/site-packages/discord/http.py", line 803, in static_login data = await self.request(Route('GET', '/users/@me')) File "/home/mint/.local/lib/python3.10/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 "/home/mint/BingGPT-Discord-Bot/src/bot.py", line 175, in client.run(TOKEN) File "/home/mint/.local/lib/python3.10/site-packages/discord/client.py", line 860, in run asyncio.run(runner()) File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete return future.result() File "/home/mint/.local/lib/python3.10/site-packages/discord/client.py", line 849, in runner await self.start(token, reconnect=reconnect) File "/home/mint/.local/lib/python3.10/site-packages/discord/client.py", line 777, in start await self.login(token) File "/home/mint/.local/lib/python3.10/site-packages/discord/client.py", line 612, in login data = await self.http.static_login(token) File "/home/mint/.local/lib/python3.10/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.

ediziks commented 1 year ago

Most probably related to having invalid token as it says in the error logs.

umer007khan commented 1 year ago

still facing same issue after regenerating bot token many times from different discord id

ediziks commented 1 year ago

Did permissions set correctly for the token generated?

umer007khan commented 1 year ago

yeah i enabled bot and application.commands permission

umer007khan commented 1 year ago

but it didn't work, please help me when you get spare time.

ediziks commented 6 months ago

33