aboutsummaryrefslogtreecommitdiff
path: root/webAO/client.js
diff options
context:
space:
mode:
authorsD <stoned@derpymail.org>2020-07-14 19:16:28 +0200
committersD <stoned@derpymail.org>2020-07-14 19:16:28 +0200
commit98df57731191013688a7f26f736f3d0ecf7cc750 (patch)
treebfa612a6472eb43376d02400401779bb3a743df0 /webAO/client.js
parent71e3a749d7a8de9c982e670f88eb2c08d3091565 (diff)
add function to check the words
Diffstat (limited to 'webAO/client.js')
-rw-r--r--webAO/client.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/webAO/client.js b/webAO/client.js
index d4b6bc9..e3f4d95 100644
--- a/webAO/client.js
+++ b/webAO/client.js
@@ -1647,6 +1647,8 @@ async changeBackground(position) {
appendICLog(this.chatmsg.content, displayname);
+ checkCallword(this.chatmsg.content);
+
// start checking the files
try {
const { url: speakUrl } = await this.oneSuccess([
@@ -2432,6 +2434,26 @@ function appendICLog(msg, name = "", time = new Date()) {
}
/**
+ * check if the message contains an entry on our callword list
+ * @param {String} message
+ */
+export function checkCallword(message) {
+ client.callwords.forEach(testCallword);
+
+ function testCallword(item)
+ {
+ if(item !== "" && message.includes(item))
+ {
+ viewport.sfxaudio.pause();
+ viewport.sfxaudio.src = AO_HOST + "sounds/general/sfx-gallery.wav";
+ viewport.sfxaudio.play();
+ }
+ }
+}
+
+
+
+/**
* Triggered when the music search bar is changed
* @param {MouseEvent} event
*/