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:
parent
c23aa0657e
commit
4ba5878d3b
|
@ -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(' ');
|
||||
|
|
Loading…
Reference in New Issue
Block a user