Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Discord Experiments.js
var cache = Object.values(webpackChunkdiscord_app.push([["wp_isdev_patch"], {}, r => r.c]));
webpackChunkdiscord_app.pop();
var DevStore = cache.find(m => m?.exports?.default?.isDeveloper !== void 0).exports.default;
var UserStore = cache.find(m => m?.exports?.default?.getUsers).exports.default;
var nodes = Object.values(DevStore._dispatcher._actionHandlers._dependencyGraph.nodes);
try {
nodes.find(n => n.name == "ExperimentStore").actionHandler["OVERLAY_INITIALIZE"]({
user: { flags: 1 }, type: "CONNECTION_OPEN"
});
} catch { }
var oldGetUser = UserStore.getCurrentUser;
UserStore.getCurrentUser = () => ({ hasFlag: () => true });
nodes.find(n => n.name == "DeveloperExperimentStore").actionHandler["OVERLAY_INITIALIZE"]();
UserStore.getCurrentUser = oldGetUser;
@ichigo86150
Copy link

ichigo86150 commented Sep 27, 2022

They changed it again I guess
image

@Suni29
Copy link

Suni29 commented Sep 27, 2022

They changed it again I guess image

Yeah, they care a lot more now about these. If anyone got something new, please let me know. Thanks.

@Suni29
Copy link

Suni29 commented Sep 27, 2022

They changed it again I guess image

Yeah, they care a lot more now about these. If anyone got something new, please let me know. Thanks.

Okay turns out Discord just started changing words randomly in their webpack code, anyways this should work.

let wpRequire;
window.webpackChunkdiscord_app.push([[ Math.random() ], {}, (req) => { wpRequire = req; }]);
mod = Object.values(wpRequire.c).find(x => typeof x?.exports?.Z?.isDeveloper !== "undefined");
usermod = Object.values(wpRequire.c).find(x => x?.exports?.default?.getUsers)
nodes = Object.values(mod.exports.Z._dispatcher._actionHandlers._dependencyGraph.nodes)
try {
    nodes.find(x => x.name == "ExperimentStore").actionHandler["OVERLAY_INITIALIZE"]({user: {flags: 1}})
} catch (e) {}
oldGetUser = usermod.exports.default.__proto__.getCurrentUser;
usermod.exports.default.__proto__.getCurrentUser = () => ({hasFlag: () => true})
nodes.find(x => x.name == "DeveloperExperimentStore").actionHandler["CONNECTION_OPEN"]()
usermod.exports.default.__proto__.getCurrentUser = oldGetUser

@Fishvap
Copy link

Fishvap commented Sep 27, 2022

They changed it again I guess image

Yeah, they care a lot more now about these. If anyone got something new, please let me know. Thanks.

Okay turns out Discord just started changing words randomly in their webpack code, anyways this should work.

let wpRequire;
window.webpackChunkdiscord_app.push([[ Math.random() ], {}, (req) => { wpRequire = req; }]);
mod = Object.values(wpRequire.c).find(x => typeof x?.exports?.Z?.isDeveloper !== "undefined");
usermod = Object.values(wpRequire.c).find(x => x?.exports?.default?.getUsers)
nodes = Object.values(mod.exports.Z._dispatcher._actionHandlers._dependencyGraph.nodes)
try {
    nodes.find(x => x.name == "ExperimentStore").actionHandler["OVERLAY_INITIALIZE"]({user: {flags: 1}})
} catch (e) {}
oldGetUser = usermod.exports.default.__proto__.getCurrentUser;
usermod.exports.default.__proto__.getCurrentUser = () => ({hasFlag: () => true})
nodes.find(x => x.name == "DeveloperExperimentStore").actionHandler["CONNECTION_OPEN"]()
usermod.exports.default.__proto__.getCurrentUser = oldGetUser

I can't use this, it appears that it doesn't let you view the Experiments tab?

@Suni29
Copy link

Suni29 commented Sep 27, 2022

They changed it again I guess image

Yeah, they care a lot more now about these. If anyone got something new, please let me know. Thanks.

Okay turns out Discord just started changing words randomly in their webpack code, anyways this should work.

let wpRequire;
window.webpackChunkdiscord_app.push([[ Math.random() ], {}, (req) => { wpRequire = req; }]);
mod = Object.values(wpRequire.c).find(x => typeof x?.exports?.Z?.isDeveloper !== "undefined");
usermod = Object.values(wpRequire.c).find(x => x?.exports?.default?.getUsers)
nodes = Object.values(mod.exports.Z._dispatcher._actionHandlers._dependencyGraph.nodes)
try {
    nodes.find(x => x.name == "ExperimentStore").actionHandler["OVERLAY_INITIALIZE"]({user: {flags: 1}})
} catch (e) {}
oldGetUser = usermod.exports.default.__proto__.getCurrentUser;
usermod.exports.default.__proto__.getCurrentUser = () => ({hasFlag: () => true})
nodes.find(x => x.name == "DeveloperExperimentStore").actionHandler["CONNECTION_OPEN"]()
usermod.exports.default.__proto__.getCurrentUser = oldGetUser

I can't use this, it appears that it doesn't let you view the Experiments tab?

It works fine for me, after you executed it click on another tab like "My Account" or just reopen the settings menu to update it.
Or idk where are you using it but it works fine on Stable 149345 (f0be125).

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