-
Star
(250)
You must be signed in to star a gist -
Fork
(23)
You must be signed in to fork a gist
-
-
Save MPThLee/3ccb554b9d882abc6313330e38e5dfaa to your computer and use it in GitHub Desktop.
/** | |
* !!!! This code doesn't work anymore !!!! | |
* | |
* - You can check working code on comments. I won't update this code anymore. | |
* | |
* Also, I just decided to remove this code. You can check revisions for old code. | |
* Since this code was made for discord client that almost 5 years ago, It seems like doesn't work anymore. | |
* I don't want people keep arguing in the comments, i decided to remove this code. | |
* | |
* Note: This code is now fulfilled with Javascript comments. This code won't work even if you pasted to console. doesn't do anything. | |
* Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#comments | |
**/ | |
// Older gist description: Enable Discord Developer Menus in any environment except mobile app without BetterDiscord using Console. |
Uncaught TypeError: Cannot read properties of undefined (reading 'exports') at :5:27 (anonymous) @ VM933:5
@securing-ab That code has been broken since December of last year. Use this instead.
ah... well, thanks for that... but that other code was definitely not broken since December... I was using it until last month just fine :)
This now causes an almost-immediate crash due to certain properties not being functions - do not use.
@PoolloverNathan That code has been broken since December of last year. Use this instead.
webpackChunkdiscord_app.push([[Math.random()], {}, (e) => { module = Object.values(e.c).find(x => x?.exports?.default?.getUsers).exports.default; }]); nodes = Object.values(module._dispatcher._actionHandlers._dependencyGraph.nodes); try { nodes.find(x => x.name == "ExperimentStore").actionHandler["OVERLAY_INITIALIZE"]({ user: { flags: 1 } }); } catch (e) { } original = [module.getCurrentUser, module.getNonImpersonatedCurrentUser]; module.getCurrentUser = module.getNonImpersonatedCurrentUser = () => ({ isStaff: () => true }); nodes.find(x => x.name == "DeveloperExperimentStore").actionHandler["OVERLAY_INITIALIZE"](); [module.getCurrentUser, module.getNonImpersonatedCurrentUser] = original;
until today, your code worked, now it gives such an error:
VM723:1 Uncaught TypeError: Cannot convert undefined or null to object
at Function.values (<anonymous>)
at <anonymous>:1:77
at e (sentry.e8a5639a79578cb5d3a5.js:1:7629)
at <anonymous>:1:25
I found a correction
webpackChunkdiscord_app.push([[Math.random()], {}, (e) => { if(e.c!=undefined){module = Object.values(e.c).find(x => x?.exports?.default?.getUsers).exports.default;} }]);
nodes = Object.values(module._dispatcher._actionHandlers._dependencyGraph.nodes);
try { nodes.find(x => x.name == "ExperimentStore").actionHandler["OVERLAY_INITIALIZE"]({ user: { flags: 1 } }); } catch (e) { }
original = [module.getCurrentUser, module.getNonImpersonatedCurrentUser];
module.getCurrentUser = module.getNonImpersonatedCurrentUser = () => ({ isStaff: () => true });
nodes.find(x => x.name == "DeveloperExperimentStore").actionHandler["OVERLAY_INITIALIZE"]();
[module.getCurrentUser, module.getNonImpersonatedCurrentUser] = original;
I found a correction
webpackChunkdiscord_app.push([[Math.random()], {}, (e) => { if(e.c!=undefined){module = Object.values(e.c).find(x => x?.exports?.default?.getUsers).exports.default;} }]); nodes = Object.values(module._dispatcher._actionHandlers._dependencyGraph.nodes); try { nodes.find(x => x.name == "ExperimentStore").actionHandler["OVERLAY_INITIALIZE"]({ user: { flags: 1 } }); } catch (e) { } original = [module.getCurrentUser, module.getNonImpersonatedCurrentUser]; module.getCurrentUser = module.getNonImpersonatedCurrentUser = () => ({ isStaff: () => true }); nodes.find(x => x.name == "DeveloperExperimentStore").actionHandler["OVERLAY_INITIALIZE"](); [module.getCurrentUser, module.getNonImpersonatedCurrentUser] = original;
This works as of Dec 6th, 2023.
I found a correction
webpackChunkdiscord_app.push([[Math.random()], {}, (e) => { if(e.c!=undefined){module = Object.values(e.c).find(x => x?.exports?.default?.getUsers).exports.default;} }]); nodes = Object.values(module._dispatcher._actionHandlers._dependencyGraph.nodes); try { nodes.find(x => x.name == "ExperimentStore").actionHandler["OVERLAY_INITIALIZE"]({ user: { flags: 1 } }); } catch (e) { } original = [module.getCurrentUser, module.getNonImpersonatedCurrentUser]; module.getCurrentUser = module.getNonImpersonatedCurrentUser = () => ({ isStaff: () => true }); nodes.find(x => x.name == "DeveloperExperimentStore").actionHandler["OVERLAY_INITIALIZE"](); [module.getCurrentUser, module.getNonImpersonatedCurrentUser] = original;
Still works, January 13th 24
I found a correction
webpackChunkdiscord_app.push([[Math.random()], {}, (e) => { if(e.c!=undefined){module = Object.values(e.c).find(x => x?.exports?.default?.getUsers).exports.default;} }]); nodes = Object.values(module._dispatcher._actionHandlers._dependencyGraph.nodes); try { nodes.find(x => x.name == "ExperimentStore").actionHandler["OVERLAY_INITIALIZE"]({ user: { flags: 1 } }); } catch (e) { } original = [module.getCurrentUser, module.getNonImpersonatedCurrentUser]; module.getCurrentUser = module.getNonImpersonatedCurrentUser = () => ({ isStaff: () => true }); nodes.find(x => x.name == "DeveloperExperimentStore").actionHandler["OVERLAY_INITIALIZE"](); [module.getCurrentUser, module.getNonImpersonatedCurrentUser] = original;
Still works, March 22nd, 2024
I found a correction
webpackChunkdiscord_app.push([[Math.random()], {}, (e) => { if(e.c!=undefined){module = Object.values(e.c).find(x => x?.exports?.default?.getUsers).exports.default;} }]); nodes = Object.values(module._dispatcher._actionHandlers._dependencyGraph.nodes); try { nodes.find(x => x.name == "ExperimentStore").actionHandler["OVERLAY_INITIALIZE"]({ user: { flags: 1 } }); } catch (e) { } original = [module.getCurrentUser, module.getNonImpersonatedCurrentUser]; module.getCurrentUser = module.getNonImpersonatedCurrentUser = () => ({ isStaff: () => true }); nodes.find(x => x.name == "DeveloperExperimentStore").actionHandler["OVERLAY_INITIALIZE"](); [module.getCurrentUser, module.getNonImpersonatedCurrentUser] = original;
Still works as of May 12th 24
I found a correction
webpackChunkdiscord_app.push([[Math.random()], {}, (e) => { if(e.c!=undefined){module = Object.values(e.c).find(x => x?.exports?.default?.getUsers).exports.default;} }]); nodes = Object.values(module._dispatcher._actionHandlers._dependencyGraph.nodes); try { nodes.find(x => x.name == "ExperimentStore").actionHandler["OVERLAY_INITIALIZE"]({ user: { flags: 1 } }); } catch (e) { } original = [module.getCurrentUser, module.getNonImpersonatedCurrentUser]; module.getCurrentUser = module.getNonImpersonatedCurrentUser = () => ({ isStaff: () => true }); nodes.find(x => x.name == "DeveloperExperimentStore").actionHandler["OVERLAY_INITIALIZE"](); [module.getCurrentUser, module.getNonImpersonatedCurrentUser] = original;
Working as of 5/20/2024
I found a correction
webpackChunkdiscord_app.push([[Math.random()], {}, (e) => { if(e.c!=undefined){module = Object.values(e.c).find(x => x?.exports?.default?.getUsers).exports.default;} }]); nodes = Object.values(module._dispatcher._actionHandlers._dependencyGraph.nodes); try { nodes.find(x => x.name == "ExperimentStore").actionHandler["OVERLAY_INITIALIZE"]({ user: { flags: 1 } }); } catch (e) { } original = [module.getCurrentUser, module.getNonImpersonatedCurrentUser]; module.getCurrentUser = module.getNonImpersonatedCurrentUser = () => ({ isStaff: () => true }); nodes.find(x => x.name == "DeveloperExperimentStore").actionHandler["OVERLAY_INITIALIZE"](); [module.getCurrentUser, module.getNonImpersonatedCurrentUser] = original;
Working without issue 5/29/2024
Needs to be executed everytime you refresh or update Discord
Can someone make this as a plugin for BetterDiscord?
I found a correction
webpackChunkdiscord_app.push([[Math.random()], {}, (e) => { if(e.c!=undefined){module = Object.values(e.c).find(x => x?.exports?.default?.getUsers).exports.default;} }]); nodes = Object.values(module._dispatcher._actionHandlers._dependencyGraph.nodes); try { nodes.find(x => x.name == "ExperimentStore").actionHandler["OVERLAY_INITIALIZE"]({ user: { flags: 1 } }); } catch (e) { } original = [module.getCurrentUser, module.getNonImpersonatedCurrentUser]; module.getCurrentUser = module.getNonImpersonatedCurrentUser = () => ({ isStaff: () => true }); nodes.find(x => x.name == "DeveloperExperimentStore").actionHandler["OVERLAY_INITIALIZE"](); [module.getCurrentUser, module.getNonImpersonatedCurrentUser] = original;Working
without issue5/29/2024 Needs to be executed everytime you refresh or update Discord
Same issue here. Does anyone know if there is a fix for this or a way to make this permanent?
(BetterDiscord steals tokens, so I'd avoid using it on non-throwaway accounts.)
do you have anything to back this up or are you just speaking out of your ass
(BetterDiscord steals tokens, so I'd avoid using it on non-throwaway accounts.)
do you have anything to back this up or are you just speaking out of your ass
I've been using BetterDiscord for a long time and I haven't lost any account/bot tokens. If you or somebody you know lost their account running a shady plugin then that's on you.
Seems to have died as of 4/21/2025 again...
- added
&& x.exports.default._dispatcher._actionHandlers
webpackChunkdiscord_app.push([[Math.random()], {}, (e) => { if(e.c!=undefined){module = Object.values(e.c).find(x => x?.exports?.default?.getUsers && x.exports.default._dispatcher._actionHandlers).exports.default;} }]);
nodes = Object.values(module._dispatcher._actionHandlers._dependencyGraph.nodes);
try { nodes.find(x => x.name == "ExperimentStore").actionHandler["OVERLAY_INITIALIZE"]({ user: { flags: 1 } }); } catch (e) { }
original = [module.getCurrentUser, module.getNonImpersonatedCurrentUser];
module.getCurrentUser = module.getNonImpersonatedCurrentUser = () => ({ isStaff: () => true });
nodes.find(x => x.name == "DeveloperExperimentStore").actionHandler["OVERLAY_INITIALIZE"]();
[module.getCurrentUser, module.getNonImpersonatedCurrentUser] = original;
This seems to be working as of 04/22/2025:
(async function() {
'use strict';
setTimeout(async () => {
let module;
webpackChunkdiscord_app.push([
[Math.random()], {}, (e) => {
if (e.c != undefined) {
module = Object.values(e.c).find(x => x?.exports?.default?.getUsers && x.exports.default._dispatcher._actionHandlers).exports.default;
}
}
]);
let nodes = Object.values(module._dispatcher._actionHandlers._dependencyGraph.nodes);
try {
nodes.find(x => x.name == "ExperimentStore").actionHandler["OVERLAY_INITIALIZE"]({
user: {
flags: 1
}
});
} catch (e) {}
let original = [module.getCurrentUser, module.getNonImpersonatedCurrentUser];
module.getCurrentUser = module.getNonImpersonatedCurrentUser = () => ({
isStaff: () => true
});
nodes.find(x => x.name == "DeveloperExperimentStore").actionHandler["OVERLAY_INITIALIZE"]();
[module.getCurrentUser, module.getNonImpersonatedCurrentUser] = original;
let _mods;
webpackChunkdiscord_app.push([
[Symbol()], {},
r => _mods = r.c
]);
webpackChunkdiscord_app.pop();
let findByProps = (...props) => {
for (let m of Object.values(_mods)) {
try {
if (!m.exports || m.exports === window) continue;
if (props.every((x) => m.exports?.[x])) return m.exports;
for (let ex in m.exports) {
if (props.every((x) => m.exports?.[ex]?.[x])) return m.exports[ex];
}
} catch {}
}
}
await findByProps('_dispatch').dispatch({
type: 'EXPERIMENT_OVERRIDE_BUCKET',
experimentId: '2021-09_favorites_server',
experimentBucket: 1
})
}, 2600);
})();
This, in the code, for example, enables the 2021-09_favorites_server
experiment:
await findByProps('_dispatch').dispatch({
type: 'EXPERIMENT_OVERRIDE_BUCKET',
experimentId: '2021-09_favorites_server',
experimentBucket: 1
})
i cant get the inspect menu to work on my discord client, only on the web version
i cant get the inspect menu to work on my discord client, only on the web version
when you open View > Developer Tools > Console, it won't let you paste initially. You may need to type allow pasting
first. Once you've done that, you can paste these in and enable Experiments as expected.
No longer works I believe :3
No longer works I believe :3
Works fine for me.
Doesn't work anymore as of today.
- changed
e.c!=undefined
toe.b!=undefined
webpackChunkdiscord_app.push([[Math.random()], {}, (e) => { if(e.b!=undefined){module = Object.values(e.c).find(x => x?.exports?.default?.getUsers && x.exports.default._dispatcher._actionHandlers).exports.default;} }]);
nodes = Object.values(module._dispatcher._actionHandlers._dependencyGraph.nodes);
try { nodes.find(x => x.name == "ExperimentStore").actionHandler["OVERLAY_INITIALIZE"]({ user: { flags: 1 } }); } catch (e) { }
original = [module.getCurrentUser, module.getNonImpersonatedCurrentUser];
module.getCurrentUser = module.getNonImpersonatedCurrentUser = () => ({ isStaff: () => true });
nodes.find(x => x.name == "DeveloperExperimentStore").actionHandler["OVERLAY_INITIALIZE"]();
[module.getCurrentUser, module.getNonImpersonatedCurrentUser] = original;
Doesn't work anymore as of today.
Can confirm, just broke for me as well. Tried feeding the code and the error to Claude, but after many different tries, got basically nowhere. Was worth a shot, but it looks like someone more familiar with Discord internals will need to fix this one.
- changed
e.c!=undefined
toe.b!=undefined
webpackChunkdiscord_app.push([[Math.random()], {}, (e) => { if(e.b!=undefined){module = Object.values(e.c).find(x => x?.exports?.default?.getUsers && x.exports.default._dispatcher._actionHandlers).exports.default;} }]); nodes = Object.values(module._dispatcher._actionHandlers._dependencyGraph.nodes); try { nodes.find(x => x.name == "ExperimentStore").actionHandler["OVERLAY_INITIALIZE"]({ user: { flags: 1 } }); } catch (e) { } original = [module.getCurrentUser, module.getNonImpersonatedCurrentUser]; module.getCurrentUser = module.getNonImpersonatedCurrentUser = () => ({ isStaff: () => true }); nodes.find(x => x.name == "DeveloperExperimentStore").actionHandler["OVERLAY_INITIALIZE"](); [module.getCurrentUser, module.getNonImpersonatedCurrentUser] = original;
Oh fire, thanks!
Attempting to run this code today on my BD build, seems to stall without any error at first but does not seem to enable the Experiments tab. it does, however, spit this out:
No clue what's going on! help would be appreciated.
@Orchidthederg
The output is normal. I'm not sure why it wouldn't work on a BD client. Try opening the User Settings AFTER executing the code block and see if anything changes?
Oh, huh, it works fine now! Apologies!
- changed
e.c!=undefined
toe.b!=undefined
webpackChunkdiscord_app.push([[Math.random()], {}, (e) => { if(e.b!=undefined){module = Object.values(e.c).find(x => x?.exports?.default?.getUsers && x.exports.default._dispatcher._actionHandlers).exports.default;} }]); nodes = Object.values(module._dispatcher._actionHandlers._dependencyGraph.nodes); try { nodes.find(x => x.name == "ExperimentStore").actionHandler["OVERLAY_INITIALIZE"]({ user: { flags: 1 } }); } catch (e) { } original = [module.getCurrentUser, module.getNonImpersonatedCurrentUser]; module.getCurrentUser = module.getNonImpersonatedCurrentUser = () => ({ isStaff: () => true }); nodes.find(x => x.name == "DeveloperExperimentStore").actionHandler["OVERLAY_INITIALIZE"](); [module.getCurrentUser, module.getNonImpersonatedCurrentUser] = original;
This worked! Thanks!
@securing-ab
That code has been broken since December of last year.
Use this instead.