Skip to content

Instantly share code, notes, and snippets.

@NullDev
Last active October 14, 2025 14:07
Show Gist options
  • Select an option

  • Save NullDev/cac59e13967aecf0360cf35f88ce8932 to your computer and use it in GitHub Desktop.

Select an option

Save NullDev/cac59e13967aecf0360cf35f88ce8932 to your computer and use it in GitHub Desktop.

Revisions

  1. NullDev revised this gist Jun 17, 2025. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions 2-discord-cli-dev.md
    Original file line number Diff line number Diff line change
    @@ -112,6 +112,15 @@ equivelent to `_mods.find()`. Just a shortcut for lazy people
    const findModule = (func) => _mods.find(func)
    ```
    **Or, better yet:**
    ```js
    const getModules = () => webpackChunkdiscord_app.push([[Symbol()], {}, m => m])?.c ?? {}
    const findModule = find => Object.values(getModules()).map(x => x?.exports?.default ?? x?.exports).filter(Boolean).find(find)
    ```
    Thanks to [@kingdudely](https://gist.github.com/kingdudely)
    # Discord Modules
    May or may not be valid. <br>
  2. NullDev revised this gist Jun 17, 2025. 1 changed file with 6 additions and 15 deletions.
    21 changes: 6 additions & 15 deletions 1-discord-cli.md
    Original file line number Diff line number Diff line change
    @@ -10,22 +10,13 @@
    ## Enable Experiments and Dev-Only Options:

    ```js
    let cache; webpackChunkdiscord_app.push([[Symbol()], {}, (e) => cache = e.c]); webpackChunkdiscord_app.pop();

    let user = Object.values(cache).find(x => x?.exports?.default?.getUser).exports.default
    nodes = Object.values(user._dispatcher._actionHandlers._dependencyGraph.nodes);
    userr = user.getCurrentUser();
    userr.flags = 1;
    userr.isStaff = () => true;
    userr.isStaffPersonal = () => true;

    try {
    nodes.find(x => x.name == "ExperimentStore").actionHandler["OVERLAY_INITIALIZE"]({ user: userr });
    } catch (error) {};

    user.getCurrentUser = user.getNonImpersonatedCurrentUser = () => (userr);

    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;
    ```
    ## Use REST API with your token & cookies
  3. NullDev revised this gist Jun 4, 2024. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions 1-discord-cli.md
    Original file line number Diff line number Diff line change
    @@ -65,6 +65,8 @@ a.post({url: "/channels/" + channel_id + "/messages", body: {"flags": 1 << 13, "
    ## Generate friend link
    **NOTE:** This snippet requires [`findByProps`](https://gist.github.com/NullDev/cac59e13967aecf0360cf35f88ce8932#findbyprops) from ["general functions"](https://gist.github.com/NullDev/cac59e13967aecf0360cf35f88ce8932#file-2-discord-cli-dev-md) to be set.
    ```js
    const link = await findByProps("createFriendInvite").createFriendInvite();
    console.log("https://discord.gg/" + link.code);
    @@ -74,6 +76,8 @@ console.log("https://discord.gg/" + link.code);
    ## Change HypeSquad House
    **NOTE:** This snippet requires [`findByProps`](https://gist.github.com/NullDev/cac59e13967aecf0360cf35f88ce8932#findbyprops) from ["general functions"](https://gist.github.com/NullDev/cac59e13967aecf0360cf35f88ce8932#file-2-discord-cli-dev-md) to be set.
    ```js
    let house = 1;
    findByProps("joinHypeSquadOnline").joinHypeSquadOnline({ houseID: "HOUSE_" + house })
  4. NullDev revised this gist Jun 4, 2024. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions 1-discord-cli.md
    Original file line number Diff line number Diff line change
    @@ -66,11 +66,10 @@ a.post({url: "/channels/" + channel_id + "/messages", body: {"flags": 1 << 13, "
    ## Generate friend link
    ```js
    await (webpackChunkdiscord_app.push([[''],{},e=>m=Object.values(e.c)]),m)
    .find(m => m.exports?.Z?.createFriendInvite).exports.Z.createFriendInvite()
    const link = await findByProps("createFriendInvite").createFriendInvite();
    console.log("https://discord.gg/" + link.code);
    ```
    Use the code from the output and put `https://discord.gg/` in front of it. e.g.: `https://discord.gg/abcxyz` <br>
    **Note**: If you generate a new link, the old one will be invalidated! Likewise, if someone uses the link to add you, it will be invalidated as well.
    ## Change HypeSquad House
  5. NullDev revised this gist Jun 4, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 1-discord-cli.md
    Original file line number Diff line number Diff line change
    @@ -79,7 +79,7 @@ Use the code from the output and put `https://discord.gg/` in front of it. e.g.:
    let house = 1;
    findByProps("joinHypeSquadOnline").joinHypeSquadOnline({ houseID: "HOUSE_" + house })
    ```
    (fixed by @FoUnDeRR)
    (fixed by [@FoUnDeRR](https://github.com/FoUnDeRR))

    Change the house variable:
    - 1 = Bravery
  6. NullDev revised this gist Jun 4, 2024. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions 1-discord-cli.md
    Original file line number Diff line number Diff line change
    @@ -76,10 +76,10 @@ Use the code from the output and put `https://discord.gg/` in front of it. e.g.:
    ## Change HypeSquad House

    ```js
    house = 1;
    (webpackChunkdiscord_app.push([[""],{},e=>{m=[];for(let r in e.c)m.push(e.c[r])}]),m)
    .find((e=>e?.exports?.Z?.joinHypeSquadOnline)).exports.Z.joinHypeSquadOnline({houseID: "HOUSE_" + house})
    let house = 1;
    findByProps("joinHypeSquadOnline").joinHypeSquadOnline({ houseID: "HOUSE_" + house })
    ```
    (fixed by @FoUnDeRR)

    Change the house variable:
    - 1 = Bravery
  7. NullDev revised this gist May 8, 2024. 1 changed file with 16 additions and 9 deletions.
    25 changes: 16 additions & 9 deletions 1-discord-cli.md
    Original file line number Diff line number Diff line change
    @@ -10,15 +10,22 @@
    ## Enable Experiments and Dev-Only Options:

    ```js
    let cache; webpackChunkdiscord_app.push([["wp_isdev_patch"], {}, r => cache=r.c]);
    var UserStore = Object.values(cache).find(m => m?.exports?.default?.getUsers).exports.default;
    var actions = Object.values(UserStore._dispatcher._actionHandlers._dependencyGraph.nodes);
    var user = UserStore.getCurrentUser();
    actions.find(n => n.name === "ExperimentStore").actionHandler.CONNECTION_OPEN({
    type: "CONNECTION_OPEN", user: {flags: user.flags |= 1}, experiments: [],
    });
    actions.find(n => n.name === "DeveloperExperimentStore").actionHandler.CONNECTION_OPEN();
    webpackChunkdiscord_app.pop(); user.flags &= ~1; "done";
    let cache; webpackChunkdiscord_app.push([[Symbol()], {}, (e) => cache = e.c]); webpackChunkdiscord_app.pop();

    let user = Object.values(cache).find(x => x?.exports?.default?.getUser).exports.default
    nodes = Object.values(user._dispatcher._actionHandlers._dependencyGraph.nodes);
    userr = user.getCurrentUser();
    userr.flags = 1;
    userr.isStaff = () => true;
    userr.isStaffPersonal = () => true;

    try {
    nodes.find(x => x.name == "ExperimentStore").actionHandler["OVERLAY_INITIALIZE"]({ user: userr });
    } catch (error) {};

    user.getCurrentUser = user.getNonImpersonatedCurrentUser = () => (userr);

    nodes.find(x => x.name == "DeveloperExperimentStore").actionHandler["OVERLAY_INITIALIZE"]();
    ```
    ## Use REST API with your token & cookies
  8. NullDev revised this gist Feb 14, 2024. 1 changed file with 9 additions and 12 deletions.
    21 changes: 9 additions & 12 deletions 1-discord-cli.md
    Original file line number Diff line number Diff line change
    @@ -10,18 +10,15 @@
    ## Enable Experiments and Dev-Only Options:

    ```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__.getCurrentUser;
    usermod.exports.default.__proto__.getCurrentUser = () => ({isStaff: () => true})
    nodes.find(x => x.name == "DeveloperExperimentStore").actionHandler["CONNECTION_OPEN"]()
    usermod.exports.default.__proto__.getCurrentUser = oldGetUser
    let cache; webpackChunkdiscord_app.push([["wp_isdev_patch"], {}, r => cache=r.c]);
    var UserStore = Object.values(cache).find(m => m?.exports?.default?.getUsers).exports.default;
    var actions = Object.values(UserStore._dispatcher._actionHandlers._dependencyGraph.nodes);
    var user = UserStore.getCurrentUser();
    actions.find(n => n.name === "ExperimentStore").actionHandler.CONNECTION_OPEN({
    type: "CONNECTION_OPEN", user: {flags: user.flags |= 1}, experiments: [],
    });
    actions.find(n => n.name === "DeveloperExperimentStore").actionHandler.CONNECTION_OPEN();
    webpackChunkdiscord_app.pop(); user.flags &= ~1; "done";
    ```
    ## Use REST API with your token & cookies
  9. NullDev revised this gist Jun 10, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 1-discord-cli.md
    Original file line number Diff line number Diff line change
    @@ -67,7 +67,7 @@ await (webpackChunkdiscord_app.push([[''],{},e=>m=Object.values(e.c)]),m)
    ```
    Use the code from the output and put `https://discord.gg/` in front of it. e.g.: `https://discord.gg/abcxyz` <br>
    **Note**: If you generate a new link, the old one will be invalidated!
    **Note**: If you generate a new link, the old one will be invalidated! Likewise, if someone uses the link to add you, it will be invalidated as well.

    ## Change HypeSquad House

  10. NullDev revised this gist May 22, 2023. 1 changed file with 17 additions and 2 deletions.
    19 changes: 17 additions & 2 deletions 1-discord-cli.md
    Original file line number Diff line number Diff line change
    @@ -77,7 +77,22 @@ house = 1;
    .find((e=>e?.exports?.Z?.joinHypeSquadOnline)).exports.Z.joinHypeSquadOnline({houseID: "HOUSE_" + house})
    ```

    CHange the house variable:
    Change the house variable:
    - 1 = Bravery
    - 2 = Brilliance
    - 3 = Balance
    - 3 = Balance

    ## List channels that include "bad names" so Discovery and Partner Program isn't blocked
    **NOTE:** This snippet requires [`_mods`](https://gist.github.com/NullDev/cac59e13967aecf0360cf35f88ce8932#define-_mods) and [`findByProps`](https://gist.github.com/NullDev/cac59e13967aecf0360cf35f88ce8932#findbyprops) from ["general functions"](https://gist.github.com/NullDev/cac59e13967aecf0360cf35f88ce8932#file-2-discord-cli-dev-md) to be set.
    ```js
    let {getChannel} = findByProps("getMutableGuildChannelsForGuild");
    (async (guildId) => {
    let {nsfw_properties} = await findByProps("getAPIBaseURL").get(`/guilds/${guildId}/discovery-requirements`)
    .then(({text}) => JSON.parse(text));
    for (let c of nsfw_properties.channels) {
    console.log(getChannel(c).name, nsfw_properties.channels_banned_keywords[c]);
    }
    })("<ID>")
    ```
  11. NullDev revised this gist May 22, 2023. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions 1-discord-cli.md
    Original file line number Diff line number Diff line change
    @@ -27,13 +27,14 @@ usermod.exports.default.__proto__.getCurrentUser = oldGetUser
    ## Use REST API with your token & cookies
    ```js
    const c = webpackChunkdiscord_app.push([[Symbol()], {}, ({c}) => Object.values(c)]);
    const api = c.find((x) => x?.exports?.Z?.getAPIBaseURL).exports.Z; webpackChunkdiscord_app.pop();
    const api = webpackChunkdiscord_app.push([[Symbol()], {}, ({c}) => Object.values(c)])
    .find((x) => x?.exports?.Z?.getAPIBaseURL).exports.Z; webpackChunkdiscord_app.pop();
    ```
    Example usage:
    ```js
    await api.get({ url: "/guilds/<ID>?with_counts=true" });
    await api.get({ url: "/guilds/<ID>/channels" });
    // or
    await api.post({url: "/users/@me/referrals/<ID>/preview"});
    ```
  12. NullDev revised this gist May 22, 2023. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion 1-discord-cli.md
    Original file line number Diff line number Diff line change
    @@ -27,12 +27,13 @@ usermod.exports.default.__proto__.getCurrentUser = oldGetUser
    ## Use REST API with your token & cookies
    ```js
    const c = webpackChunkdiscord_app.push([[Symbol()], {}, ({c}) => Object.values(c)]);
    const api = c.find((x) => x?.exports?.Z?.getAPIBaseURL).exports.Z; webpackChunkdiscord_app.pop();
    ```
    Example usage:
    ```js
    await api.get({ url: "/guilds/<ID<?with_counts=true" });
    await api.get({ url: "/guilds/<ID>?with_counts=true" });
    // or
    await api.post({url: "/users/@me/referrals/<ID>/preview"});
    ```
  13. NullDev revised this gist May 21, 2023. 2 changed files with 13 additions and 13 deletions.
    13 changes: 13 additions & 0 deletions 1-discord-cli.md
    Original file line number Diff line number Diff line change
    @@ -24,6 +24,19 @@ nodes.find(x => x.name == "DeveloperExperimentStore").actionHandler["CONNECTION_
    usermod.exports.default.__proto__.getCurrentUser = oldGetUser
    ```
    ## Use REST API with your token & cookies
    ```js
    const api = c.find((x) => x?.exports?.Z?.getAPIBaseURL).exports.Z; webpackChunkdiscord_app.pop();
    ```
    Example usage:
    ```js
    await api.get({ url: "/guilds/<ID<?with_counts=true" });
    // or
    await api.post({url: "/users/@me/referrals/<ID>/preview"});
    ```
    ## Send Audio file as Voice Message
    ```js
    13 changes: 0 additions & 13 deletions 2-discord-cli-dev.md
    Original file line number Diff line number Diff line change
    @@ -29,19 +29,6 @@ const findByProps = (...props) => {
    }
    ```
    ## REST API
    ```js
    const api = c.find((x) => x?.exports?.Z?.getAPIBaseURL).exports.Z; webpackChunkdiscord_app.pop();
    ```
    Example usage:
    ```js
    await api.get({ url: "/guilds/<ID<?with_counts=true" });
    // or
    await api.post({url: "/users/@me/referrals/<ID>/preview"});
    ```
    ## `getStore`
    Gets a store by its name.
  14. NullDev revised this gist May 21, 2023. 1 changed file with 13 additions and 0 deletions.
    13 changes: 13 additions & 0 deletions 2-discord-cli-dev.md
    Original file line number Diff line number Diff line change
    @@ -29,6 +29,19 @@ const findByProps = (...props) => {
    }
    ```
    ## REST API
    ```js
    const api = c.find((x) => x?.exports?.Z?.getAPIBaseURL).exports.Z; webpackChunkdiscord_app.pop();
    ```
    Example usage:
    ```js
    await api.get({ url: "/guilds/<ID<?with_counts=true" });
    // or
    await api.post({url: "/users/@me/referrals/<ID>/preview"});
    ```
    ## `getStore`
    Gets a store by its name.
  15. NullDev revised this gist May 17, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 2-discord-cli-dev.md
    Original file line number Diff line number Diff line change
    @@ -75,7 +75,7 @@ const getAllFunctions = () => {
    Gets a Function by a name query.
    ```js
    const searchFunctions = (query) => {
    const searchFunctions = (search) => {
    return _mods.filter(m => typeof m?.exports?.Z === "object")
    .map(m => Object.entries(m?.exports?.Z).filter(entry => typeof entry[1] === "function" && entry[0].toLowerCase().includes(search))
    .map(entry => entry[0])).filter(array => array.length !== 0);
  16. NullDev revised this gist May 8, 2023. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion 1-discord-cli.md
    Original file line number Diff line number Diff line change
    @@ -51,7 +51,8 @@ await (webpackChunkdiscord_app.push([[''],{},e=>m=Object.values(e.c)]),m)
    .find(m => m.exports?.Z?.createFriendInvite).exports.Z.createFriendInvite()
    ```
    Use the code from the output and put `https://discord.gg/` in front of it. e.g.: `https://discord.gg/abcxyz`
    Use the code from the output and put `https://discord.gg/` in front of it. e.g.: `https://discord.gg/abcxyz` <br>
    **Note**: If you generate a new link, the old one will be invalidated!

    ## Change HypeSquad House

  17. NullDev revised this gist May 8, 2023. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions 2-discord-cli-dev.md
    Original file line number Diff line number Diff line change
    @@ -197,3 +197,4 @@ CurrentExperiment - findByProps("getExperimentId")
    This is a snippet to get all of the functions and modules in one object. <br>
    Access them using `snippetApi`.
    => [`3-discord-cli-snippet-api.js`](#file-3-discord-cli-snippet-api-js)
  18. NullDev revised this gist May 8, 2023. 2 changed files with 225 additions and 1 deletion.
    1 change: 0 additions & 1 deletion 2-discord-cli-dev.md
    Original file line number Diff line number Diff line change
    @@ -197,4 +197,3 @@ CurrentExperiment - findByProps("getExperimentId")
    This is a snippet to get all of the functions and modules in one object. <br>
    Access them using `snippetApi`.
    => https://pastebin.com/VT4wtUJN
    225 changes: 225 additions & 0 deletions 3-discord-cli-snippet-api.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,225 @@
    class SnippetApi {
    constructor() {
    const _mods = webpackChunkdiscord_app.push([[Symbol()],{},({c})=>Object.values(c)]);

    this._mods = _mods;

    webpackChunkdiscord_app.pop();
    }

    findByProps = (...props) => {
    for (let m of this._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 {}
    }
    }

    getStore = (store) => {
    return Object.values(Object.values(this._mods.find(x => x?.exports?.default?.getUsers).exports.default._dispatcher._actionHandlers)[3].nodes).filter(s => s.name === store)[0];
    };

    getActionHandler = (store, actionHandler) => {
    let stores = Object.values(Object.values(this._mods.find(x => x?.exports?.default?.getUsers).exports.default._dispatcher._actionHandlers)[3].nodes).filter(s => s.name === store);
    let found;

    for (var store of stores) {
    if (!found && store.actionHandler[actionHandler]) found = store;
    };

    if (found) return found.actionHandler[actionHandler];
    else return console.error(`${actionHandler} action handler could not found!`);
    };

    getAllFunctions = () => {
    return this._mods.filter(m => typeof m?.exports?.Z === "object").map(m => Object.entries(m?.exports?.Z).filter(entry => typeof entry[1] === "function").map(entry => entry[0]));
    };

    searchFunctions = (query) => {
    return this._mods.filter(m => typeof m?.exports?.Z === "object").map(m => Object.entries(m?.exports?.Z).filter(entry => typeof entry[1] === "function" && entry[0].toLowerCase().includes(search)).map(entry => entry[0])).filter(array => array.length !== 0);
    };

    searchStores = (query) => {
    return Object.fromEntries(this._mods.find(x => x?.exports?.Z?.connectStores).Store.getAll().filter(store => store.getName().toLowerCase().includes(query)).map(matchingStore => [matchingStore.getName(), matchingStore]));
    };

    searchActionHandlers = (query) => {
    return Object.keys(Object.values(this._mods.find(x => x?.exports?.default?.getUsers).exports.default._dispatcher._actionHandlers)[0]).filter(key => key.toLowerCase().includes(query));
    };

    findModule = (func) => this.this._mods.find(func)

    get React() {return this.findByProps("createElement", "cloneElement");}
    get ReactDOM() {return this.findByProps("render", "findDOMNode");}

    /* Guild Info, Stores, and Utilities */
    get GuildStore() {return this.findByProps("getGuild");}
    get SortedGuildStore() {return this.findByProps("getSortedGuilds");}
    get SelectedGuildStore() {return this.findByProps("getLastSelectedGuildId");}
    get GuildSync() {return this.findByProps("getSyncedGuilds");}
    get GuildInfo() {return this.findByProps("getAcronym");}
    get GuildChannelsStore() {return this.findByProps("getChannels", "getDefaultChannel");}
    get GuildMemberStore() {return this.findByProps("getMember");}
    get MemberCountStore() {return this.findByProps("getMemberCounts");}
    get GuildEmojiStore() {return this.findByProps("getEmojis");}
    get GuildActions() {return this.findByProps("requestMembers");}
    get GuildPermissions() {return this.findByProps("getGuildPermissions");}

    /* Channel Store & Actions */
    get ChannelStore() {return this.findByProps("getChannel", "getDMFromUserId");}
    get SelectedChannelStore() {return this.findByProps("getLastSelectedChannelId");}
    get ChannelActions() {return this.findByProps("selectChannel");}
    get PrivateChannelActions() {return this.findByProps("openPrivateChannel");}

    /* Current User Info, State and Settings */
    get UserInfoStore() {return this.findByProps("getSessionId");}
    get UserSettingsStore() {return this.findByProps("guildPositions");}
    get StreamerModeStore() {return this.findByProps("hidePersonalInformation");}
    get UserSettingsUpdater() {return this.findByProps("updateRemoteSettings");}
    get OnlineWatcher() {return this.findByProps("isOnline");}
    get CurrentUserIdle() {return this.findByProps("isIdle");}
    get RelationshipStore() {return this.findByProps("isBlocked", "getFriendIDs");}
    get RelationshipManager() {return this.findByProps("addRelationship");}
    get MentionStore() {return this.findByProps("getMentions");}

    /* User Stores and Utils */
    get UserStore() {return this.findByProps("getCurrentUser", "getUser");}
    get UserStatusStore() {return this.findByProps("getStatus", "getState");}
    get UserTypingStore() {return this.findByProps("isTyping");}
    get UserActivityStore() {return this.findByProps("getActivity");}
    get UserNameResolver() {return this.findByProps("getName");}
    get UserNoteStore() {return this.findByProps("getNote");}
    get UserNoteActions() {return this.findByProps("updateNote");}

    /* Emoji Store and Utils */
    get EmojiInfo() {return this.findByProps("isEmojiDisabled");}
    get EmojiUtils() {return this.findByProps("getGuildEmoji");}
    get EmojiStore() {return this.findByProps("getByCategory", "EMOJI_NAME_RE");}

    /* Invite Store and Utils */
    get InviteStore() {return this.findByProps("getInvites");}
    get InviteResolver() {return this.findByProps("resolveInvite");}
    get InviteActions() {return this.findByProps("acceptInvite");}

    /* Discord Objects & Utils */
    get DiscordConstants() {return this.findByProps("Permissions", "ActivityTypes", "StatusTypes");}
    get DiscordPermissions() {return this.findByProps("Permissions", "ActivityTypes", "StatusTypes").Permissions;}
    get Permissions() {return this.findByProps("computePermissions");}
    get ColorConverter() {return this.findByProps("hex2int");}
    get ColorShader() {return this.findByProps("darken");}
    get TinyColor() {return WebpackModules.getByPrototypes("toRgb");}
    get ClassResolver() {return this.findByProps("getClass");}
    get ButtonData() {return this.findByProps("ButtonSizes");}
    get NavigationUtils() {return this.findByProps("transitionTo", "replaceWith", "getHistory");}
    get KeybindStore() {return this.findByProps("keyToCode");}

    /* Discord Messages */
    get MessageStore() {return this.findByProps("getMessage", "getMessages");}
    get ReactionsStore() {return this.findByProps("getReactions", "_dispatcher");}
    get MessageActions() {return this.findByProps("jumpToMessage", "_sendMessage");}
    get MessageQueue() {return this.findByProps("enqueue");}

    /* Experiments */
    get ExperimentStore() {return this.findByProps("getExperimentOverrides");}
    get ExperimentsManager() {return this.findByProps("isDeveloper");}
    get CurrentExperiment() {return this.findByProps("getExperimentId");}

    /* Streams */
    get StreamStore() {return this.findByProps("getAllActiveStreams", "getStreamForUser");}
    get StreamPreviewStore() {return this.findByProps("getIsPreviewLoading", "getPreviewURL");}

    /* Images, Avatars and Utils */
    get ImageResolver() {return this.findByProps("getUserAvatarURL", "getGuildIconURL");}
    get ImageUtils() {return this.findByProps("getSizedImageSrc");}
    get AvatarDefaults() {return this.findByProps("getUserAvatarURL", "DEFAULT_AVATARS");}

    /* Drag & Drop */
    get DNDSources() {return this.findByProps("addTarget");}
    get DNDObjects() {return this.findByProps("DragSource");}

    /* Electron & Other Internals with Utils*/
    get ElectronModule() {return this.findByProps("setBadge");}
    get Flux() {return this.findByProps("Store", "connectStores");}
    get Dispatcher() {return this.findByProps("dirtyDispatch");}
    get PathUtils() {return this.findByProps("hasBasename");}
    get NotificationModule() {return this.findByProps("showNotification");}
    get RouterModule() {return this.findByProps("Router");}
    get APIModule() {return this.findByProps("getAPIBaseURL");}
    get AnalyticEvents() {return this.findByProps("AnalyticEventConfigs");}
    get Buffers() {return this.findByProps("Buffer", "kMaxLength");}
    get DeviceStore() {return this.findByProps("getDevices");}
    get SoftwareInfo() {return this.findByProps("os");}
    get i18n() {return this.findByProps("Messages", "languages");}

    /* Media Stuff (Audio/Video) */
    get MediaDeviceInfo() {return this.findByProps("Codecs", "MediaEngineContextTypes");}
    get MediaInfo() {return this.findByProps("getOutputVolume");}
    get MediaEngineInfo() {return this.findByProps("determineMediaEngine");}
    get VoiceInfo() {return this.findByProps("getEchoCancellation");}
    get SoundModule() {return this.findByProps("playSound");}

    /* Window, DOM, HTML */
    get WindowInfo() {return this.findByProps("isFocused", "windowSize");}
    get DOMInfo() {return this.findByProps("canUseDOM");}

    /* Locale/Location and Time */
    get Moment() {return this.findByProps("parseZone");}
    get LocationManager() {return this.findByProps("createLocation");}
    get Timestamps() {return this.findByProps("fromTimestamp");}

    /* Strings and Utils */
    get StringFormats() {return this.findByProps("a", "z");}
    get StringUtils() {return this.findByProps("toASCII");}

    /* URLs and Utils */
    get URLParser() {return this.findByProps("Url", "parse");}
    get ExtraURLs() {return this.findByProps("getArticleURL");}

    /* Text Processing */
    get hljs() {return this.findByProps("highlight", "highlightBlock");}
    get SimpleMarkdown() {return this.findByProps("parseBlock", "parseInline", "defaultOutput");}

    /* DOM/React Components */
    /* ==================== */
    get LayerManager() {return this.findByProps("popLayer", "pushLayer");}
    get UserSettingsWindow() {return this.findByProps("open", "updateAccount");}
    get ChannelSettingsWindow() {return this.findByProps("open", "updateChannel");}
    get GuildSettingsWindow() {return this.findByProps("open", "updateGuild");}

    /* Modals */
    get ModalActions() {return this.findByProps("openModal", "updateModal");}
    get ModalStack() {return this.findByProps("push", "update", "pop", "popWithKey");}
    get UserProfileModals() {return this.findByProps("fetchMutualFriends", "setSection");}
    get ChangeNicknameModal() {return this.findByProps("open", "changeNickname");}
    get CreateChannelModal() {return this.findByProps("open", "createChannel");}
    get PruneMembersModal() {return this.findByProps("open", "prune");}
    get NotificationSettingsModal() {return this.findByProps("open", "updateNotificationSettings");}

    /* Popouts */
    get PopoutStack() {return this.findByProps("open", "close", "closeAll");}
    get PopoutOpener() {return this.findByProps("openPopout");}

    /* Context Menus */
    get ContextMenuActions() {return this.findByProps("openContextMenu");}

    /* Misc */
    get FlexChild() {return this.findByProps("Child");}
    get Titles() {return this.findByProps("Tags", "default");}
    get Tooltip() {return this.findByProps("TooltipContainer").TooltipContainer;}

    /* Scrollers */
    get ScrollerThin() {return this.findByProps("ScrollerThin").ScrollerThin;}
    get ScrollerAuto() {return this.findByProps("ScrollerAuto").ScrollerAuto;}
    get AdvancedScrollerThin() {return this.findByProps("AdvancedScrollerThin").AdvancedScrollerThin;}
    get AdvancedScrollerAuto() {return this.findByProps("AdvancedScrollerAuto").AdvancedScrollerAuto;}
    get AdvancedScrollerNone() {return this.findByProps("AdvancedScrollerNone").AdvancedScrollerNone;}

    get Dropdown() {return this.findByProps("SingleSelect").SingleSelect;}
    };

    window.snippetApi = new SnippetApi();
  19. NullDev revised this gist May 8, 2023. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion 2-discord-cli-dev.md
    Original file line number Diff line number Diff line change
    @@ -194,4 +194,7 @@ CurrentExperiment - findByProps("getExperimentId")
    ## Snippet API:
    -> https://pastebin.com/VT4wtUJN
    This is a snippet to get all of the functions and modules in one object. <br>
    Access them using `snippetApi`.
    => https://pastebin.com/VT4wtUJN
  20. NullDev revised this gist May 8, 2023. 1 changed file with 197 additions and 0 deletions.
    197 changes: 197 additions & 0 deletions 2-discord-cli-dev.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,197 @@
    # Some general functions to develop new tricks

    ## Define `_mods`

    Defines the `_mods` constant so different findBy/get functions dont cause errors trying defining the same constant.
    **NECESSARY FOR ALL FINDBY/GET FUNCTIONS UNLESS STATED OTHERWISE.**

    ```js
    const _mods = webpackChunkdiscord_app.push([[Symbol()],{},({c})=>Object.values(c)]);
    webpackChunkdiscord_app.pop();
    ```

    ## `findByProps`

    Gets a module by one (or more) of its properties.

    ```js
    const findByProps = (...props) => {
    for (let m of _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 {}
    }
    }
    ```
    ## `getStore`
    Gets a store by its name.
    ```js
    const getStore = (store) => {
    return Object.values(
    Object.values(_mods.find(x => x?.exports?.default?.getUsers).exports.default._dispatcher._actionHandlers)[3].nodes
    ).filter(s => s.name === store)[0];
    };
    ```
    ## `getActionHandler`
    Gets an ActionHandler by its store and name.
    ```js
    const getActionHandler = (store, actionHandler) => {
    let stores = Object.values(Object.values(_mods.find(x => x?.exports?.default?.getUsers).exports.default._dispatcher._actionHandlers)[3].nodes).filter(s => s.name === store);
    let found;

    for (var store of stores) {
    if (!found && store.actionHandler[actionHandler]) found = store;
    };

    if (found) return found.actionHandler[actionHandler];
    else return console.error(`${actionHandler} action handler could not found!`);
    };
    ```
    ## `getAllFunctions`
    Gets all functions of all modules.
    ```js
    const getAllFunctions = () => {
    return _mods.filter(m => typeof m?.exports?.Z === "object").map(m => Object.entries(m?.exports?.Z)
    .filter(entry => typeof entry[1] === "function").map(entry => entry[0]));
    };
    ```
    ## `searchFunctions`
    Gets a Function by a name query.
    ```js
    const searchFunctions = (query) => {
    return _mods.filter(m => typeof m?.exports?.Z === "object")
    .map(m => Object.entries(m?.exports?.Z).filter(entry => typeof entry[1] === "function" && entry[0].toLowerCase().includes(search))
    .map(entry => entry[0])).filter(array => array.length !== 0);
    };
    ```
    ## `searchStores`
    Gets a store by a name query.
    ```js
    const searchStores = (query) => {
    return Object.fromEntries(_mods.find(x => x?.exports?.Z?.connectStores).Store.getAll()
    .filter(store => store.getName().toLowerCase().includes(query)).map(matchingStore => [matchingStore.getName(), matchingStore]));
    };
    ```
    ## `searchActionHandlers`
    Gets an action handler by a name query.
    ```js
    const searchActionHandlers = (query) => {
    return Object.keys(Object.values(_mods.find(x => x?.exports?.default?.getUsers).exports.default._dispatcher._actionHandlers)[0])
    .filter(key => key.toLowerCase().includes(query));
    };
    ```
    ## `findModule`
    equivelent to `_mods.find()`. Just a shortcut for lazy people
    ```js
    const findModule = (func) => _mods.find(func)
    ```
    # Discord Modules
    May or may not be valid. <br>
    From: https://rauenzi.github.io/BDPluginLibrary/docs/modules_discordmodules.js.html
    ```js
    React - findByProps("createElement", "cloneElement")
    ReactDOM - findByProps("render", "findDOMNode")

    GuildStore - findByProps("getGuild")
    SortedGuildStore - findByProps("getSortedGuilds")
    SelectedGuildStore - findByProps("getLastSelectedGuildId")
    GuildSync - findByProps("getSyncedGuilds")
    GuildInfo - findByProps("getAcronym")
    GuildChannelsStore - findByProps("getChannels", "getDefaultChannel")
    GuildMemberStore - findByProps("getMember")
    MemberCountStore - findByProps("getMemberCounts")
    GuildEmojiStore - findByProps("getEmojis")
    GuildActions - findByProps("requestMembers")
    GuildPermissions - findByProps("getGuildPermissions")

    /* Channel Store & Actions */
    ChannelStore - findByProps("getChannel", "getDMFromUserId")
    SelectedChannelStore - findByProps("getLastSelectedChannelId")
    ChannelActions - findByProps("selectChannel")
    PrivateChannelActions - findByProps("openPrivateChannel")

    /* Current User Info, State and Settings */
    UserInfoStore - findByProps("getSessionId")
    UserSettingsStore - findByProps("guildPositions")
    StreamerModeStore - findByProps("hidePersonalInformation")
    UserSettingsUpdater - findByProps("updateRemoteSettings")
    OnlineWatcher - findByProps("isOnline")
    CurrentUserIdle - findByProps("isIdle")
    RelationshipStore - findByProps("isBlocked", "getFriendIDs")
    RelationshipManager - findByProps("addRelationship")
    MentionStore - findByProps("getMentions")

    /* User Stores and Utils */
    UserStore - findByProps("getCurrentUser", "getUser")
    UserStatusStore - findByProps("getStatus", "getState")
    UserTypingStore - findByProps("isTyping")
    UserActivityStore - findByProps("getActivity")
    UserNameResolver - findByProps("getName")
    UserNoteStore - findByProps("getNote")
    UserNoteActions - findByProps("updateNote")

    /* Emoji Store and Utils */
    EmojiInfo - findByProps("isEmojiDisabled")
    EmojiUtils - findByProps("getGuildEmoji")
    EmojiStore - findByProps("getByCategory", "EMOJI_NAME_RE")

    /* Invite Store and Utils */
    InviteStore - findByProps("getInvites")
    InviteResolver - findByProps("resolveInvite")
    InviteActions - findByProps("acceptInvite")

    /* Discord Objects & Utils */
    DiscordConstants - findByProps("Permissions", "ActivityTypes", "StatusTypes")
    DiscordPermissions - findByProps("Permissions", "ActivityTypes", "StatusTypes").Permissions
    Permissions - findByProps("computePermissions")
    ColorConverter - findByProps("hex2int")
    ColorShader - findByProps("darken")
    ClassResolver - findByProps("getClass")
    ButtonData - findByProps("ButtonSizes")
    NavigationUtils - findByProps("transitionTo", "replaceWith", "getHistory")
    KeybindStore - findByProps("keyToCode")

    /* Discord Messages */
    MessageStore - findByProps("getMessage", "getMessages")
    ReactionsStore - findByProps("getReactions", "_dispatcher")
    MessageActions - findByProps("jumpToMessage", "_sendMessage")
    MessageQueue - findByProps("enqueue")

    /* Experiments */
    ExperimentStore - findByProps("getExperimentOverrides")
    ExperimentsManager - findByProps("isDeveloper")
    CurrentExperiment - findByProps("getExperimentId")
    ```
    ## Snippet API:
    -> https://pastebin.com/VT4wtUJN
  21. NullDev renamed this gist May 8, 2023. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  22. NullDev revised this gist May 4, 2023. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion discord-cli.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,6 @@
    # INSTRUCTIONS FOR ALL OF THEM:
    # Discord Console Tricks (Experiments, Dev Stuff, etc)

    ## INSTRUCTIONS FOR ALL OF THEM:

    > - Open DevTools in Discord with `CTRL + SHIFT + i` (ONLY POSSIBLE IN CANARY AND PBT ANYMORE)
    > - Paste Snippet
  23. NullDev revised this gist May 4, 2023. No changes.
  24. NullDev revised this gist May 4, 2023. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions discord-cli.md
    Original file line number Diff line number Diff line change
    @@ -62,6 +62,4 @@ house = 1;
    CHange the house variable:
    - 1 = Bravery
    - 2 = Brilliance
    - 3 = Balance

    ```
    - 3 = Balance
  25. NullDev renamed this gist May 4, 2023. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  26. NullDev created this gist May 4, 2023.
    67 changes: 67 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,67 @@
    # INSTRUCTIONS FOR ALL OF THEM:

    > - Open DevTools in Discord with `CTRL + SHIFT + i` (ONLY POSSIBLE IN CANARY AND PBT ANYMORE)
    > - Paste Snippet
    > - Edit it. (optional: if instructed)
    > - Hit Enter.

    ## Enable Experiments and Dev-Only Options:

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

    ## Send Audio file as Voice Message

    ```js
    (() => {
    const uploaded_filename = "<UPLOAD_FILENAME_HERE>";
    const channel_id = "<CHANNEL_ID_HERE>";
    const c = webpackChunkdiscord_app.push([[Symbol()], {}, ({c}) => Object.values(c)]);
    const a = c.find((x) => x?.exports?.Z?.getAPIBaseURL).exports.Z;
    webpackChunkdiscord_app.pop();
    a.post({url: "/channels/" + channel_id + "/messages", body: {"flags": 1 << 13, "attachments": [{"id": "0", "filename": "file.ogg", "uploaded_filename": uploaded_filename, "waveform": "=", "duration_secs": 1}]}
    })})()
    ```

    **Usage:**
    - open dev tools, go to network tab
    - send an audio file in any channel, watch for request to "/channels/<channel>/attachments"
    - click on the request, go to the response tab and copy the value of the "upload_filename" property
    - replace <UPLOAD_FILENAME_HERE> with value above
    - replace <CHANNEL_ID_HERE> with the channel id you want to send the message in

    ## Generate friend link

    ```js
    await (webpackChunkdiscord_app.push([[''],{},e=>m=Object.values(e.c)]),m)
    .find(m => m.exports?.Z?.createFriendInvite).exports.Z.createFriendInvite()
    ```

    Use the code from the output and put `https://discord.gg/` in front of it. e.g.: `https://discord.gg/abcxyz`

    ## Change HypeSquad House

    ```js
    house = 1;
    (webpackChunkdiscord_app.push([[""],{},e=>{m=[];for(let r in e.c)m.push(e.c[r])}]),m)
    .find((e=>e?.exports?.Z?.joinHypeSquadOnline)).exports.Z.joinHypeSquadOnline({houseID: "HOUSE_" + house})
    ```

    CHange the house variable:
    - 1 = Bravery
    - 2 = Brilliance
    - 3 = Balance

    ```