Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gateway] close status code: 4004 #166

Open
HentaiRyuu opened this issue May 15, 2022 · 9 comments
Open

[gateway] close status code: 4004 #166

HentaiRyuu opened this issue May 15, 2022 · 9 comments

Comments

@HentaiRyuu
Copy link

have you ever encounter this problem?

It was running fine, until it start to throw some error then stop completely after a few hour
so i restart it, it just run silently (no msg or anything) then i try to print bot.gateway.session.user, it throw me KeyError: 'user'. so i try leave many server as it mention in #137 but its not working

so i look up other way with bot = discum.Client(token=token,log={"console":True, "file":False})
then i saw this

[gateway] Connected to websocket.
[gateway] > {'op': 2, 'd': {'token': '', 'capabilities': 253, 'properties': {'os': 'Windows', 'browser': 'Chrome', 'device': '', 'system_locale': 'en-US', 'browser_user_agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36', 'browser_version': '96.0.4664', 'os_version': '10', 'referrer': '', 'referring_domain': '', 'referrer_current': '', 'referring_domain_current': '', 'release_channel': 'stable', 'client_build_number': 107767, 'client_event_source': None}, 'presence': {'status': 'online', 'since': 0, 'activities': [], 'afk': False}, 'compress': False, 'client_state': {'guild_hashes': {}, 'highest_last_message_id': '0', 'read_state_version': 0, 'user_guild_settings_version': -1, 'user_settings_version': -1}}}
[gateway] > {'op': 4, 'd': {'guild_id': None, 'channel_id': None, 'self_mute': True, 'self_deaf': False, 'self_video': False}}
[gateway] < {'t': None, 's': None, 'op': 10, 'd': {'heartbeat_interval': 41250, '_trace': ['["gateway-prd-main-05kr",{"micros":0.0}]']}}
[gateway] entering heartbeat
[gateway] close status code: 4004
[gateway] close message: Authentication failed.
[gateway] websocket closed
[gateway] Connection Dropped. Retrying in 10 seconds.
[gateway] Connected to websocket.

i try to regenerate token (change password), it still give me close status code: 4004
i try with different token (alt acc), all other are working fine.

next thing i try is google randomly, then i saw someone said
Your token is may be expiring due to too many identifies with our gateway. You are limited to 1000 identifies per day.
and i think, this maybe true problem of mine as i run this bot 3 instance with same token (since different server has different settings)
ps. i run this bot 24/7 but it the problem just happen

so i wait, 2 days passed since problem happen, i still have no idea

@vivinano
Copy link
Owner

have you regenerated your token ?

@HentaiRyuu
Copy link
Author

yes, i tried many times. it still same.

@vivinano
Copy link
Owner

vivinano commented May 16, 2022 via email

@HentaiRyuu
Copy link
Author

HentaiRyuu commented May 16, 2022

Edit: Removed token.
my bad, you are right, its wrong token.
i have to get it from other place not token in Local Storage
but from authorization in api request header
as this site mention https://discordhelp.net/discord-token

it seem discord obfuscate token in Local Storage

@HentaiRyuu
Copy link
Author

Oh, another problem.
I just update discum and i got this error, old one seem dont have this problem

Exception ignored in thread started by: <bound method GatewayServer._response_loop of <discum.gateway.gateway.GatewayServer object at 0x0000016747D69340>>
Traceback (most recent call last):
  File "C:\Users\User\AppData\Roaming\Python\Python310\site-packages\discum\gateway\gateway.py", line 299, in _response_loop
    func(resp)
  File "D:\MudaeAuto\Bot.py", line 779, in on_message
    slashfus = threading.Timer(10.0,waifu_roll,args=[slashchannel,slashget,slashguild])
UnboundLocalError: local variable 'slashget' referenced before assignment

@HentaiRyuu HentaiRyuu reopened this May 16, 2022
@vivinano
Copy link
Owner

did discum dev come back from hiatus ? i had to change slash functions due to the slash function was broken

@vivinano
Copy link
Owner

also could you provide a write up of how to obtain this new token ?

@HentaiRyuu
Copy link
Author

about how to obtain new token

  1. open devtool CTRL + SHIFT + I
    1.1 if you can't open this please go to %appdata%\discord\settings.json and add "DANGEROUS_ENABLE_DEVTOOLS_ONLY_ENABLE_IF_YOU_KNOW_WHAT_YOURE_DOING": true to setting.json
  2. navigate to the Network tab and press CTRL + R to reload
  3. in the Filter search box, type /api
  4. click on any, but i choose payment-sources
  5. look at Headers tab scroll down until you found authorization
  6. right click on it and Copy Value

or you could watch at this guy if my explain seem to confuse
https://www.youtube.com/watch?v=tI1lzqzLQCs

@HentaiRyuu HentaiRyuu mentioned this issue Jun 7, 2022
@CriticalMomento
Copy link

this is another method i know
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants