Added role mention sound effect

This commit is contained in:
skattkookie 2026-02-27 19:50:53 +00:00
parent b2ba36a765
commit 49d512b2b5
1 changed files with 10 additions and 0 deletions

View File

@ -50,6 +50,11 @@ export function injectSounds(webContents: Electron.WebContents) {
setTimeout(() => playTone(220, 0.3), 150);
}
function playMentionSound() {
playTone(1200, 0.1, 0.08);
setTimeout(() => playTone(1200, 0.15, 0.08), 120);
}
const OriginalWebSocket = window.WebSocket;
window.WebSocket = class extends OriginalWebSocket {
@ -83,6 +88,11 @@ export function injectSounds(webContents: Electron.WebContents) {
playUserLeaveSound();
}
if (data.type === "Message" && data.role_mentions?.length > 0 && data.member?.roles?.length > 0) {
const mentioned = data.role_mentions.some(roleId => data.member.roles.includes(roleId));
if (mentioned) playMentionSound();
}
} catch {}
});
}