-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLightcordStereo.plugin.js
More file actions
49 lines (41 loc) · 1.6 KB
/
LightcordStereo.plugin.js
File metadata and controls
49 lines (41 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
* @name LightcordStereo
* @description Stereo Plugin for BD
* @version 1.0.0
* @author skenzo
* @authorId 842214916135976981
* @invite discord.gg/lightcord
* @website https://www.youtube.com/channel/UCHcAFxh0nWGDVv-TOqxgDRQ
*/
module.exports = class LightcordStereo {
constructor() {
this.voiceModule = null;
}
start() {
this.voiceModule = BdApi.Webpack.getModule(m => m.prototype && "setLocalVolume" in m.prototype);
if (!this.voiceModule) return;
BdApi.Patcher.before("LightcordStereo", this.voiceModule.prototype, "setLocalVolume", (thisObj) => {
if (!thisObj || !thisObj.conn || !thisObj.conn.setTransportOptions) return;
const conn = thisObj.conn;
const setTransportOptions = conn.setTransportOptions.bind(conn);
conn.setTransportOptions = (options) => {
if (!options || typeof options !== "object") return setTransportOptions(options);
Object.assign(options, {
audioEncoder: {
...options.audioEncoder,
channels: 2,
freq: 48000,
rate: 512000,
pacsize: 960,
},
packetLossRate: 0,
encodingBitRate: 512000,
});
setTransportOptions(options);
};
});
}
stop() {
BdApi.Patcher.unpatchAll("LightcordStereo");
}
};