Commit e797f65a authored by MBoretto's avatar MBoretto

[Fix] check if is a command before tock

parent 4eef4d40
...@@ -140,8 +140,11 @@ class Message extends Entity ...@@ -140,8 +140,11 @@ class Message extends Entity
//return the entire command like /echo or /echo@bot1 if specified //return the entire command like /echo or /echo@bot1 if specified
public function getFullCommand() public function getFullCommand()
{ {
if (substr($this->text, 0, 1) === '/') {
return strtok($this->text, ' '); return strtok($this->text, ' ');
}else{
return null;
}
} }
public function getCommand() public function getCommand()
...@@ -248,8 +251,10 @@ class Message extends Entity ...@@ -248,8 +251,10 @@ class Message extends Entity
$text = $this->text; $text = $this->text;
if ($without_cmd) { if ($without_cmd) {
$command = $this->getFullCommand(); $command = $this->getFullCommand();
if(!empty($command)){
$text = substr($text, strlen($command . ' '), strlen($text)); $text = substr($text, strlen($command . ' '), strlen($text));
} }
}
return $text; return $text;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment