dolfies / discord.py-self

A fork of the popular discord.py for user accounts.
https://discordpy-self.rtfd.io/en/latest/
MIT License
665 stars 155 forks source link

Improper Token Even Tho Grabbed From Correct Location #466

Closed JustAChickenBoi closed 1 year ago

JustAChickenBoi commented 1 year ago

Summary

improper token

Reproduction Steps

I used the token grabbed from dev tools > network > message > authentication yet program returns with error

Code

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.

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")

Expected Results

the bot was supposed to connect to discord and respond to every message that is named /ping but instead it returns with Improper token

Actual Results

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.

System Information

Checklist

Additional Information

No response

dolfies commented 1 year ago

As per your system information, you are not using discord.py-self. You probably have both installed in the same environment.