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