This commit is contained in:
Mirco Wittrien 2022-03-09 09:39:03 +01:00
parent 4b7062dd48
commit 111903faa0
2 changed files with 47 additions and 38 deletions

View File

@ -1273,6 +1273,8 @@
"GuildSettingsEmoji": {"props": ["emojiRow", "emojiAliasPlaceholder"]},
"GuildSettingsInvite": {"props": ["countdownColumn", "inviteSettingsInviteRow"]},
"GuildSettingsMember": {"props": ["member", "membersFilterPopout"]},
"GuildsInbox": {"props": ["listItemWrapper", "listItemTooltip"]},
"GuildsInboxIcon": {"props": ["iconButton", "selected"]},
"GuildsItems": {"props": ["circleIcon", "guildsError"]},
"GuildsWrapper": {"props": ["scroller", "unreadMentionsBar", "wrapper"]},
"HeaderBar": {"props": ["container", "children", "toolbar"]},

View File

@ -2,7 +2,7 @@
* @name NotificationSounds
* @author DevilBro
* @authorId 278543574059057154
* @version 3.6.6
* @version 3.6.7
* @description Allows you to replace the native Sounds with custom Sounds
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,8 +17,13 @@ module.exports = (_ => {
"info": {
"name": "NotificationSounds",
"author": "DevilBro",
"version": "3.6.6",
"version": "3.6.7",
"description": "Allows you to replace the native Sounds with custom Sounds"
},
"changeLog": {
"fixed": {
"Message Notifications": "No longer plays them for every message or for no messages if desktop notifications are enabled"
}
}
};
@ -180,7 +185,7 @@ module.exports = (_ => {
name: name,
src: src,
mute: id.startsWith("call_") ? null : false,
force: null,
force: id == "message1" ? false : null,
focus: id == "message1" ? true : false
};
if (id == "message1") {
@ -235,44 +240,46 @@ module.exports = (_ => {
this.playAudio(isGroupDM ? "groupdm" : "dm");
return;
}
else if (BDFDB.LibraryModules.MentionUtils.isRawMessageMentioned(message, BDFDB.UserUtils.me.id)) {
if (message.mentions.length && !this.isSuppressMentionEnabled(guildId, message.channel_id)) for (const mention of message.mentions) if (mention.id == BDFDB.UserUtils.me.id) {
if (message.message_reference && (!muted || choices.reply.force) && !(choices.reply.focus && focused)) {
this.fireEvent("reply");
this.playAudio("reply");
return;
else if (guildId) {
if (BDFDB.LibraryModules.MentionUtils.isRawMessageMentioned(message, BDFDB.UserUtils.me.id)) {
if (message.mentions.length && !this.isSuppressMentionsEnabled(guildId, message.channel_id)) for (const mention of message.mentions) if (mention.id == BDFDB.UserUtils.me.id) {
if (message.message_reference && (!muted || choices.reply.force) && !(choices.reply.focus && focused)) {
this.fireEvent("reply");
this.playAudio("reply");
return;
}
if (!message.message_reference && (!muted || choices.mentioned.force) && !(choices.mentioned.focus && focused)) {
this.fireEvent("mentioned");
this.playAudio("mentioned");
return;
}
}
if (!message.message_reference && (!muted || choices.mentioned.force) && !(choices.mentioned.focus && focused)) {
this.fireEvent("mentioned");
this.playAudio("mentioned");
return;
if (message.mention_roles.length && !BDFDB.LibraryModules.MutedUtils.isSuppressRolesEnabled(guildId, message.channel_id) && (!muted || choices.role.force) && !(choices.role.focus && focused)) {
const member = BDFDB.LibraryModules.MemberStore.getMember(guildId, BDFDB.UserUtils.me.id);
if (member && member.roles.length) for (const roleId of message.mention_roles) if (member.roles.includes(roleId)) {
this.fireEvent("role");
this.playAudio("role");
return;
}
}
if (message.mention_everyone && !BDFDB.LibraryModules.MutedUtils.isSuppressEveryoneEnabled(guildId, message.channel_id)) {
if (message.content.indexOf("@everyone") > -1 && (!muted || choices.everyone.force) && !(choices.everyone.focus && focused)) {
this.fireEvent("everyone");
this.playAudio("everyone");
return;
}
if (message.content.indexOf("@here") > -1 && (!muted || choices.here.force) && !(choices.here.focus && focused)) {
this.fireEvent("here");
this.playAudio("here");
return;
}
}
}
if (guildId && message.mention_roles.length && !BDFDB.LibraryModules.MutedUtils.isSuppressRolesEnabled(guildId, message.channel_id) && (!muted || choices.role.force) && !(choices.role.focus && focused)) {
const member = BDFDB.LibraryModules.MemberStore.getMember(guildId, BDFDB.UserUtils.me.id);
if (member && member.roles.length) for (const roleId of message.mention_roles) if (member.roles.includes(roleId)) {
this.fireEvent("role");
this.playAudio("role");
return;
}
if (BDFDB.LibraryModules.MutedUtils.allowAllMessages(BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id)) && (!muted || choices.message1.force) && !(choices.message1.focus && focused)) {
this.fireEvent("message1");
this.playAudio("message1");
return;
}
if (message.mention_everyone && !BDFDB.LibraryModules.MutedUtils.isSuppressEveryoneEnabled(guildId, message.channel_id)) {
if (message.content.indexOf("@everyone") > -1 && (!muted || choices.everyone.force) && !(choices.everyone.focus && focused)) {
this.fireEvent("everyone");
this.playAudio("everyone");
return;
}
if (message.content.indexOf("@here") > -1 && (!muted || choices.here.force) && !(choices.here.focus && focused)) {
this.fireEvent("here");
this.playAudio("here");
return;
}
}
}
else if (false && guildId && !muted && !(choices.message1.focus && focused)) {
this.fireEvent("message1");
this.playAudio("message1");
return;
}
}
}
@ -721,7 +728,7 @@ module.exports = (_ => {
createdAudios[type].play();
}
isSuppressMentionEnabled (guildId, channelId) {
isSuppressMentionsEnabled (guildId, channelId) {
let channelSettings = BDFDB.LibraryModules.MutedUtils.getChannelMessageNotifications(guildId, channelId);
return channelSettings && (channelSettings == BDFDB.DiscordConstants.UserNotificationSettings.NO_MESSAGES || channelSettings == BDFDB.DiscordConstants.UserNotificationSettings.NULL && BDFDB.LibraryModules.MutedUtils.getMessageNotifications(guildId) == BDFDB.DiscordConstants.UserNotificationSettings.NO_MESSAGES);
}