Modified commandPreprocessor to be easily shared between chat.js and pmHandler.js

This commit is contained in:
rainbow napkin 2025-10-01 20:38:16 -04:00
parent d465863ee6
commit b26dd1094c
2 changed files with 23 additions and 11 deletions

View file

@ -73,13 +73,19 @@ class commandPreprocessor{
if(this.sendFlag){
//Set the message to the command
this.message = command;
//Process message emotes into links
this.processEmotes();
//Process unmarked links into marked links
this.processLinks();
//Send command off to server
this.sendRemoteCommand();
//Return pre-processed message data
return {msg: this.message, links: this.links};
}
//Return false for bad message/command on fall-through
return false;
}
/**
@ -150,13 +156,6 @@ class commandPreprocessor{
this.message = splitMessage.join('');
}
/**
* Transmits message/command off to server
*/
sendRemoteCommand(){
this.client.socket.emit("chatMessage",{msg: this.message, links: this.links});
}
/**
* Sets site emotes
* @param {Object} data - Emote data from server