generated from moonlight-mod/sample-extension
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5fc987b
commit 8f6eeb1
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
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" }] | ||
} | ||
}; |
This file contains 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
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 | ||
} |
This file contains 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
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; | ||
}); |