Discord-Console-hacks icon indicating copy to clipboard operation
Discord-Console-hacks copied to clipboard

Experiments thing no longer works.

Open watameln opened this issue 1 year ago • 5 comments

What currently works is let wpRequire; window.webpackChunkdiscord_app.push([[ Math.random() ], {}, (req) => { wpRequire = req; }]); mod = Object.values(wpRequire.c).find(x => typeof x?.exports?.default?.isDeveloper !== "undefined") usermod = Object.values(wpRequire.c).find(x => x?.exports?.default?.getUsers) nodes = Object.values(mod.exports.default._dispatcher._dependencyGraph.nodes) try { nodes.find(x => x.name == "ExperimentStore").actionHandler["CONNECTION_OPEN"]({user: {flags: 1}, type: "CONNECTION_OPEN"}) } 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

watameln avatar Aug 02 '22 22:08 watameln

Doesn't work properly. Feel free to make a PR if you fixed the script

hxr404 avatar Aug 03 '22 20:08 hxr404

Didn't really fix it but you can see all experiments with it.

watameln avatar Aug 04 '22 09:08 watameln

~~This script looks similar to the one above, but it seems to work. Experiments seem to toggle properly and such.~~ See this comment for the fix

const c = window.webpackChunkdiscord_app.push([[ Symbol() ], {}, ({ c }) => Object.values(c)]);
userMod = c.find(x => x?.exports?.default?.getUsers).exports.default.__proto__;
nodes = Object.values((c.find(x => typeof x?.exports?.default?.isDeveloper !== "undefined")).exports.default._dispatcher._dependencyGraph.nodes);
nodes.find(x => x.name === "ExperimentStore").actionHandler["CONNECTION_OPEN"]({ user: { flags: 1 }, type: "CONNECTION_OPEN", experiments: [] });
oldGCUser = userMod.getCurrentUser;
userMod.getCurrentUser = () => { return { hasFlag: () => true }};
nodes.find(x => x.name === "DeveloperExperimentStore").actionHandler["CONNECTION_OPEN"]();
userMod.getCurrentUser = oldGCUser;
// Thanks to 257109471589957632

spinfal avatar Aug 04 '22 16:08 spinfal

This script looks similar to the one above, but it seems to work. Experiments seem to toggle properly and such.

const c = window.webpackChunkdiscord_app.push([[ Symbol() ], {}, ({ c }) => Object.values(c)]);
userMod = c.find(x => x?.exports?.default?.getUsers).exports.default.__proto__;
nodes = Object.values((c.find(x => typeof x?.exports?.default?.isDeveloper !== "undefined")).exports.default._dispatcher._dependencyGraph.nodes);
nodes.find(x => x.name === "ExperimentStore").actionHandler["CONNECTION_OPEN"]({ user: { flags: 1 }, type: "CONNECTION_OPEN", experiments: [] });
oldGCUser = userMod.getCurrentUser;
userMod.getCurrentUser = () => { return { hasFlag: () => true }};
nodes.find(x => x.name === "DeveloperExperimentStore").actionHandler["CONNECTION_OPEN"]();
userMod.getCurrentUser = oldGCUser;
// Thanks to 257109471589957632

Well this doesn't work Uncaught TypeError: Cannot read property 'nodes' of undefined at <anonymous>:1:139

BlackusPL avatar Aug 11 '22 14:08 BlackusPL

This script looks similar to the one above, but it seems to work. Experiments seem to toggle properly and such.

const c = window.webpackChunkdiscord_app.push([[ Symbol() ], {}, ({ c }) => Object.values(c)]);
userMod = c.find(x => x?.exports?.default?.getUsers).exports.default.__proto__;
nodes = Object.values((c.find(x => typeof x?.exports?.default?.isDeveloper !== "undefined")).exports.default._dispatcher._dependencyGraph.nodes);
nodes.find(x => x.name === "ExperimentStore").actionHandler["CONNECTION_OPEN"]({ user: { flags: 1 }, type: "CONNECTION_OPEN", experiments: [] });
oldGCUser = userMod.getCurrentUser;
userMod.getCurrentUser = () => { return { hasFlag: () => true }};
nodes.find(x => x.name === "DeveloperExperimentStore").actionHandler["CONNECTION_OPEN"]();
userMod.getCurrentUser = oldGCUser;
// Thanks to 257109471589957632

Well this doesn't work Uncaught TypeError: Cannot read property 'nodes' of undefined at <anonymous>:1:139

Yeah, Discord patched it (all they did was nest it a little deeper smh). Here is the updated script:

(() => {
let wpRequire;
window.webpackChunkdiscord_app.push([[ Math.random() ], {}, (req) => { wpRequire = req; }]);
mod = Object.values(wpRequire.c).find(x => typeof x?.exports?.default?.isDeveloper !== "undefined")
usermod = Object.values(wpRequire.c).find(x => x?.exports?.default?.getUsers)
nodes = Object.values(mod.exports.default._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
})()

spinfal avatar Aug 11 '22 18:08 spinfal

This is fixed with #57 (thanks to @spinfal), seems like GitHub didn't sync the PR properly with this issue.

hxr404 avatar Sep 05 '22 17:09 hxr404

Again broken

BlackusPL avatar Sep 27 '22 14:09 BlackusPL