Started work on toke logic
This commit is contained in:
parent
5fe1620c20
commit
d85f906a69
7 changed files with 160 additions and 16 deletions
|
|
@ -71,8 +71,6 @@ module.exports = class commandPreprocessor{
|
|||
async processServerCommand(){
|
||||
//If the raw message starts with '!' (skip commands that start with whitespace so people can send example commands in chat)
|
||||
if(this.rawData.msg[0] == '!'){
|
||||
//if it isn't just an exclimation point, and we have a real command
|
||||
if(this.argumentArray != null && this.commandProcessor[this.argumentArray[0].toLowerCase()] != null){
|
||||
//Create hash table to hold information about current command
|
||||
const commandObj = {
|
||||
socket: this.socket,
|
||||
|
|
@ -81,8 +79,16 @@ module.exports = class commandPreprocessor{
|
|||
rawData: this.rawData
|
||||
}
|
||||
|
||||
//Process the command and use the return value to set the sendflag (true if command valid)
|
||||
this.sendFlag = await this.commandProcessor[this.argumentArray[0].toLowerCase()](commandObj);
|
||||
//if it isn't just an exclimation point, and we have a real command
|
||||
if(this.argumentArray != null){
|
||||
if(this.commandProcessor[this.argumentArray[0].toLowerCase()] != null){
|
||||
//Process the command and use the return value to set the sendflag (true if command valid)
|
||||
this.sendFlag = await this.commandProcessor[this.argumentArray[0].toLowerCase()](commandObj);
|
||||
|
||||
}else{
|
||||
//Process as toke command if we didnt get a match from the standard server-side command processor
|
||||
this.sendFlag = await this.tokebot.tokeProcessor(commandObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -91,7 +97,7 @@ module.exports = class commandPreprocessor{
|
|||
//If the send flag is true
|
||||
if(this.sendFlag){
|
||||
//FUCKIN' SEND IT!
|
||||
this.chatHandler.relayChat(this.socket, this.commandArray.join('').trimStart());
|
||||
this.chatHandler.relayUserChat(this.socket, this.commandArray.join('').trimStart());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -108,7 +114,7 @@ class commandProcessor{
|
|||
commandObj.commandArray.splice(0,2);
|
||||
|
||||
//send it
|
||||
this.chatHandler.relayChat(commandObj.socket, commandObj.commandArray.join(''), 'whisper');
|
||||
this.chatHandler.relayUserChat(commandObj.socket, commandObj.commandArray.join(''), 'whisper');
|
||||
|
||||
//Make sure to throw the send flag
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue