aboutsummaryrefslogtreecommitdiffstats
path: root/server/src
diff options
context:
space:
mode:
authormarzavec <admin@marzavec.com>2018-12-28 18:06:06 +0100
committerGitHub <noreply@github.com>2018-12-28 18:06:06 +0100
commit02cec78ff678cf10909c0a1baa83d39b3af739d7 (patch)
treefdfc9168bc649596b2dc63676b3ffb4966910865 /server/src
parentfix issue #42 (diff)
parentAdd a check for if there is a target parameter (diff)
downloadhackchat-02cec78ff678cf10909c0a1baa83d39b3af739d7.tar.gz
hackchat-02cec78ff678cf10909c0a1baa83d39b3af739d7.zip
Merge pull request #45 from MinusGix/patch-1
Add a check for if there is a target parameter in whisper
Diffstat (limited to 'server/src')
-rw-r--r--server/src/commands/core/whisper.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/server/src/commands/core/whisper.js b/server/src/commands/core/whisper.js
index e089b45..7173ae9 100644
--- a/server/src/commands/core/whisper.js
+++ b/server/src/commands/core/whisper.js
@@ -85,6 +85,16 @@ exports.whisperCheck = (core, server, socket, payload) => {
if (payload.text.startsWith('/whisper')) {
let input = payload.text.split(' ');
+ // If there is no nickname target parameter
+ if (input[1] === undefined) {
+ server.reply({
+ cmd: 'warn',
+ text: 'Refer to `/help whisper` for instructions on how to use this command.'
+ }, socket);
+
+ return false;
+ }
+
let target = input[1].replace(/@/g, '');
input.splice(0, 2);
let whisperText = input.join(' ');