Skip to content

Instantly share code, notes, and snippets.

@sneksnake
Last active May 20, 2024 16:44
Show Gist options
  • Save sneksnake/08166875e98741e881e4614a69938870 to your computer and use it in GitHub Desktop.
Save sneksnake/08166875e98741e881e4614a69938870 to your computer and use it in GitHub Desktop.
[Vencord] Use fakevoiceoptions command to toggle fake mute & deafen
import definePlugin, { OptionType } from "@utils/types";
export default definePlugin({
name: "Fake Voice Options",
description: "fake mute & deafen",
authors: [{
name: "SaucyDuck",
id: 1004904120056029256n
}],
patches: [
{
find: "e.setSelfMute(n)",
replacement: [{
// prevent client-side mute
match: /e\.setSelfMute\(n\),/g,
replace: 'e.setSelfMute(Vencord.Settings.plugins["Fake Voice Options"].fakeMute?false:n),'
},
{
// prevent client-side deafen
match: /e\.setSelfDeaf\(t\.deaf\)/g,
replace: 'e.setSelfDeaf(Vencord.Settings.plugins["Fake Voice Options"].fakeDeafen?false:t.deaf)'
}]
},
],
options: {
fakeMute: {
description: "Make everyone believe you're muted (you can still speak)",
type: OptionType.BOOLEAN,
default: false,
},
fakeDeafen: {
description: "Make everyone believe you're deafened (you can still hear)",
type: OptionType.BOOLEAN,
default: false,
},
},
});
@Troopica1
Copy link

Oh yeah, I ended up getting it to work, but the fake deafen itself doesn’t work. There’s one that works which I can send u if u want.

@Troopica1
Copy link

By getting it to work I mean building it.

@Wikinger8
Copy link

Wikinger8 commented Dec 18, 2023

In the end it will look like that:
image

image
create the "fakeVoiceOption" folder and paste in these things

index.tsx

import { disableStyle, enableStyle } from "@api/Styles";
import ErrorBoundary from "@components/ErrorBoundary";
import definePlugin from "@utils/types";
import { findByCodeLazy } from "@webpack";

import { settings } from "./settings";
import style from "./style.css?managed";

const Button = findByCodeLazy("Button.Sizes.NONE,disabled:");

function makeIcon(enabled?: boolean) {
    return function () {
        return (
            <svg
                xmlns="http://www.w3.org/2000/svg"
                width="19"
                height="19"
                viewBox="0 0 512 512"
            >
                <path fill="currentColor" d="M256 48C141.1 48 48 141.1 48 256v40c0 13.3-10.7 24-24 24s-24-10.7-24-24V256C0 114.6 114.6 0 256 0S512 114.6 512 256V400.1c0 48.6-39.4 88-88.1 88L313.6 488c-8.3 14.3-23.8 24-41.6 24H240c-26.5 0-48-21.5-48-48s21.5-48 48-48h32c17.8 0 33.3 9.7 41.6 24l110.4 .1c22.1 0 40-17.9 40-40V256c0-114.9-93.1-208-208-208zM144 208h16c17.7 0 32 14.3 32 32V352c0 17.7-14.3 32-32 32H144c-35.3 0-64-28.7-64-64V272c0-35.3 28.7-64 64-64zm224 0c35.3 0 64 28.7 64 64v48c0 35.3-28.7 64-64 64H352c-17.7 0-32-14.3-32-32V240c0-17.7 14.3-32 32-32h16z"/>
                {!enabled &&
                    <line
                        x1="495"
                        y1="10"
                        x2="10"
                        y2="464"
                        stroke="var(--status-danger)"
                        strokeWidth="40"
                    />
                }
            </svg>
        );
    };
}

function FakeVoiceOptionToggleButton() {
    const FakeMuteEnabled = settings.use(["fakeMute"]).fakeMute;
    const FakeDeafenEnabled = settings.use(["fakeDeafen"]).fakeDeafen;
    const Enabled = FakeDeafenEnabled && FakeMuteEnabled;

    return (
        <div className="button-container">
            <Button
                tooltipText={Enabled ? "Disable Fake/Deafen Mute" : "Enable Fake/Deafen Mute"}
                icon={makeIcon(Enabled)}
                role="switch"
                aria-checked={!Enabled}
                onClick={() => {
                    settings.store.fakeDeafen = !Enabled;
                    settings.store.fakeMute = !Enabled;
                }}
            />
        </div>
    );
}


