Skip to content

Instantly share code, notes, and snippets.

@mesalytic
Created October 1, 2022 21:40
Show Gist options
  • Save mesalytic/0360305dd4395c437ac8e04d6cf32266 to your computer and use it in GitHub Desktop.
Save mesalytic/0360305dd4395c437ac8e04d6cf32266 to your computer and use it in GitHub Desktop.
Discord Experiments Snippet
let wpRequire;
window.webpackChunkdiscord_app.push([[Math.random()], {}, (req) => { wpRequire = req; }]);
let mod;
const values = Object.values(wpRequire.c)
for (const x in values) {
const v = values[x]
if (v?.exports?.Z?._dispatcher?._actionHandlers?._dependencyGraph?.nodes) {
mod = v
console.log(v)
}
}
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) {}
oldUser = usermod.exports.default.__proto__.getCurrentUser;
usermod.exports.default.__proto__.getCurrentUser = () => ({ hasFlag: () => true, isStaff: () => true })
nodes.find((x) => x.name === 'DeveloperExperimentStore').actionHandler.CONNECTION_OPEN()
usermod.exports.default.__proto__.getCurrentUser = () => {
const u = oldUser();
const out = { ...u, isStaff: () => true };
out.__proto__ = u.__proto__;
return out;
}
@mesalytic
Copy link
Author

still working btw

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