1
0
mirror of https://github.com/hack-chat/main.git synced 2024-03-22 13:20:33 +08:00

Add a check for if there is a target parameter

This commit is contained in:
MinusGix 2018-12-28 10:06:00 -06:00 committed by GitHub
parent c23aa0657e
commit 4ba5878d3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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(' ');