wavedev / Game Badge Spoofer

Last active 2 months ago

Like 0

Spoof your stats in game badge thingy.

Revision 2b44f77e8d042192994e7ab5e60c7425ce14a673

snippet.md Raw

Game Badge Spoofer

How to use

  • Crtl+shift+i to open Chrome Devtools.
  • Go to "Console"
  • type "allow pasting"
  • enter (ignore errors)
  • copy and paste the snippet
  • enter
  • profit

Snippet

const cache = {};
if (typeof DiscordNative === 'undefined')
    console.log(
        'Browser is not supported. Please use Discord client :wilted_rose:.',
    );
else {
    const req = webpackChunkdiscord_app.push([[Symbol()], {}, (r) => r]);
    webpackChunkdiscord_app.pop();
    const mods = Object.values(req.c),
        api = mods.find((x) => x?.exports?.Bo?.get).exports.Bo;
    api.get('https://discord.com/api/v10/applications/detectable')
        .then(async ({ body: apps }) => {
            while (Object.keys(cache).length < Math.min(100, apps.length)) {
                const a = apps[(Math.random() * apps.length) | 0];
                if (a?.id) cache[a.id] = a;
            }
            const ids = Object.keys(cache);
            let i = 0,
                t;
            async function spoof() {
                const s = window.__rpcSpooferState;
                if (s) {
                    s.store.getRunningGames = s.getGames;
                    s.store.getGameForPID = s.getPID;
                    s.dispatcher.dispatch({
                        type: 'RUNNING_GAMES_CHANGE',
                        removed: [s.game],
                        added: [],
                        games: [],
                    });
                    delete window.__rpcSpooferState;
                }
                if (i >= ids.length)
                    return (
                        clearInterval(t),
                        console.log(
                            'All cached applications have been spoofed.',
                        )
                    );
                try {
                    const id = ids[i],
                        { body } = await api.get({
                            url: `/applications/public?application_ids=${id}`,
                        }),
                        a = body[0];
                    if (!a)
                        return (
                            i++,
                            console.error(`Cannot fetch application ${id}`)
                        );
                    const store = mods.find(
                            (x) => x?.exports?.Ay?.getRunningGames,
                        ).exports.Ay,
                        dispatcher = mods.find(
                            (x) => x?.exports?.h?.__proto__?.flushWaitQueue,
                        ).exports.h,
                        pid = (Math.random() * 3e4 + 1e3) | 0;
                    const exe =
                        a.executables
                            ?.find((x) => x.os === 'win32')
                            ?.name?.replace('>', '') ||
                        a.name.replace(/[\/\\:*?"<>|]/g, '');
                    const game = {
                            cmdLine: `C:\\Program Files\\${a.name}\\${exe}`,
                            exeName: exe,
                            exePath: `c:/program files/${a.name.toLowerCase()}/${exe}`,
                            hidden: false,
                            isLauncher: false,
                            id,
                            name: a.name,
                            pid,
                            pidPath: [pid],
                            processName: a.name,
                            start: Date.now(),
                        },
                        real = store.getRunningGames();
                    window.__rpcSpooferState = {
                        store,
                        dispatcher,
                        game,
                        getGames: store.getRunningGames,
                        getPID: store.getGameForPID,
                    };
                    store.getRunningGames = () => [game];
                    store.getGameForPID = (p) => (p === pid ? game : void 0);
                    dispatcher.dispatch({
                        type: 'RUNNING_GAMES_CHANGE',
                        removed: real,
                        added: [game],
                        games: [game],
                    });
                    console.log(`(${++i}) Playing: ${a.name} (${id})`);
                } catch (e) {
                    console.error('Spoof error:', e);
                    i++;
                }
            }
            spoof();
            t = setInterval(spoof, ((Math.random() * 2) | 0) + 1 * 61000);
        })
        .catch(console.error);
}