Skip to content

Instantly share code, notes, and snippets.

@MeguminSama
Last active December 19, 2024 14:45
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";
@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.

@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.

@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!

@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.

@vstudiocode
Copy link

very h

@NightSprite
Copy link

works as of may 2024

@CamperSamu
Copy link

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

This is still working, but if you're on linux and you're using wayland don't use this if you intend to stream since it breaks the new wayland screensharing tool.
I think it has something to do with it being some experiment that gets disabled by this snippet, but I couldn't get to the specific reason at 3AM.
I bisected the script and it happens after running the first actions.find, if someone that knows how discord works wants to help figure out a fix it would be great.

@MeguminSama
Copy link
Author

it could be worth grabbing the current experiments list and reinserting that into the CONNECTION_OPEN payload

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