iyu46 / RemovedConnectionAlerts

Keep track of your friends and servers on BetterDiscord, and get notified if you get unfriended or kicked from a server.
11 stars 6 forks source link

Error pops up when i launch discord / start plugin manually #27

Open DanTVD opened 21 hours ago

DanTVD commented 21 hours ago

so i had this msg appear today after i opened discord.. the history file is completely intact tho and not corrupted and even when i delete / remove the file named under my uid it still says it is corrupted...

anyone has any idea if it is a bug that needs to be fixed soon by the dev or something of sorts? or is there a solution?

image

PatrickSantoZZ commented 20 hours ago

same problem here. newest discord version. even deleting the files / removing all backups and letting it generate a new history doesnt fix the problem. seems like the plugin itself got a problem and not the history/backup files.

did some simple debugging and the error is somewhere in L414-L426 Screenshot_1

when loading the userdata it grabs currentuserID => generates the filestr but then doesnt load the data and returns nothing.

CompletelyUnbelievable commented 20 hours ago

As far as I can tell the problem is that ZerePluginLibrary's GuildStore.getGuilds no longer exists for some reason, causing something I would consider to be a bug that it is informing the user that the history is somehow corrupt when it's just unable to access the user's guild info. It is very likely that your history file is fine. image image

iyu46 commented 19 hours ago

omg i'm sorry!! i'll look into this right away i was sleeping hlksdfds

CompletelyUnbelievable commented 19 hours ago

omg i'm sorry!! i'll look into this right away i was sleeping hlksdfds

I wouldn't worry too much about it since it seems to be a ZLib issue. It would be a good idea to do something so that you know for sure the history is corrupt before telling the user that it is. Parsing the error message might be a good idea, or you could try/catch either or both of the getGuildsList or the function for loading the config, to present a proper error message.

CompletelyUnbelievable commented 19 hours ago

Before: https://github.com/iyu46/RemovedConnectionAlerts/blob/8e08ad10f31dbcec8339672fe8a55361cba51c55/RemovedConnectionAlerts.plugin.js#L161-L163 The temporary fix I'm using for now and afaik it's working properly:

const {
        React, Dispatcher, RelationshipStore, UserStore,
    } = DiscordModules;
    var { GuildStore } = DiscordModules;
    if(!GuildStore.getGuilds)GuildStore=BdApi.findModuleByProps('getGuilds', 'getGuild');
PatrickSantoZZ commented 19 hours ago

Before:

https://github.com/iyu46/RemovedConnectionAlerts/blob/8e08ad10f31dbcec8339672fe8a55361cba51c55/RemovedConnectionAlerts.plugin.js#L161-L163

The temporary fix I'm using for now and afaik it's working properly:

const {
        React, Dispatcher, RelationshipStore, UserStore,
    } = DiscordModules;
  var { GuildStore } = DiscordModules;
  if(!GuildStore.getGuilds)GuildStore=BdApi.findModuleByProps('getGuilds', 'getGuild');

ah okay thats exactly what caused the issue on my lines aswell. data was undefined. with loading getGuild instead of getGuilds the data here is getting shown again. so both issues were connected to each other.

iyu46 commented 18 hours ago

okay, sent in a fix! i'll update the thread again when it's approved and available for everyone to download, but you should get a ping on the built in updater anyway!

problem was basically discord's internals are obfuscated and we as developers have to go rooting through the jungle to find the stuff we need, but the way i was getting stuff was through ZeresPluginLibrary, and a recent discord change caused the searches that the library does to miss a couple of the things that i use, so i just updated the way i get things

edit: i forgot to do the thing where i note which issue i solve in the commit message, so for future reference this was solved in this commit https://github.com/iyu46/RemovedConnectionAlerts/commit/786550cf94d0afc60cf96a32aa2f8a7154c37629

Thiago3246 commented 17 hours ago

bro for me automatic update for this plugin dont worked now with this last fix

iyu46 commented 16 hours ago

bro for me automatic update for this plugin dont worked now with this last fix

@Thiago3246 that's because it's not available in the automatic update system yet, be patient :D

