Skip to content

Instantly share code, notes, and snippets.

@MeguminSama
Last active May 24, 2024 15:09
Show Gist options
  • Save MeguminSama/2cae24c9e4c335c661fa94e72235d4c4 to your computer and use it in GitHub Desktop.
Save MeguminSama/2cae24c9e4c335c661fa94e72235d4c4 to your computer and use it in GitHub Desktop.
Discord Experiments.js
let cache; webpackChunkdiscord_app.push([["wp_isdev_patch"], {}, r => cache=r.c]);
var UserStore = Object.values(cache).find(m => m?.exports?.default?.getUser).exports.default;
var actions = Object.values(UserStore._dispatcher._actionHandlers._dependencyGraph.nodes);
var user = UserStore.getCurrentUser();
actions.find(n => n.name === "ExperimentStore").actionHandler.CONNECTION_OPEN({
type: "CONNECTION_OPEN", user: {flags: user.flags |= 1}, experiments: [],
});
actions.find(n => n.name === "DeveloperExperimentStore").actionHandler.CONNECTION_OPEN();
webpackChunkdiscord_app.pop(); user.flags &= ~1; "done";
@ImaginAqua
Copy link

"I'm not your support agent."

You might be my spirit animal though.

@79856734
Copy link

I'll start deleting dumb comments from now on. Let me make a small FAQ.

Q: "I enabled an experiment but cant use it!!!!" A: Discord locks many experiments on the API. Enabling it on the client does not bypass this.

Q: "omg ur gonna steal my details" A: Read the code. It literally just changes a zero to a one (false -> true).

Q: "How to I disable this?" A: Press CTRL+R to refresh the client, or fully close it from the taskbar and restart it.

Q: "It didn't work!!!" A: Good for you. I'm not your support agent.

10/10 FAQ

@FlailoftheLord
Copy link

Working as of latest discord update 0.25-1 (Feb 13. 2023)

@Slingexe
Copy link

Slingexe commented Mar 5, 2023

Thanks
Works for me

@Grayson-code
Copy link

still works!

@chickenmanfy
Copy link

working april 15th 2023

@EtherealTheDev
Copy link

EtherealTheDev commented Apr 29, 2023

Working April 28th, 2023, Tested on PTB, Canary, & regular Discord.

@johnyhongkong
Copy link

May 3, working on Canary.

@Reycko
Copy link

Reycko commented Jul 3, 2023

read if cute

hi vendicated

@fr3fou
Copy link

fr3fou commented Jul 11, 2023

h

@Draggie306
Copy link

Working on all builds, thank you!

@Pengu1n-2001
Copy link

Hi, cheers, this worked for me (September 22 2023).
Also feel free to delete this comment if not wanted, but I was just wondering if there was a way to enable the experiment to be turned on permanently, so that I do not have to do it on launch everytime.

@EtherealTheDev
Copy link

EtherealTheDev commented Sep 22, 2023 via email

@Zyrenth
Copy link

Zyrenth commented Sep 22, 2023

Hi, cheers, this worked for me (September 22 2023). Also feel free to delete this comment if not wanted, but I was just wondering if there was a way to enable the experiment to be turned on permanently, so that I do not have to do it on launch everytime.

Hi there,

