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

Merge pull request #45 from MinusGix/patch-1

Add a check for if there is a target parameter in whisper
This commit is contained in:
marzavec 2018-12-28 09:06:06 -08:00 committed by GitHub
commit 02cec78ff6
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')) { if (payload.text.startsWith('/whisper')) {
let input = payload.text.split(' '); 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, ''); let target = input[1].replace(/@/g, '');
input.splice(0, 2); input.splice(0, 2);
let whisperText = input.join(' '); let whisperText = input.join(' ');