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

examples/bridge_mod.js errors on Discord LTS #98

Open
ReLoia opened this issue Jun 23, 2024 · 3 comments
Open

examples/bridge_mod.js errors on Discord LTS #98

ReLoia opened this issue Jun 23, 2024 · 3 comments

Comments

@ReLoia
Copy link

ReLoia commented Jun 23, 2024

Some infos about the client

  • tested on the webclient
  • tested on Firefox 127.0.1
  • the rich presence settings are enabled

The Dispatcher in examples/bridge_mod.js doesn't seem to be working anymore.

I tried the debugging the the code and it seems to receive data from the backend but it doesn't show the RP.
image

Every time the script receives a message from the wsocket, it logs and error saying that Dispatcher is undefined.

I tried running the part of the script that searches the Dispatcher and I've discovered that there is no element with .wait and .register
In 2181 elements there isn't one with any of the properties.
image

@norinorin
Copy link

norinorin commented Jul 2, 2024

Probably not the best fix, but try replacing these lines with the following code in the meantime:

for (const id in modules) {
    const mod = modules[id].exports;

    for (const prop in mod) {
        const candidate = mod[prop];
        try {
            if (candidate && candidate.register && candidate.wait) {
                Dispatcher = candidate;
                break;
            }
        } catch {
            continue;
        }
    }

    if (Dispatcher) break;
}

Key changes:

  • removed 2 if conditions
  • added try and catch otherwise it wouldn't work on desktop

@Zai-Kun
Copy link

Zai-Kun commented Jul 4, 2024

same issue here

@peldas
Copy link

peldas commented Aug 17, 2024

@norinorin your changes worked for me in Firefox, thank you!

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

4 participants