Skip to content

Instantly share code, notes, and snippets.

@MeguminSama
Last active April 24, 2025 05:37
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";
@MeguminSama
Copy link
Author

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

@CamperSamu
Copy link

I tried digging inside the Discord Canary client to try and figure out a way to do it, but I couldn't figure it out.
I am not the most knowledgeable in JS RE or the inner workings of the Discord client in general, maybe someone else might figure it out.

I played around with Zere's Plugin Library since it hosts some helper functions to get experiments and stuff like that, but apparently the ExperimentStore gets created after the experiments get enabled on the client, so it might be something else that's causing the issue (maybe something related to changing user flags?)

@kotx
Copy link

kotx commented Mar 25, 2025

megu

@taskylizard
Copy link

megu

@puhbu
Copy link

puhbu commented Mar 27, 2025

megu

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