MudaeAutoBot icon indicating copy to clipboard operation
MudaeAutoBot copied to clipboard

[gateway] close status code: 4004

Open HentaiRyuu opened this issue 3 years ago • 9 comments

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

HentaiRyuu avatar May 15 '22 16:05 HentaiRyuu

have you regenerated your token ?

vivinano avatar May 15 '22 18:05 vivinano

yes, i tried many times. it still same.

HentaiRyuu avatar May 15 '22 22:05 HentaiRyuu

All I see is wrong token set

Sent from my iPhone

On May 15, 2022, at 6:19 PM, HentaiRyuu @.***> wrote:

 yes, i tried many times. it still same.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

vivinano avatar May 16 '22 00:05 vivinano

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 avatar May 16 '22 02:05 HentaiRyuu

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 avatar May 16 '22 02:05 HentaiRyuu

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

vivinano avatar May 16 '22 03:05 vivinano

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

vivinano avatar May 16 '22 03:05 vivinano

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 avatar May 16 '22 03:05 HentaiRyuu

this is another method i know image

CriticalMomento avatar Aug 20 '22 01:08 CriticalMomento