iyu46 commented 10 hours ago

it should be available for auto-update now!!

Sharkcruiser commented 9 hours ago

Hey, just wanted to say that I am still getting the popup. It did not auto update for me so I removed it, except the history files and downloaded it again from the betterdiscord page, its working again but the popup about corrupted files still shows up everytime I restart discord

iyu46 commented 9 hours ago

Hey, just wanted to say that I am still getting the popup. It did not auto update for me so I removed it, except the history files and downloaded it again from the betterdiscord page, its working again but the popup about corrupted files still shows up everytime I restart discord

@Sharkcruiser can you tell me, if you open your current history file (RemovedConnectionAlerts_(number).config.json) in notepad, if you see any text or if its just empty?

Sharkcruiser commented 9 hours ago

Hey, just wanted to say that I am still getting the popup. It did not auto update for me so I removed it, except the history files and downloaded it again from the betterdiscord page, its working again but the popup about corrupted files still shows up everytime I restart discord

@Sharkcruiser can you tell me, if you open your current history file (RemovedConnectionAlerts_(number).config.json) in notepad, if you see any text or if its just empty?

There is text in it, its not empty The Plugin also shows normally at the top right and I can open it and see my history Its just the popup message that still shows up on every start

iyu46 commented 9 hours ago

Hey, just wanted to say that I am still getting the popup. It did not auto update for me so I removed it, except the history files and downloaded it again from the betterdiscord page, its working again but the popup about corrupted files still shows up everytime I restart discord

@Sharkcruiser can you tell me, if you open your current history file (RemovedConnectionAlerts_(number).config.json) in notepad, if you see any text or if its just empty?

There is text in it, its not empty The Plugin also shows normally at the top right and I can open it and see my history Its just the popup message that still shows up on every start

i see... if you check the plugin's version inside discord settings, is it 0.8.5? can you tell me if there's an error in the console after you open the plugin?

and would you be willing to share your history file with me? if you are, you can add me on discord at selia. and send it to me privately that way

Sharkcruiser commented 9 hours ago

Hey, just wanted to say that I am still getting the popup. It did not auto update for me so I removed it, except the history files and downloaded it again from the betterdiscord page, its working again but the popup about corrupted files still shows up everytime I restart discord

@Sharkcruiser can you tell me, if you open your current history file (RemovedConnectionAlerts_(number).config.json) in notepad, if you see any text or if its just empty?

There is text in it, its not empty The Plugin also shows normally at the top right and I can open it and see my history Its just the popup message that still shows up on every start

i see... if you check the plugin's version inside discord settings, is it 0.8.5? can you tell me if there's an error in the console after you open the plugin?

and would you be willing to share your history file with me? if you are, you can add me on discord at selia. and send it to me privately that way

It actually shows me 0.8.3 as Version Not sure why, as I deleted the old ones and downloaded the new one which said updated today

I can share the file with you no problem, but not sure what selia is :D

iyu46 commented 9 hours ago

It actually shows me 0.8.3 as Version

well that must be why! you downloaded the old still-broken version. I imagine it's not updated yet on the site's side. you could wait a bit until "check for updates" works on your discord client, or you could manually replace the plugin with the updated version by downloading this github repository as an archive (https://github.com/iyu46/RemovedConnectionAlerts/archive/refs/heads/main.zip), picking out the plugin.js file, and replacing the one in your plugins folder with it (you can delete the archive after)

Sharkcruiser commented 8 hours ago

It actually shows me 0.8.3 as Version

well that must be why! you downloaded the old still-broken version. I imagine it's not updated yet on the site's side. you could wait a bit until "check for updates" works on your discord client, or you could manually replace the plugin with the updated version by downloading this github repository as an archive (https://github.com/iyu46/RemovedConnectionAlerts/archive/refs/heads/main.zip), picking out the plugin.js file, and replacing the one in your plugins folder with it (you can delete the archive after)

Did that, now it works! Thank you very much

Not sure why it still downloaded the old version then via betterdiscords site, it showed update from 9/20 on the side

Nonetheless, thanks for your time and quick assistance!