vivinano / MudaeAutoBot

python bot that uses strictly the **Discord API** to Roll,Claim,and Kakera Snipe in Mudae. 5/10/21 project converted over to discum library
Apache License 2.0
149 stars 49 forks source link

KeyError: 'user' #137

Closed Aries298 closed 1 month ago

Aries298 commented 2 years ago

I'm trying to pinpoint the issue and thought I might ask about it here. The bot runs on Replit without any issues but it suddenly stopped working. After restarting it gives the following error: errrore

vivinano commented 2 years ago

Seems your discord token might have changed so check that

ChocoTonic commented 2 years ago

no I believe it's an issue with discum because I just got the error as well. let me know if it is still working on your end

vivinano commented 2 years ago

It could be an issue with discum.

It currently is working for me personally When I ran it when the issue first arose.

If it was installed thru pypi then it's an older version of discum

Which should be installed thru their GitHub repo

ChocoTonic commented 2 years ago

could I know what version of discum you're using?

what specifically is working for you? discum or mudaeautobot?

discum is personally still working for me on other scripts still but it's specifically this line user = bot.gateway.session.user and anything related to gateway.session that is giving that keyerror

this is the output that I'm getting

image

vivinano commented 2 years ago

I'm currently on discum 1.3.1

Epikest commented 2 years ago

i'm getting the same issue, have tried 1.3.1 from github releases, 1.4.0 from github releases, and latest from pypi

ChocoTonic commented 2 years ago

i'm getting the same issue, have tried 1.3.1 from github releases, 1.4.0 from github releases, and latest from pypi

is it failing on 1.3.1 also for you?

Epikest commented 2 years ago

i'm getting the same issue, have tried 1.3.1 from github releases, 1.4.0 from github releases, and latest from pypi

is it failing on 1.3.1 also for you?

yep

vivinano commented 2 years ago

okay viewing the discum repo there has been a captcha added that i think is messing with the key error. I've emailed the dev over there and am awaiting for a reply

Epikest commented 2 years ago

thanks

Epikest commented 2 years ago

if discum doesn't work, you can use discord.py-self, it's well maintained

ChocoTonic commented 2 years ago

moving there would have a lot of overhead, but yeah that's an option

vivinano commented 2 years ago

yeah I originally was on discord.py before the self bot portion of code was deprecated and I personally wouldn't like to overhaul the code again. Also in terms of development the same guy who works on discum works on discord.py-self so I'm sure he is figuring out a fix

vivinano commented 2 years ago

still awaiting a reply but haven't received anything on my end. anyone else figured out a solution while we wait ?

vivinano commented 2 years ago

https://github.com/Merubokkusu/Discord-S.C.U.M/issues/334

Epikest commented 2 years ago

anything yet?

vivinano commented 2 years ago

No the dev over there has been busy. But did report a few solutions over on his repo

Sent from my iPhone

On Mar 13, 2022, at 1:52 AM, Epik @.***> wrote:

 anything yet?

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

ChocoTonic commented 2 years ago

there isn't a way to just remove the broken section?

vivinano commented 2 years ago

The user is to verify that user has successfully logged in and that user has been set

Sent from my iPhone

On Mar 28, 2022, at 4:19 PM, ChocoTonic @.***> wrote:

 there isn't a way to just remove the broken section?

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

MujurID commented 2 years ago

i think in "#take care of channels" in /discum/gateway/start/parse.py , because if i disable i can get ready_data or ready_data["user"]

image

.

