Skip to content

Instantly share code, notes, and snippets.

@DMax-YT
Last active March 6, 2022 07:52
Show Gist options
  • Save DMax-YT/6e47dfd545240cb5d278e9b3d017ba69 to your computer and use it in GitHub Desktop.
Save DMax-YT/6e47dfd545240cb5d278e9b3d017ba69 to your computer and use it in GitHub Desktop.
This gist explains how does my snippet for enabling activities work

Warning

You need to wait some time after applying-disabling snippet to make button appear-disappear

Content

Explaining

Currently button to run activities is only available on Discord Games Lab.

Random test server

Discord Games Lab server

After exploring this button with React Dev Tools we can see some IDs of activitiy applications

Activity Button application IDs

After some exploring webpack modules we can get some module with getEnabledAppIds function. It get's guild ID as argument and returns available activity IDs.

Function insight

Function use

We can patch this function, so in any case it will return array with all application IDs.

Before pathing:

Before patch

After patching:

After patch

Snippet

Full version:

webpackChunkdiscord_app.push([
  [Math.random().toString(36)],
  {},
  (e) => {
    for (const id in e.c) {
      const m = e.c[id].exports;
      if (m?.default?.getEnabledAppIds) {
        const saved = m.default.getEnabledAppIds;
        window.disableActivities = () => {
          m.default.getEnabledAppIds = saved;
          window.disableActivities = undefined;
        };

        m.default.getEnabledAppIds = () => [
          "755827207812677713",
          "832012774040141894",
          "832013003968348200",
          "878067389634314250",
          "879863976006127627",
          "879863686565621790",
          "852509694341283871",
          "880218394199220334",
          "773336526917861400",
          "814288819477020702",
          "879864070101172255",
          "879863881349087252",
          "832012854282158180",
          "763133495793942528",
          "880218832743055411",
          "878067427668275241",
          "879864010126786570",
          "879864104980979792",
          "891001866073296967",
          "832012586023256104",
          "832012682520428625",
          "832013108234289153",
        ];
        return;
      }
    }
  },
]);

Minified version:

webpackChunkdiscord_app.push([[Math.random().toString(36)],{},(e) => {for (const id in e.c) {const m = e.c[id].exports;if (m?.default?.getEnabledAppIds) {const saved = m.default.getEnabledAppIds;window.disableActivities = () => {m.default.getEnabledAppIds = saved;window.disableActivities = undefined;};m.default.getEnabledAppIds = () => ["755827207812677713","832012774040141894","832013003968348200","878067389634314250","879863976006127627","879863686565621790","852509694341283871","880218394199220334","773336526917861400","814288819477020702","879864070101172255","879863881349087252","832012854282158180","763133495793942528","880218832743055411","878067427668275241","879864010126786570","879864104980979792","891001866073296967","832012586023256104","832012682520428625","832013108234289153"];return;}}}]);

How to disable?

Before patching my snippet saves original function. So it can be undone with

window.disableActivities();

Disabling

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