dolfies / discord.py-self

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

script working when used in linux but not when dockerized token not accepted #717

Closed spupuz closed 4 months ago

spupuz commented 4 months ago

Summary

script working when used in linux but not when dockerized token not accepted, but the token is working on linux laptop.

Reproduction Steps

i created the script and used it correctly from my linux pc then i containerized the app, but when the docker start and execute the script it give me an error 👍🏼

`root@omvba /z/D/song_poster# docker run --name song_poster song_poster
2024-07-28 21:45:02 WARNING  discord.ext.commands.bot Privileged message content intent is missing, commands may not work as expected.
2024-07-28 21:45:02 INFO     discord.client logging in using static token
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/discord/http.py", line 816, in static_login
    data = await self.request(Route('GET', '/users/@me'))
  File "/usr/local/lib/python3.9/site-packages/discord/http.py", line 758, 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 "/usr/src/app/./song_post.py", line 87, in <module>
    client.run(USER_TOKEN)
  File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 869, in run
    asyncio.run(runner())
  File "/usr/local/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 858, in runner
    await self.start(token, reconnect=reconnect)
  File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 786, in start
    await self.login(token)
  File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 620, in login
    data = await self.http.static_login(token)
  File "/usr/local/lib/python3.9/site-packages/discord/http.py", line 820, in static_login
    raise LoginFailure('Improper token has been passed.') from exc
discord.errors.LoginFailure: Improper token has been passed.`

Code

No response

Expected Results

working as in the linux machine also in the docker container

Actual Results

not working

System Information

debian with docker container

Checklist

Additional Information

No response

dolfies commented 4 months ago

As you can see from the first log line, you are using upstream discord.py, not this project. Likely you used the wrong package when dockerizing.