i logged out of some servers which have string """ or ''' in topic section i think. now bot can run (I left from ZeroTwo Bot server) because I found this in my discord response image image image

ChocoTonic commented 2 years ago

Can you be more specific about what you changed or did differently?

aspectlostx commented 2 years ago

Just now started receiving this last night, been using it for probably 2 weeks straight with no errors and changes were only made to wish characters. I changed the token as It renewed. Put it inside the quotation marks. no weird spacing or any error. I also went to discum and updated it as I saw changes made this month. Still no luck.

Edit - Still broken even switching from python 3.10.4 to 3.7 and uninstalling/reinstalling discum. Hope to get a fix soon :(

Idiot1183 commented 2 years ago

How was this fixed?

aspectlostx commented 2 years ago

How was this fixed?

Think they were just referencing you to this page instead of having two open. Not fixed yet

aspectlostx commented 2 years ago

After trying to fix it, i see it can work perfectly fine on alt accounts but not my main account. I have reset my token by changing my password, doing a lot of things. No luck.. Maybe discord has some sort of shadowbans?? I'm not sure why my main account no longer works with this bot. @MujurID maybe its something to do with servers?? do you think that for this bot?

Idiot1183 commented 2 years ago

After trying to fix it, i see it can work perfectly fine on alt accounts but not my main account. I have reset my token by changing my password, doing a lot of things. No luck.. Maybe discord has some sort of shadowbans?? I'm not sure why my main account no longer works with this bot. @MujurID maybe its something to do with servers?? do you think that for this bot?

But that can't be. The same user token works on another discum program that I made. bot.gateway.session.user is the problem.

aspectlostx commented 2 years ago

After trying to fix it, i see it can work perfectly fine on alt accounts but not my main account. I have reset my token by changing my password, doing a lot of things. No luck.. Maybe discord has some sort of shadowbans?? I'm not sure why my main account no longer works with this bot. @MujurID maybe its something to do with servers?? do you think that for this bot?

But that can't be. The same user token works on another discum program that I made. bot.gateway.session.user is the problem.

Very odd then. My discord token purely does not work anymore, changing it and making sure its 100% correct (like refreshing multiple times, changing passwords) Me then deciding to use it on an alt account that only has 3 servers with its token worked.. But yeah who knows. You're right too its not the bot perse. It's just discum.

aspectlostx commented 2 years ago

@vivinano - Confirmed I just fixed it by getting rid of mostly all my servers I don't need anymore. I do not know what server specifically made it work and I know this makes zero sense as the problem is based on the user and discum but @MujurID 's solution does work (for me). Might have to do with a certain string as they mention certain servers/channels may have characters that conflict? No clue.

Idiot1183 commented 2 years ago

@vivinano - Confirmed I just fixed it by getting rid of mostly all my servers I don't need anymore. I do not know what server specifically made it work and I know this makes zero sense as the problem is based on the user and discum but @MujurID 's solution does work (for me). Might have to do with a certain string as they mention certain servers/channels may have characters that conflict? No clue.

Holy, you're right. leaving does work. For anyone wondering what I left it was my universities hub or hub server or discord student hub or whatever you want to call it. So if you're in a hub maybe leave it and see if it works

ChocoTonic commented 2 years ago

did the servers you left contain >1000+ members? @Idiot1183 @aspectlostx

aspectlostx commented 2 years ago

did the servers you left contain >1000+ members? @Idiot1183 @aspectlostx

I left many servers less than and more than 1000 members definitely. Most of the servers I left were 1000+ however

Idiot1183 commented 2 years ago

did the servers you left contain >1000+ members? @Idiot1183 @aspectlostx

I have no idea why what was messing mine up was the student hub. But I’m still in a server with nearly 100k people so I genuinely have no idea

aspectlostx commented 2 years ago

did the servers you left contain >1000+ members? @Idiot1183 @aspectlostx

I know mine I left discord.js, community servers like games, bots like dank memer's and useless things I really didn't need anymore. It's not like I joined something new too. Genuinely some server probably made a channel or changed a name and it did something?? I dont know haha

Darneur commented 2 years ago

Same solution worked for me, I just left as many servers as possible (including my student hub). After making sure the bot could run without errors, I created a test server with ' and " in the channel descriptions, but the bot still worked fine, so I'm not sure where exactly the problem lies.

vivinano commented 2 years ago

https://discordhelp.net/discord-token

according to @HentaiRyuu new method to get token is needed

ChocoTonic commented 2 years ago

@vivinano how is this different than getting the token from library? are tokens treated differently based on where you get them?

HentaiRyuu commented 2 years ago

@ChocoTonic It is same, old token (in Local Storage) can be use same as usual. only new generate token will be obfuscate. thats why this method is needed

ChocoTonic commented 2 years ago

so what does this have to do with the mudaeautobot? if I already have a token, and I'm assuming that generating a new token will not fix this issue otherwise someone would have already reported that that's a reliable fix, then what is the point of the above post?

vivinano commented 2 years ago

so what does this have to do with the mudaeautobot? if I already have a token, and I'm assuming that generating a new token will not fix this issue otherwise someone would have already reported that that's a reliable fix, then what is the point of the above post?

according you Ryuu he was gettiing a 4004 error code from the gateway so which to discord is a authentication payload error

image

but still just spitballing and seeing where the possible error is

kleborgn commented 2 years ago

Leaving all the hubs I was in fixed the error for me

ChocoTonic commented 2 years ago

how can I identify which servers I'm in are hubs? @kleborgn

kleborgn commented 2 years ago

how can I identify which servers I'm in are hubs? @kleborgn

The icon is blue with a student hat. If you right-click on it, it says "Leave the hub" instead of "Leave the server".

image

ChocoTonic commented 2 years ago

I see. I don't have any hubs, but I am in large servers and it does not work for me

aspectlostx commented 2 years ago

I see. I don't have any hubs, but I am in large servers and it does not work for me

Check on a new alt account. I still am running the bot on two accounts with no issues since the fix I said worked. Just try leaving servers you do not need anymore. Hubs aren't the only cause

ScikuVRC commented 2 years ago

Exception ignored in thread started by: <bound method GatewayServer._response_loop of <discum.gateway.gateway.GatewayServer object at 0x000002B223FA3CD0>> 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 "C:\Users\USER\AppData\Local\Programs\Python\Python310\MudaeAutoBot-4\MudaeAutoBot.py", line 694, in on_message c_settings = parse_settings_message(msg) File "C:\Users\USER\AppData\Local\Programs\Python\Python310\MudaeAutoBot-4\MudaeAutoBot.py", line 223, in parse_settings_message settings['prefix'] = val_parse(settings_p[0])[0] IndexError: list index out of range

Tried all the fixes above, even tried the thing @MujurID suggested, nothing seems to make the bot function.

vivinano commented 2 years ago

`Exception ignored in thread started by: <bound method GatewayServer._response_loop of <discum.gateway.gateway.GatewayServer object at 0x000002B223FA3CD0>>

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 "C:\Users\USER\AppData\Local\Programs\Python\Python310\MudaeAutoBot-4\MudaeAutoBot.py", line 694, in on_message

c_settings = parse_settings_message(msg)

File "C:\Users\USER\AppData\Local\Programs\Python\Python310\MudaeAutoBot-4\MudaeAutoBot.py", line 223, in parse_settings_message

settings['prefix'] = val_parse(settings_p[0])[0]

IndexError: list index out of range`

Tried all the fixes above, even tried the thing @MujurID suggested, nothing seems to make the bot function.

That because this isn't a keyword user error and falls within the invalid settings error

BellaDona007 commented 2 years ago

I had solved this problem by leaving some servers, but now it's back and I have no idea what happened or who I should look for to get this error out =\

ScikuVRC commented 2 years ago

Normal Syntax doesn't work but, installing latest Discum + copying all Mudae $settings in the Channeldata folder has started the bot and made it use slash commands. So better than nothing.

strongtaste57 commented 2 years ago

I'm having the same error. In my case it's a specific server that for some reason triggers the error. I tried on an alt account and as expected, the bot runs fine until I join the server. Tried making a dummy server similar to it, to pinpoint exactly what causes it, but I couldn't find the culprit. Attempted to add an exception in /discum/gateway/start/parse.py for this specific server ID but I couldn't get it to work. I cannot leave this server, so any help would be appreciated.

vivinano commented 2 years ago

The developer for discum should be back not sure how long he was going on break but might have to contact him