Skip to content

Commit

Permalink
Voice State Suppressor
Browse files Browse the repository at this point in the history
  • Loading branch information
Cynosphere committed Feb 5, 2025
1 parent 5fc987b commit 8f6eeb1
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/voiceStateSuppressor/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { ExtensionWebpackModule } from "@moonlight-mod/types";

export const webpackModules: Record<string, ExtensionWebpackModule> = {
suppressor: {
entrypoint: true,
dependencies: [{ id: "discord/Dispatcher" }]
}
};
21 changes: 21 additions & 0 deletions src/voiceStateSuppressor/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://moonlight-mod.github.io/manifest.schema.json",
"id": "voiceStateSuppressor",
"version": "1.0.0",
"meta": {
"name": "Voice State Suppressor",
"tagline": "Drop all voice states of a guild. Useful for large guilds.",
"authors": ["Cynosphere"],
"tags": ["voice", "fixes"],
"source": "https://github.com/Cynosphere/moonlight-extensions",
"donate": "https://ko-fi.com/Cynosphere"
},
"settings": {
"ids": {
"displayName": "Guild IDs",
"type": "list",
"advice": "reload"
}
},
"apiLevel": 2
}
12 changes: 12 additions & 0 deletions src/voiceStateSuppressor/webpackModules/suppressor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Dispatcher from "@moonlight-mod/wp/discord/Dispatcher";

Dispatcher.addInterceptor((event) => {
if (event.type !== "VOICE_STATE_UPDATES") return false;
const ids = moonlight.getConfigOption<string[]>("voiceStateSuppressor", "ids") ?? [];

event.voiceStates = event.voiceStates.filter((state: { guildId: string }) => !ids.includes(state.guildId));

if (event.voiceStates.length === 0) return true;

return false;
});

0 comments on commit 8f6eeb1

Please sign in to comment.