aarondoet / AccountSwitcher

BetterDiscord plugin to switch between multiple accounts
MIT License
229 stars 79 forks source link

[Issue] AccountSwitcher could not be constructed #79

Open blobbyblo opened 2 years ago

blobbyblo commented 2 years ago

This issue was first pointed out in #78.

Steps to reproduce the behavior:

  1. Ctrl+R inside of Discord with the AccountSwitcher plugin loaded
  2. See error
  3. (Also your bug reporter is reporting some crashes to the console as well)

Additional Information: The root of this issue is that Discord is moving towards lazy loading (see doc from mozilla).

The module you are depending on in line 118, KeyRecorder, does not get loaded until after you are in the main interface of Discord.

I suggest moving towards adding a keydown event listener as seen being used in other BD plugins I've seen. I would've opened a PR today but due to my handicap of never touching JavaScript before in my entire life, that didn't happen lmfao

parhammed commented 2 years ago

Capture I receive this error too. also, I enabled token encryption.

danieleremin commented 2 years ago

I don't have token encryption and I still have the same bug. This is a problem with the discord update.

xDeFc0nx commented 2 years ago

I don't have token encryption and I still have the same bug. This is a problem with the discord update.

Hi, this is a bug with account switcher itself, everyone has the same error, lets hope it gets fixed, ill take look and try to fix it,

parhammed commented 2 years ago

I don't have token encryption and I still have the same bug. This is a problem with the discord update.

Hi, this is a bug with account switcher itself, everyone has the same error, lets hope it gets fixed, ill take look and try to fix it,

tnx

blobbyblo commented 2 years ago

I have made my own plugin to allow account switching using keydown and keyup event handlers. Maybe this code will be useful for this plugin and someone else can port over the changes.

xDeFc0nx commented 2 years ago

I have made my own plugin to allow account switching using keydown and keyup event handlers. Maybe this code will be useful for this plugin and someone else can port over the changes.

Hello, thank you very much.

ShootingKing-AM commented 2 years ago

I also have the same issue with the latest version of plugin.

Having the same issue, i got these logs if they would be useful to the dev. I think there is something wrong with the Libraries this plugin is using, WebpackModules esp.

AccountSwitcher.plugin.js:119 Uncaught TypeError: Class extends value undefined is not a constructor or null
    at plugin (AccountSwitcher.plugin.js:119)
    at AccountSwitcher.plugin.js:579
    at AccountSwitcher.plugin.js:580
    at AccountSwitcher.plugin.js:581
    at AccountSwitcher.plugin.js:586
    at Object.getFileModification (<anonymous>:4:307707)
    at Object..js (<anonymous>:4:267851)
    at Function.o._load (<anonymous>:4:370475)
    at Object.loadAddon (<anonymous>:4:268008)
    at Object.loadAddon (<anonymous>:4:305956)
    at Object.loadAllAddons (<anonymous>:4:270683)
    at Object.initialize (<anonymous>:4:265130)
    at Object.initialize (<anonymous>:4:305166)
    at Object.startup (<anonymous>:4:367245)

LineNo 119 corresponds to, const KeyRecorder def,

                    }
                );
            }

            const KeyRecorder = class KeyRecorder extends WebpackModules.getByDisplayName("KeyRecorder") {
                render() {
                    const ButtonOptions = WebpackModules.getByProps("ButtonLink");
                    const Button = ButtonOptions.default;
                    const ret = super.render();
                    ret.props.children.props.children.props.children.push(
                        React.createElement(
                            DiscordModules.FlexChild,
ezeholz commented 2 years ago

~This is not a full fix, and should not be treated like one. But I fix this error for those who had the plugin already configured. I heavily doubt this could be a final version, mostly because I believe it's gonna crash the minute you open the settings menu of the plugin. Feel free to use it until I try to fix this error. :D https://github.com/ezeholz/AccountSwitcher/tree/hotfix-78~

It's not worth it anymore, just wait until discord provides it

blobbyblo commented 2 years ago

Your fix fixes nothing.

Meff1u commented 2 years ago

This is not a full fix, and should not be treated like one. But I fix this error for those who had the plugin already configured. I heavily doubt this could be a final version, mostly because I believe it's gonna crash the minute you open the settings menu of the plugin. Feel free to use it until I try to fix this error. :D https://github.com/ezeholz/AccountSwitcher/tree/hotfix-78

Discord crashes when trying to switch account image

daNutzzzzz commented 2 years ago

This is not a full fix, and should not be treated like one. But I fix this error for those who had the plugin already configured. I heavily doubt this could be a final version, mostly because I believe it's gonna crash the minute you open the settings menu of the plugin. Feel free to use it until I try to fix this error. :D https://github.com/ezeholz/AccountSwitcher/tree/hotfix-78

This worked for me, thanks

NakyoykaN commented 2 years ago

None of the above solutions seem to work whether it is the current Localhost version or the Omen one.

It appears to me that anyone installing this for the first time is going to encounter the same issue that I did that a fresh install disables the setup button and there appears to be no easy/simple way to set up accounts to continue using this plugin.

This is on top of the current issue continuing to pop up. Moving the plugin out of and back into the plugin folder does not resolve the inability to set up new accounts.

Any chance this can be fixed or a proper/official solution can be updated on the read me to confirm what users should do doing going forward? This might save other users the frustrations that I had.

ThowZzy commented 2 years ago

This is not a full fix, and should not be treated like one. But I fix this error for those who had the plugin already configured. I heavily doubt this could be a final version, mostly because I believe it's gonna crash the minute you open the settings menu of the plugin. Feel free to use it until I try to fix this error. :D https://github.com/ezeholz/AccountSwitcher/tree/hotfix-78

This worked for me, thanks

It totally works mate, just need to comment out lines 118 --> 170 ty

ThowZzy commented 2 years ago

The current fix is to config the plugin as you want, and once you configured it just comment the lines mentionned and you good

NakyoykaN commented 2 years ago

The setup button is grayed out for me so I am unable to get a box to add/remove accounts or adjust the keybindings. This is after reloading the plugin with or without the 118=>170 lines commented out.

I would use the built in account switcher if it wasn't for the fact that it limits you to five accounts. Perhaps if this is implemented as is then this mod can use that same menu but allow more accounts to be added after the first 5.

ThowZzy commented 2 years ago

{ "didShowIssueHelperPopup": true, "currentVersionInfo": { "version": "1.3.5", "hasShownChangelog": true }, "settings": { "accounts": [ { "name": "TAG#1111", "id": "123431231", "avatar": "https://cdn.discordapp.com/avatars/111111/11111111.webp?size=128", "keybind": [ 160, 37 ], "token": "token" }, { "name": "TAG#1111", "id": "1111", "avatar": "https://cdn.discordapp.com/avatars/1111/1111.webp?size=128", "keybind": [ 160, 39 ], "token": "token" } ], "encrypted": false, "encTest": "test", "pluginsToRestart": [ "AccountDetailsPlus", "AutoStartRichPresence" ], "encryptionVersion": 2, "salt": "PHStMmwqFoZm5ToErFseA8T7BI/Cb/AozuiOUZD5Wzc=" } }

ThowZzy commented 2 years ago

You can try to do your config by hand with this template I sent

NakyoykaN commented 2 years ago

Tried this and now I get the same issue as earlier reported where the Discord account switcher interferes.