diff --git a/src/api/AudioPlayer.ts b/src/api/AudioPlayer.ts index d106d26b8..1e8292ab2 100644 --- a/src/api/AudioPlayer.ts +++ b/src/api/AudioPlayer.ts @@ -184,11 +184,11 @@ export function createAudioPlayer( options: AudioPlayerOptions = {} ): AudioPlayerInterface { const internalPlayer: AudioPlayerInternal = new AudioPlayerConstructor( + options, audio, null, null, - "default", - options + "default" ); return new AudioPlayerWrapper(internalPlayer); diff --git a/src/equicordplugins/_api/audioPlayer.ts b/src/equicordplugins/_api/audioPlayer.ts index 23da4a5c7..0c74c66aa 100644 --- a/src/equicordplugins/_api/audioPlayer.ts +++ b/src/equicordplugins/_api/audioPlayer.ts @@ -31,8 +31,8 @@ export default definePlugin({ // Adds an optional persistent boolean as well as a callback and error handler to the // audio player which is called after the audio finishes playing and when an error occurs. // Also processes the audio before playing to apply override functions set by plugins. - match: /(?<=constructor\(([^)]+))\)[^}]+/, - replace: ",options){$self.buildPlayer(this,options,$1);" + match: /constructor\(((?:\i,){3}\i)([^)]*)\)\{[^}]+}/, + replace: "constructor(options,$1$2){$self.buildPlayer(this,options,$1);}" }, { // Prevents an error from the source being cleared during destroyAudio(). @@ -66,6 +66,14 @@ export default definePlugin({ } ] }, + { + // Pass undefined for options in default Discord calls to the audio constructor. + find: "SoundUtils", + replacement: { + match: /return new (\i)\((.{0,50}?)(?=}function)/, + replace: "return new $1(undefined,$2" + } + }, { // Prevents Discord from forcing full volume for the "discodo" effect on client load. // The internal sounds module being loaded on startup relies on one of these calls to volume