Skip to content

Instantly share code, notes, and snippets.

@JohannesMP
Forked from ExordiumX/betaenabler.js
Last active June 9, 2024 01:51
Show Gist options
  • Save JohannesMP/afdf27383608c3b6f20a6a072d0be93c to your computer and use it in GitHub Desktop.
Save JohannesMP/afdf27383608c3b6f20a6a072d0be93c to your computer and use it in GitHub Desktop.
Enabling Discord Dev Experiments on Discord for Windows (2022-02)

Enable Dev Experiments in Discord for Windows

image

This guide shows how to enable dev mode for the Discord desktop application running on Windows (as of February 2022).

This can be used to view beta experiments to try features currently in development that are included but hidden by default in Discord release builds.


Enable the Discord Dev Console

Under the hood the Discord application is just trimmed down web browser, with much of the UI logic being written in javascript. Like Google Chrome, it includes a Developer console for running javascript code.

image

This dev console can be used to modify settings in Discord that are normally hidden. This includes beta/testing settings and experiments that are included in public builds but hidden by default.

If your Discord opens its dev console when you press Ctrl+Shift+i you can skip to the next section below.


As of 2022/01/28 this console is disabled unless you enable it manually in Discord's settings file:

  1. Use WIN+R to open the Windows 'Run' dialog and paste in the appropriate path to open the corresponding settings directory of your discord installation:

    • Discord: %APPDATA%\Discord\
    • Discord PTB (Public Test Build): %APPDATA%\DiscordPTB\
    • Discord Canary: %APPDATA%\discordcanary\
  2. In this directory, open the settings.json file

image

  1. Add the following entry to the settings.json file:
"DANGEROUS_ENABLE_DEVTOOLS_ONLY_ENABLE_IF_YOU_KNOW_WHAT_YOURE_DOING": true

So for example, if your settings.json looks like this:

{
  "BACKGROUND_COLOR": "#202225",
  "IS_MAXIMIZED": false,
  "IS_MINIMIZED": false,
  "WINDOW_BOUNDS": {
    "x": 288,
    "y": 51,
    "width": 1591,
    "height": 919
  },
  "OPEN_ON_STARTUP": false
}

You should modify it to look like this:

{
  "BACKGROUND_COLOR": "#202225",
  "IS_MAXIMIZED": false,
  "IS_MINIMIZED": false,
  "WINDOW_BOUNDS": {
    "x": 288,
    "y": 51,
    "width": 1591,
    "height": 919
  },
  "OPEN_ON_STARTUP": false,
  "DANGEROUS_ENABLE_DEVTOOLS_ONLY_ENABLE_IF_YOU_KNOW_WHAT_YOURE_DOING": true
}

NOTE: A comma is necessary after the "OPEN_ON_STARTUP": true/false line! MAKE SURE YOU ADD IT!!


  1. Save your settings.json file and completely shut down Discord

    • Ensure you don't just close the window, but also that Discord is no longer visible in your taskbar notification bar.
    • When in doubt, just force quit it using the task manager :P
  2. Restart Discord

  3. In Discord, open the Dev console using Ctrl+Shift+i


Using Discord Dev console to show dev options

WARNING: the Discord dev console can be used to access the internal settings of Discord, including your login credentials.

That is why the dev console explicitly outputs the following warnings: image

Treat any code you are asked to run in the dev console with strict scrutiny.


Since these instructions are having you do exactly that, you should first assure yourself that the code is actually safe to use.

Here is formatted version of the code you will be asked to run (note that line breaks and indenting does not change the code):

Object.defineProperty(
    (webpackChunkdiscord_app.push([
        [""],
        {},
        (e) => {
            m = [];
            for (let c in e.c) m.push(e.c[c]);
        },
    ]),
    m).find((m) => m?.exports?.default?.isDeveloper !== void 0).exports.default,
    "isDeveloper",
    { get: () => true }
);

