From 4ba5878d3be36008567689040dd3b99e3ce5b322 Mon Sep 17 00:00:00 2001 From: MinusGix Date: Fri, 28 Dec 2018 10:06:00 -0600 Subject: [PATCH] Add a check for if there is a target parameter --- server/src/commands/core/whisper.js | 10 ++++++++++ 1 file changed, 10 insertions(+) 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(' ');