From d98c9b95b2838f864f05a5e26b5c0ad98f67d3cb Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Mon, 30 Nov 2020 15:48:23 +0100 Subject: [PATCH] Implement commands /warn and /wall. --- static/sfu.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/static/sfu.js b/static/sfu.js index 8c82f30..0461528 100644 --- a/static/sfu.js +++ b/static/sfu.js @@ -1828,6 +1828,26 @@ commands.mute = { f: userMessage, }; +commands.warn = { + parameters: 'user message', + description: 'send a warning to a user', + predicate: operatorPredicate, + f: (c, r) => { + userMessage('warning', r); + }, +}; + +commands.wall = { + parameters: 'message', + description: 'send a warning to all users', + predicate: operatorPredicate, + f: (c, r) => { + if(!r) + throw new Error('empty message'); + serverConnection.userMessage(getUsername(), 'warning', '', r); + }, +}; + function handleInput() { let input = /** @type {HTMLTextAreaElement} */ (document.getElementById('input'));