-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
65 lines (60 loc) · 3.05 KB
/
index.js
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
const { Plugin } = require("powercord/entities");
const { inject, uninject } = require("powercord/injector");
const { getModule } = require("powercord/webpack");
function playSound(url, volume) {
const audio = new Audio();
audio.src = url;
if (volume) audio.volume = volume;
audio.play();
}
class LilSoundPlugin extends Plugin {
async startPlugin() {
const SoundPlayer = await getModule(["playSound"]);
inject("lilcord-playSound", SoundPlayer, "playSound", (e) => {
console.log(e[0]);
console.log("[DBG] " + window.location.pathname);
if (e[0] === "message1") {
playSound("https://github.com/Lemorz56/pc-lilcord/blob/main/lil-sounds/message.mp3?raw=true", e[1]);
return false;
} else if (e[0] === "unmute") {
playSound("https://github.com/Lemorz56/pc-lilcord/blob/main/lil-sounds/unmute.mp3?raw=true", e[1]);
return false;
} else if (e[0] === "mute") {
playSound("https://github.com/Lemorz56/pc-lilcord/blob/main/lil-sounds/mute.mp3?raw=true", e[1]);
return false;
} else if (e[0] === "undeafen") {
playSound("https://github.com/Lemorz56/pc-lilcord/blob/main/lil-sounds/undeafen.mp3?raw=true", e[1]);
return false;
} else if (e[0] === "deafen") {
playSound("https://github.com/Lemorz56/pc-lilcord/blob/main/lil-sounds/deafen.mp3?raw=true", e[1]);
return false;
} else if (e[0] === "user_join") {
playSound("https://github.com/Lemorz56/pc-lilcord/blob/main/lil-sounds/user_join.mp3?raw=true", e[1]);
return false;
} else if (e[0] === "user_leave") {
playSound("https://github.com/Lemorz56/pc-lilcord/blob/main/lil-sounds/user_leave.mp3?raw=true", e[1]);
return false;
} else if (e[0] === "disconnect") {
playSound("https://github.com/Lemorz56/pc-lilcord/blob/main/lil-sounds/disconnect.mp3?raw=true", e[1]);
return false;
} else if (e[0] === "stream_started") {
playSound("https://github.com/Lemorz56/pc-lilcord/blob/main/lil-sounds/stream_started.mp3?raw=true", e[1]);
return false;
} else if (e[0] === "stream_ended") {
playSound("https://github.com/Lemorz56/pc-lilcord/blob/main/lil-sounds/stream_stopped.mp3?raw=true", e[1]);
return false;
} else if (e[0] === "stream_user_joined") {
playSound("https://github.com/Lemorz56/pc-lilcord/blob/main/lil-sounds/viewer_join.mp3?raw=true", e[1]);
return false;
} else if (e[0] === "stream_user_left") {
playSound("https://github.com/Lemorz56/pc-lilcord/blob/main/lil-sounds/viewer_leave.mp3?raw=true", e[1]);
return false;
}
return e;
}, true);
}
pluginWillUnload() {
uninject("lilcord-playSound");
}
}
module.exports = LilSoundPlugin;