I hope you have a good day! You can achieve that using client mods. The best option is probably Vencord, it has great performance unlike some other client mods, it's easy to install and it works in browsers as well! After you installed it you can go ahead and open up Settings > Vencord (category name) > Plugins and search for Experiments and enable it. Restart your Discord client and there it is you have it permanently enabled. You can disable it at any time if you want. And as with many other client mods sometimes the Discord update removes the client mod, but the only thing you have to do is use the Vencord installer to reinstall Vencord and you're good to go. (You don't have to re-enable the plugin because Vencord keeps the config files elsewhere.) Also feel free to check other plugins or joining the Vencord Discord server.

@ibaraki-douji
Copy link

Thx @Zyrenth it's working on the normal / canary / web version for sure :)
i don't have the PTB and developers builds to test on.

@Zyrenth
Copy link

Zyrenth commented Oct 26, 2023

Thx @Zyrenth it's working on the normal / canary / web version for sure :) i don't have the PTB and developers builds to test on.

it works everywhere

@Zyrenth
Copy link

Zyrenth commented Nov 21, 2023

How? ctrl+SHIFT+I doesn't open console. so what do you do with this code?

@chrisssj2 you can use the web version, or follow this guide to enable devtools on the stable release or you could download and use any other release other than stable because discord has disabled devtools for stable a long time ago

Here you can download the PTB (64-bit) or canary (64-bit) release for Windows. Hope this helps!

@chrisssj2
Copy link

THanks this works!! been looking for this for months now again!

@MeguminSama
Copy link
Author

Gist has been updated. My bad for taking so long. It was a tiny change.

@NullClock
Copy link

NullClock commented Dec 3, 2023

@Zyrenth

Thanks

@RaspberryKitty1
Copy link

RaspberryKitty1 commented Dec 3, 2023

@Zyrenth

works thanks

@Zyrenth
Copy link

Zyrenth commented Feb 29, 2024

Another patch because we love discord:
(as of writing this the update is only pushed to canary and ptb)

let cache; webpackChunkdiscord_app.push([["wp_isdev_patch"], {}, r => cache=r.c]);
var UserStore = Object.values(cache).find(m => m?.exports?.default?.getUser).exports.default;
var actions = Object.values(UserStore._dispatcher._actionHandlers._dependencyGraph.nodes);
var user = UserStore.getCurrentUser();
actions.find(n => n.name === "ExperimentStore").actionHandler.CONNECTION_OPEN({
	type: "CONNECTION_OPEN", user: {flags: user.flags |= 1}, experiments: [],
});
actions.find(n => n.name === "DeveloperExperimentStore").actionHandler.CONNECTION_OPEN();
webpackChunkdiscord_app.pop(); user.flags &= ~1; "done";

@MeguminSama
Copy link
Author

@Zyrenth thanks for the patch. Gist has been updated.

@ReDarkTechnology
Copy link

Does anyone know how to fix the "Warning: Server did not send any experiment config. You may need to check the Send to Client box in the admin UI"?

@MeguminSama
Copy link
Author

Does anyone know how to fix the "Warning: Server did not send any experiment config. You may need to check the Send to Client box in the admin UI"?

@ReDarkTechnology This isn't an error. It means Discord isn't giving you the rollout. You can always enable it with the experiments menu. This does not guarantee that the experiment will work if there are server-side checks.

@KasaiKonoru
Copy link

Where can I find the "experiments menu"?

@ccoffield93
Copy link

No longer working on ptb 275854 (e77c9b3) Host 1.0.1061 x86 (45077) Windows 11 64-bit (10.0.22631)

VM684:2 Uncaught TypeError: Cannot convert undefined or null to object
    at Function.values (<anonymous>)
    at <anonymous>:2:24

@Zyrenth
Copy link

Zyrenth commented Mar 16, 2024

@Zyrenth thanks for the patch. Gist has been updated.

@MeguminSama np, anytime

No longer working on ptb 275854 (e77c9b3) Host 1.0.1061 x86 (45077) Windows 11 64-bit (10.0.22631)

VM684:2 Uncaught TypeError: Cannot convert undefined or null to object
    at Function.values (<anonymous>)
    at <anonymous>:2:24

@ccoffield93 are you sure you're using the latest snippet? It still works on 275959 (af8afd2)

@ccoffield93
Copy link

Weird-- I was a couple of PTB builds behind and that was the issue. I force-quit PTB and it updated to 275959, and the snippet worked fine.

Thanks a bunch @Zyrenth . This is the only thing keeping me able to stream content to a friend while leaving HDR on.

@vstudiocode
Copy link

very h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment