Skip to content

Instantly share code, notes, and snippets.

@MPThLee
Last active October 5, 2024 00:48
Show Gist options
  • Save MPThLee/3ccb554b9d882abc6313330e38e5dfaa to your computer and use it in GitHub Desktop.
Save MPThLee/3ccb554b9d882abc6313330e38e5dfaa to your computer and use it in GitHub Desktop.
This code doesn't work anymore. I just decided to remove this code. You can check working code on comments.
/**
* !!!! 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.
@acendvgnt
Copy link

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;

@Eon48
Copy link

Eon48 commented Jun 8, 2023

I enabled a setting using ctrl-alt-o and now discord keeps crashing almost immediately when I open it on my pc, I've tried uninstalling it and nothing as well, any advice?
Edit: the setting in question was DevTools
Edit 2: Nevermind I figured it out, my dumbass didn't even think to clear the cache

@hapklaar
Copy link

hapklaar commented Sep 6, 2023

I was able to open experimental and tried the HDR stream fix, but it doesn't seem to do anything for me. Should this still be functional?

@securing-ab
Copy link

```js
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__.getNonImpersonatedCurrentUser;
usermod.exports.default.__proto__.getNonImpersonatedCurrentUser= () => ({isStaff: () => true})
nodes.find(x => x.name == "DeveloperExperimentStore").actionHandler["CONNECTION_OPEN"]()
usermod.exports.default.__proto__.getNonImpersonatedCurrentUser= oldGetUser

Uncaught TypeError: Cannot read properties of undefined (reading 'exports')
at :5:27
(anonymous) @ VM933:5

@acendvgnt
Copy link

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.

@Brazuca87
Copy link

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 :)

@plowside
Copy link

plowside commented Dec 1, 2023

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

@Mizari-Dev
Copy link

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;

@hexagonstudios0
Copy link

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.

@Windows200000
Copy link

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

@ProdPreva1l
Copy link

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

@HeadTwerk
Copy link

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

@Lobby34
Copy link

Lobby34 commented May 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 as of 5/20/2024

@JuLY-LION
Copy link

JuLY-LION commented May 29, 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

@smugller
Copy link

Can someone make this as a plugin for BetterDiscord?

@Sneaky1000
Copy link

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

Same issue here. Does anyone know if there is a fix for this or a way to make this permanent?

@PoolloverNathan
Copy link

PoolloverNathan commented Jun 15, 2024 via email

@LordFoogThe4rd
Copy link

(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

@JuLY-LION
Copy link

(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.

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