Added role mention sound effect
This commit is contained in:
parent
b2ba36a765
commit
49d512b2b5
|
|
@ -50,6 +50,11 @@ export function injectSounds(webContents: Electron.WebContents) {
|
||||||
setTimeout(() => playTone(220, 0.3), 150);
|
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;
|
const OriginalWebSocket = window.WebSocket;
|
||||||
|
|
||||||
window.WebSocket = class extends OriginalWebSocket {
|
window.WebSocket = class extends OriginalWebSocket {
|
||||||
|
|
@ -83,6 +88,11 @@ export function injectSounds(webContents: Electron.WebContents) {
|
||||||
playUserLeaveSound();
|
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 {}
|
} catch {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue