Improper Token #465
Unanswered
JustAChickenBoi
asked this question in
Help
Replies: 1 comment
-
I have had the same issue before, make sure you grab the token from the "Bot" page in the discord development site and not the "Secret" token from the general information page. If you have done that then I would change your code to the following: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I used the token grabbed from dev tools > network > message > authentication
yet program returns with following error:
Traceback (most recent call last):
File "C:\Users\AppData\Roaming\Python\Python37\site-packages\discord\http.py", line 300, in static_login
data = await self.request(Route('GET', '/users/@me'))
File "C:\Users\AppData\Roaming\Python\Python37\site-packages\discord\http.py", line 254, in request
raise HTTPException(r, 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 "C:\Users\Desktop\Self User.py", line 113, in
bot.run("{im not giving u my token}")
File "C:\Users\AppData\Roaming\Python\Python37\site-packages\discord\client.py", line 723, in run
return future.result()
File "C:\Users\AppData\Roaming\Python\Python37\site-packages\discord\client.py", line 702, in runner
await self.start(*args, **kwargs)
File "C:\Users\AppData\Roaming\Python\Python37\site-packages\discord\client.py", line 665, in start
await self.login(*args, bot=bot)
File "C:\Users\AppData\Roaming\Python\Python37\site-packages\discord\client.py", line 511, in login
await self.http.static_login(token.strip(), bot=bot)
File "C:\Users\AppData\Roaming\Python\Python37\site-packages\discord\http.py", line 304, in static_login
raise LoginFailure('Improper token has been passed.') from exc
discord.errors.LoginFailure: Improper token has been passed.
any ideas?
heres the source code:
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix="/")
@bot.event
async def on_ready():
print("-"*20)
print("Logged In As")
print(f"User: {bot.user.name}")
print(f"ID: {bot.user.id}")
print("-"*20)
@bot.command()
async def ping(ctx):
await ctx.send("pong")
bot.run("MY TOKEN BUT HIDDEN")
any ideas of how to fix?
by the way, I have tried bot = commands.Bot(command_prefix="/", self_bot=True)
Beta Was this translation helpful? Give feedback.
All reactions