export default definePlugin({
    name: "Fake Voice Options",
    description: "fake mute & deafen",
    authors: [{
        name: "Wikinger8",
        id: 387168065273593878n,
    }],
    patches: [
        {
            find: ".Messages.ACCOUNT_SPEAKING_WHILE_MUTED",
            replacement: {
                match: /this\.renderNameZone\(\).+?children:\[/,
                replace: "$&$self.FakeVoiceOptionToggleButton(),"
            }
        },
        {
            find: "e.setSelfMute(n);",
            replacement: [{
                // prevent client-side mute
                match: /e\.setSelfMute\(n\);/g,
                replace: "e.setSelfMute(Vencord.Settings.plugins[\"Fake Voice Options\"].fakeMute?false:n);"
            },
            {
                // prevent client-side deafen
                match: /e\.setSelfDeaf\(t\.deaf\)/g,
                replace: "e.setSelfDeaf(Vencord.Settings.plugins[\"Fake Voice Options\"].fakeDeafen?false:t.deaf);"
            }]
        },
    ],
    FakeVoiceOptionToggleButton: ErrorBoundary.wrap(FakeVoiceOptionToggleButton, { noop: true }),
    settings,

    start() {
        enableStyle(style);
    },

    stop() {
        disableStyle(style);
    }
});

settings.ts

import { definePluginSettings } from "@api/Settings";
import { OptionType } from "@utils/types";

export const settings = definePluginSettings({
    fakeMute: {
        description: "Make everyone believe you're muted (you can still speak)",
        type: OptionType.BOOLEAN,
        default: false,
    },
    fakeDeafen: {
        description: "Make everyone believe you're deafened (you can still hear) gtxs 2",
        type: OptionType.BOOLEAN,
        default: false,
    },
});

style.css

[class*="withTagAsButton"] {
    min-width: 88px;
}

[class*="container-YkUktl"] div:nth-child(2) {
    flex-wrap: wrap;
}

[class="container-YkUktl"] {
    height: 69px;
}

.button-container {
    margin-left: -18px; 
}

@Ex0nl
Copy link

Ex0nl commented Dec 18, 2023

alright thanks

@Ex0nl
Copy link

Ex0nl commented Dec 18, 2023

Sieht nice aus. Werde morgen mal mit Freunden testen. Aber danke

@aydynx
Copy link

aydynx commented Jan 4, 2024

In the end it will look like that: image

image create the "fakeVoiceOption" folder and paste in these things

index.tsx

import { disableStyle, enableStyle } from "@api/Styles";
import ErrorBoundary from "@components/ErrorBoundary";
import definePlugin from "@utils/types";
import { findByCodeLazy } from "@webpack";

import { settings } from "./settings";
import style from "./style.css?managed";

const Button = findByCodeLazy("Button.Sizes.NONE,disabled:");

function makeIcon(enabled?: boolean) {
    return function () {
        return (
            <svg
                xmlns="http://www.w3.org/2000/svg"
                width="19"
                height="19"
                viewBox="0 0 512 512"
            >
                <path fill="currentColor" d="M256 48C141.1 48 48 141.1 48 256v40c0 13.3-10.7 24-24 24s-24-10.7-24-24V256C0 114.6 114.6 0 256 0S512 114.6 512 256V400.1c0 48.6-39.4 88-88.1 88L313.6 488c-8.3 14.3-23.8 24-41.6 24H240c-26.5 0-48-21.5-48-48s21.5-48 48-48h32c17.8 0 33.3 9.7 41.6 24l110.4 .1c22.1 0 40-17.9 40-40V256c0-114.9-93.1-208-208-208zM144 208h16c17.7 0 32 14.3 32 32V352c0 17.7-14.3 32-32 32H144c-35.3 0-64-28.7-64-64V272c0-35.3 28.7-64 64-64zm224 0c35.3 0 64 28.7 64 64v48c0 35.3-28.7 64-64 64H352c-17.7 0-32-14.3-32-32V240c0-17.7 14.3-32 32-32h16z"/>
                {!enabled &&
                    <line
                        x1="495"
                        y1="10"
                        x2="10"
                        y2="464"
                        stroke="var(--status-danger)"
                        strokeWidth="40"
                    />
                }
            </svg>
        );
    };
}

function FakeVoiceOptionToggleButton() {
    const FakeMuteEnabled = settings.use(["fakeMute"]).fakeMute;
    const FakeDeafenEnabled = settings.use(["fakeDeafen"]).fakeDeafen;
    const Enabled = FakeDeafenEnabled && FakeMuteEnabled;

    return (
        <div className="button-container">
            <Button
                tooltipText={Enabled ? "Disable Fake/Deafen Mute" : "Enable Fake/Deafen Mute"}
                icon={makeIcon(Enabled)}
                role="switch"
                aria-checked={!Enabled}
                onClick={() => {
                    settings.store.fakeDeafen = !Enabled;
                    settings.store.fakeMute = !Enabled;
                }}
            />
        </div>
    );
}


export default definePlugin({
    name: "Fake Voice Options",
    description: "fake mute & deafen",
    authors: [{
        name: "Wikinger8",
        id: 387168065273593878n,
    }],
    patches: [
        {
            find: ".Messages.ACCOUNT_SPEAKING_WHILE_MUTED",
            replacement: {
                match: /this\.renderNameZone\(\).+?children:\[/,
                replace: "$&$self.FakeVoiceOptionToggleButton(),"
            }
        },
        {
            find: "e.setSelfMute(n);",
            replacement: [{
                // prevent client-side mute
                match: /e\.setSelfMute\(n\);/g,
                replace: "e.setSelfMute(Vencord.Settings.plugins[\"Fake Voice Options\"].fakeMute?false:n);"
            },
            {
                // prevent client-side deafen
                match: /e\.setSelfDeaf\(t\.deaf\)/g,
                replace: "e.setSelfDeaf(Vencord.Settings.plugins[\"Fake Voice Options\"].fakeDeafen?false:t.deaf);"
            }]
        },
    ],
    FakeVoiceOptionToggleButton: ErrorBoundary.wrap(FakeVoiceOptionToggleButton, { noop: true }),
    settings,

    start() {
        enableStyle(style);
    },

    stop() {
        disableStyle(style);
    }
});

settings.ts

import { definePluginSettings } from "@api/Settings";
import { OptionType } from "@utils/types";

export const settings = definePluginSettings({
    fakeMute: {
        description: "Make everyone believe you're muted (you can still speak)",
        type: OptionType.BOOLEAN,
        default: false,
    },
    fakeDeafen: {
        description: "Make everyone believe you're deafened (you can still hear) gtxs 2",
        type: OptionType.BOOLEAN,
        default: false,
    },
});

style.css

[class*="withTagAsButton"] {
    min-width: 88px;
}

[class*="container-YkUktl"] div:nth-child(2) {
    flex-wrap: wrap;
}

[class="container-YkUktl"] {
    height: 69px;
}

.button-container {
    margin-left: -18px; 
}

hey, this builds fine, but it doesnt show im deafened in the vc

@sneksnake
Copy link
Author

Hello, i just saw all the replies on my gist.
Didn't knew so many peoples would use it, so i updated it for the new discord update ( they just changed a few shit that broke the regexs )

Also you can toggle the options by going to the plugin settings :
fakevoice

@LeonMaximal1
Copy link

where put this code ? idk sorry for this questions
Maybe have one tutorial ?

@SethDusek
Copy link

does this still work? I downloaded the plugin but it doesn't show me as deafened to other users

@Wikinger8
Copy link

does this still work? I downloaded the plugin but it doesn't show me as deafened to other users

https://www.youtube.com/watch?v=WR7AF1_pmd0

This works

@Troopica1
Copy link

does this still work? I downloaded the plugin but it doesn't show me as deafened to other users

https://www.youtube.com/watch?v=WR7AF1_pmd0

This works

Yeah i was the one who told that guy to make a vid about it - not to flex but yk... 🗣️🔥🧏‍♂️🥩🥩😈

@Wikinger8
Copy link

does this still work? I downloaded the plugin but it doesn't show me as deafened to other users

https://www.youtube.com/watch?v=WR7AF1_pmd0
This works

Yeah i was the one who told that guy to make a vid about it - not to flex but yk... 🗣️🔥🧏‍♂️🥩🥩😈

Then tell him that the button is too big

@omarelghonemy
Copy link

i build this code and didnt run why?

@BasedDrainer
Copy link

stopped working, any fix?

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