Correct the getText() method of the Message entity to correctly return the...

Correct the getText() method of the Message entity to correctly return the text, with and without the command.
parent e8400d66
...@@ -403,11 +403,12 @@ class Message extends Entity ...@@ -403,11 +403,12 @@ class Message extends Entity
public function getText($without_cmd = false) public function getText($without_cmd = false)
{ {
$text = $this->text; $text = $this->text;
if ($without_cmd) {
$command = $this->getFullCommand(); if ($without_cmd && $command = $this->getFullCommand()) {
if (!empty($command)) { if (strlen($command) + 1 < strlen($text)) {
//$text = substr($text, strlen($command.' '), strlen($text)); $text = substr($text, strlen($command) + 1);
$text = substr($text, strlen($command) + 1, strlen($text)); } else {
$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