Add getBotName method to entity, to facilitate retrieval.

parent 5fab2c79
...@@ -22,6 +22,7 @@ use ReflectionObject; ...@@ -22,6 +22,7 @@ use ReflectionObject;
* @link https://core.telegram.org/bots/api#available-types * @link https://core.telegram.org/bots/api#available-types
* *
* @method array getRawData() Get the raw data passed to this entity * @method array getRawData() Get the raw data passed to this entity
* @method string getBotName() Return the bot name passed to this entity
*/ */
abstract class Entity abstract class Entity
{ {
......
...@@ -182,7 +182,7 @@ class Message extends Entity ...@@ -182,7 +182,7 @@ class Message extends Entity
$split_cmd = explode('@', $cmd); $split_cmd = explode('@', $cmd);
if (isset($split_cmd[1])) { if (isset($split_cmd[1])) {
//command is followed by name check if is addressed to me //command is followed by name check if is addressed to me
if (strtolower($split_cmd[1]) === strtolower($this->bot_name)) { if (strtolower($split_cmd[1]) === strtolower($this->getBotName())) {
return $split_cmd[0]; return $split_cmd[0];
} }
} else { } else {
......
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