This code ensures that all isDeveloper properties in Discord's intrnal objects are forced to return true. It does not communicate with any external server, or touch your credentials.

With that out of the way, here is the same code but with extra newlines and spaces removed:

Object.defineProperty((webpackChunkdiscord_app.push([[''],{},e=>{m=[];for(let c in e.c)m.push(e.c[c])}]),m).find(m=>m?.exports?.default?.isDeveloper!==void 0).exports.default,"isDeveloper",{get:()=>true});

Once you have assured yourself that this line is identical to the one shown above, copy the single line code completely and then paste it into the discord dev console and hit return:

image


You'll know that this worked if you when you open your Discord settings you see the following: image

NOTE: If your Discord settings were open when you ran the command close and open them again.


Enabling Discord Experiments

You can now view Discord experiments by selecting 'Experiments' at the bottom of the left sidebar in the Settings UI.

You can then search for specific settings, such as enabling the multi-account experiment:

image

@cryoelite
Copy link

let _, a = Object.values,
    b = "getCurrentUser",
    c = "actionHandler",
    d = "_actionHandlers",
    l = "_dispatcher",
    i = "ExperimentStore";
webpackChunkdiscord_app.push([
    [Date.now()], {},
    e => {
        _ = e
    }
]), m = a((u = a(_.c).find(e => e?.exports?.default?.[b] && e?.exports?.default?.[l]?.[d]).exports.default)[l][d]._dependencyGraph.nodes), u[b]().flags |= 1, m.find(e => "Developer" + i == e.name)[c].CONNECTION_OPEN();
try {
    m.find(e => i == e.name)[c].OVERLAY_INITIALIZE({
        user: {
            flags: 1
        }
    })
} catch {}
m.find(e => i == e.name).storeDidChange()

Still worked for me

@Sin-Shadow-Fox
Copy link

If you only want to use amoled mode, you can just enter the following:

document.body.classList.add("theme-amoled");

I think this is more "safe" than experiments. It's easier to do, as you don't have to go into the settings. To remove it, you just enter remove instead of add.

@elixss do you know anyways to enable discord badges locally?

webpackChunkdiscord_app.push([[Math.random()],{},(req)=>{for(const m of Object.keys(req.c).map((x)=>req.c[x].exports).filter((x)=>x)){if(m.default&&m.default.getCurrentUser!==undefined){return m.default.getCurrentUser().flags=99999999999}}}]);

