Created
March 6, 2025 12:59
-
-
Save MCausc78/9eda7792183ac02dfbd475885910bad4 to your computer and use it in GitHub Desktop.
Forcefully reload application command cache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
let wp; | |
webpackChunkdiscord_app.push([[Symbol()], {}, r => wp = r]); | |
webpackChunkdiscord_app.pop(); | |
let Dispatcher, GuildStore; | |
for (const m of Object.values(wp.c)) { | |
if (Dispatcher !== undefined && GuildStore !== undefined) break; | |
if (!m.exports || m.exports === window) continue; | |
for (const p of Object.values(m.exports)) { | |
if (Dispatcher !== undefined && GuildStore !== undefined) break; | |
if (p?.getGuildIds && p?.getRoles && GuildStore === undefined) { | |
GuildStore = p; | |
} else if (p?._dispatchWithDevtools && Dispatcher === undefined) { | |
Dispatcher = p; | |
} | |
} | |
} | |
// Invalidate user application command index. | |
Dispatcher.dispatch({ | |
type: 'USER_APPLICATION_UPDATE', | |
applicationId: '0', | |
}); | |
// Invalidate application command index for all guilds. | |
for (const guildId of GuildStore.getGuildIds()) { | |
Dispatcher.dispatch({ | |
type: 'GUILD_APPLICATION_COMMAND_INDEX_UPDATE', | |
guildId, | |
version: Date.now(), | |
}); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment