Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/plugins/muteSync/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# MuteSync

Mutes a microphone when it's physically muted.

42 changes: 42 additions & 0 deletions src/plugins/muteSync/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2025 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/

import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
import { FluxDispatcher } from "@webpack/common";


export default definePlugin({
name: "MuteSync",
description: "Mutes a microphone when it's physically muted",
authors: [Devs.roli2py],
// Due to how is the `AUDIO_INPUT_DETECTED` Flux event works, we're
// patching instead of subscribing to the event
patches: [
{
find: "handleNoInput",
replacement: {
match: /(?<=\i\.emit\(\i\.\i\.Silence,!(\i)\))/,
replace: ";$self.checkInputDetection(e)",
},
},
],

// A variable to indicate that the plugin caught the initial wrong
// input detection
isInitialized: false,
checkInputDetection(inputDetected: boolean) {
if (this.isInitialized && !inputDetected) {
FluxDispatcher.dispatch({
type: "AUDIO_SET_SELF_MUTE",
context: "default",
mute: true,
playSoundEffect: true,
});
}
this.isInitialized = true;
},
});
4 changes: 4 additions & 0 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({
alfred: {
name: "alfred",
id: 1038466644353232967n
},
roli2py: {
name: "roli2py",
id: 403229667093512194n
}
} satisfies Record<string, Dev>);

Expand Down