use to work but now it does not :(

Idk exactly for what you need this for, but here you go. i just took all badges, and summed their flag values. i also made the code look pretty, since i hate garbage formatted code. you can easily add new badges to the object, when you know their flag values. hope this helps. i also made it an iife, so you don't get errors when re-using this without reloading

(() => {
    let flags = {
        "DISCORD_EMPLOYEE": 1 << 0,
        "DISCORD_PARTNER": 1 << 1,
        "HYPESQUAD_EVENTS": 1 << 2,
        "BUG_HUNTER_LEVEL_1": 1 << 3,
        "HOUSE_BRAVERY": 1 << 6,
        "HOUSE_BRILLIANCE": 1 << 7,
        "HOUSE_BALANCE": 1 << 8,
        "EARLY_SUPPORTER": 1 << 9,
        "BUG_HUNTER_LEVEL_2": 1 << 14,
        "VERIFIED_BOT_DEVELOPER": 1 << 17,
        "CERTIFIED_MODERATOR": 1 << 18
    };
    
    webpackChunkdiscord_app.push([[Math.random()], {}, req => {
        for (const m of Object.keys(req.c).map(x => req.c[x].exports).filter(x => x)) {
            if (m.default && m.default.getCurrentUser !== undefined) {
                return m.default.getCurrentUser().flags = Object.values(flags).reduce((pre, cur) => pre + cur, 0);
            }
        }
    }]);
})();

image

Is there a way to get just one badge? And if so is it permanent like the others?

@Aholicknight
Copy link

If you only want to use amoled mode, you can just enter the following:

document.body.classList.add("theme-amoled");

I think this is more "safe" than experiments. It's easier to do, as you don't have to go into the settings. To remove it, you just enter remove instead of add.

@elixss do you know anyways to enable discord badges locally?

webpackChunkdiscord_app.push([[Math.random()],{},(req)=>{for(const m of Object.keys(req.c).map((x)=>req.c[x].exports).filter((x)=>x)){if(m.default&&m.default.getCurrentUser!==undefined){return m.default.getCurrentUser().flags=99999999999}}}]);

use to work but now it does not :(

Idk exactly for what you need this for, but here you go. i just took all badges, and summed their flag values. i also made the code look pretty, since i hate garbage formatted code. you can easily add new badges to the object, when you know their flag values. hope this helps. i also made it an iife, so you don't get errors when re-using this without reloading

(() => {
    let flags = {
        "DISCORD_EMPLOYEE": 1 << 0,
        "DISCORD_PARTNER": 1 << 1,
        "HYPESQUAD_EVENTS": 1 << 2,
        "BUG_HUNTER_LEVEL_1": 1 << 3,
        "HOUSE_BRAVERY": 1 << 6,
        "HOUSE_BRILLIANCE": 1 << 7,
        "HOUSE_BALANCE": 1 << 8,
        "EARLY_SUPPORTER": 1 << 9,
        "BUG_HUNTER_LEVEL_2": 1 << 14,
        "VERIFIED_BOT_DEVELOPER": 1 << 17,
        "CERTIFIED_MODERATOR": 1 << 18
    };
    
    webpackChunkdiscord_app.push([[Math.random()], {}, req => {
        for (const m of Object.keys(req.c).map(x => req.c[x].exports).filter(x => x)) {
            if (m.default && m.default.getCurrentUser !== undefined) {
                return m.default.getCurrentUser().flags = Object.values(flags).reduce((pre, cur) => pre + cur, 0);
            }
        }
    }]);
})();

image

Is there a way to get just one badge? And if so is it permanent like the others?

@Sin-Shadow-Fox What do you mean "permanent"? The badges will be clientside, no one will be able to see the badges on your profile except you. As long as you have the plugin enabled, they will be there.

@Sin-Shadow-Fox
Copy link

If you only want to use amoled mode, you can just enter the following:

document.body.classList.add("theme-amoled");

I think this is more "safe" than experiments. It's easier to do, as you don't have to go into the settings. To remove it, you just enter remove instead of add.

@elixss do you know anyways to enable discord badges locally?

webpackChunkdiscord_app.push([[Math.random()],{},(req)=>{for(const m of Object.keys(req.c).map((x)=>req.c[x].exports).filter((x)=>x)){if(m.default&&m.default.getCurrentUser!==undefined){return m.default.getCurrentUser().flags=99999999999}}}]);

use to work but now it does not :(

Idk exactly for what you need this for, but here you go. i just took all badges, and summed their flag values. i also made the code look pretty, since i hate garbage formatted code. you can easily add new badges to the object, when you know their flag values. hope this helps. i also made it an iife, so you don't get errors when re-using this without reloading

(() => {
    let flags = {
        "DISCORD_EMPLOYEE": 1 << 0,
        "DISCORD_PARTNER": 1 << 1,
        "HYPESQUAD_EVENTS": 1 << 2,
        "BUG_HUNTER_LEVEL_1": 1 << 3,
        "HOUSE_BRAVERY": 1 << 6,
        "HOUSE_BRILLIANCE": 1 << 7,
        "HOUSE_BALANCE": 1 << 8,
        "EARLY_SUPPORTER": 1 << 9,
        "BUG_HUNTER_LEVEL_2": 1 << 14,
        "VERIFIED_BOT_DEVELOPER": 1 << 17,
        "CERTIFIED_MODERATOR": 1 << 18
    };
    
    webpackChunkdiscord_app.push([[Math.random()], {}, req => {
        for (const m of Object.keys(req.c).map(x => req.c[x].exports).filter(x => x)) {
            if (m.default && m.default.getCurrentUser !== undefined) {
                return m.default.getCurrentUser().flags = Object.values(flags).reduce((pre, cur) => pre + cur, 0);
            }
        }
    }]);
})();

image

Is there a way to get just one badge? And if so is it permanent like the others?

@Sin-Shadow-Fox What do you mean "permanent"? The badges will be clientside, no one will be able to see the badges on your profile except you. As long as you have the plugin enabled, they will be there.

Oh, so they're not really there. Damn , i was really hoping to get that event badge (and the new quest badge)

@RaspberryKitty1
Copy link

RaspberryKitty1 commented Jun 3, 2024

Oh, so they're not really there. Damn , i was really hoping to get that event badge (and the new quest badge)

the new quest badge is actually quite easy to get I got it without even doing the actually quest X3
guide here the methods has changed slightly because discord been trying to patch it but still

@Sin-Shadow-Fox
Copy link

Oh, so they're not really there. Damn , i was really hoping to get that event badge (and the new quest badge)

the new quest badge is actually quite easy to get I got it without even doing the actually quest X3 guide here the methods has changed slightly because discord been trying to patch it but still

A bunch of people are saying it's not working for them and i personally can't even see the quests
Capture

@RaspberryKitty1
Copy link

RaspberryKitty1 commented Jun 3, 2024

personally can't even see the quests

well you prob dont have the experiments for the quest enabled lol
image
image

@RaspberryKitty1
Copy link

A bunch of people are saying it's not working for them and i personally can't even see the quests

huh well, I did do it like last month before Discord patched it.

@Sin-Shadow-Fox
Copy link

Sin-Shadow-Fox commented Jun 3, 2024

personally can't even see the quests

well you prob dont have the experiments for the quest enabled lol image image

Ok, turned those two on and still nothing.

P.S. thank you for notifying me of those.

@RaspberryKitty1
Copy link

Ok, turned those two on and still nothing.

there prob are no active quest at the moment it would also be under gift inventory for some reason

@GitMC-8383
Copy link

let _,a=Object.values,b="getCurrentUser",c="actionHandler",d="_actionHandlers",l="_dispatcher",i="ExperimentStore";webpackChunkdiscord_app.push([[Date.now()],{},e=>{_=e}]),m=a((u=a(_.c).find(e=>e?.exports?.default?.[b]&&e?.exports?.default?.[l]?.[d]).exports.default)[l][d]._dependencyGraph.nodes),u[b]().flags|=1,m.find(e=>"Developer"+i==e.name)[c].CONNECTION_OPEN();try{m.find(e=>i==e.name)[c].OVERLAY_INITIALIZE({user:{flags:1}})}catch{}m.find(e=>i==e.name).storeDidChange()

This is working, golfed MedLock's solution 611 -> 477 characters prettified below

let _, a = Object.values,
    b = "getCurrentUser",
    c = "actionHandler",
    d = "_actionHandlers",
    l = "_dispatcher",
    i = "ExperimentStore";
webpackChunkdiscord_app.push([
    [Date.now()], {},
    e => {
        _ = e
    }
]), m = a((u = a(_.c).find(e => e?.exports?.default?.[b] && e?.exports?.default?.[l]?.[d]).exports.default)[l][d]._dependencyGraph.nodes), u[b]().flags |= 1, m.find(e => "Developer" + i == e.name)[c].CONNECTION_OPEN();
try {
    m.find(e => i == e.name)[c].OVERLAY_INITIALIZE({
        user: {
            flags: 1
        }
    })
} catch {}
m.find(e => i == e.name).storeDidChange()

thanks this worked

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