Update NotificationSounds.plugin.js

This commit is contained in:
Mirco Wittrien 2023-07-11 08:59:43 +02:00
parent 8dc30b0bc9
commit 42210ecff5
1 changed files with 12 additions and 2 deletions

View File

@ -2,7 +2,7 @@
* @name NotificationSounds
* @author DevilBro
* @authorId 278543574059057154
* @version 3.8.0
* @version 3.8.1
* @description Allows you to replace the native Sounds with custom Sounds
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -76,6 +76,16 @@ module.exports = (_ => {
here: {src: "./mention3.mp3", name: "Message Mentioned (@here)", force: false, focus: true}
};
const namePrefixes = {
"user_join": "Voice Channel",
"user_leave": "Voice Channel",
"user_moved": "Voice Channel"
};
const nameSynonymes = {
"reconnect": "Invited To Speak"
};
const defaultAudios = {
"---": {
"---": null
@ -163,7 +173,7 @@ module.exports = (_ => {
const soundKeys = BDFDB.LibraryModules.SoundParser.keys();
for (let key of soundKeys) {
const id = key.replace("./", "").replace(".mp3", "");
const name = id == "reconnect" ? "Invited To Speak" : id.replace("ddr-", "HotKeys_").replace("ptt_", "Push2Talk_").split("_").map(BDFDB.StringUtils.upperCaseFirstChar).join(" ").replace(/1$/g, "");
const name = [namePrefixes[id], (nameSynonymes[id] || id).replace("ddr-", "HotKeys_").replace("ptt_", "Push2Talk_").split(/[_-]/)].flat(10).filter(n => n).map(BDFDB.StringUtils.upperCaseFirstChar).join(" ").replace(/1$/g, "");
const src = BDFDB.LibraryModules.SoundParser(key);
let soundPackName = id.split("_")[0];