From 7c513420c3e702a13eed7d45355e84bde615e3ff Mon Sep 17 00:00:00 2001 From: Netkas Date: Mon, 13 Feb 2023 20:34:11 -0500 Subject: [PATCH] Added \TgBotLib\Objects > BotCommandScope --- src/TgBotLib/Objects/BotCommandScope.php | 87 ++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 src/TgBotLib/Objects/BotCommandScope.php diff --git a/src/TgBotLib/Objects/BotCommandScope.php b/src/TgBotLib/Objects/BotCommandScope.php new file mode 100644 index 0000000..cdb751b --- /dev/null +++ b/src/TgBotLib/Objects/BotCommandScope.php @@ -0,0 +1,87 @@ +type; + } + + /** + * Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) + * + * @return int|string|null + */ + public function getChatId(): int|string|null + { + return $this->chat_id; + } + + /** + * Unique identifier of the target user + * + * @return int|null + */ + public function getUserId(): ?int + { + return $this->user_id; + } + + /** + * Returns an array representation of the object + * + * @return array + */ + public function toArray(): array + { + return [ + 'type' => $this->type, + 'chat_id' => $this->chat_id, + 'user_id' => $this->user_id, + ]; + } + + /** + * Constructs object from an array representation + * + * @param array $data + * @return ObjectTypeInterface + */ + public static function fromArray(array $data): ObjectTypeInterface + { + $object = new self(); + + $object->type = $data['type']; + $object->chat_id = $data['chat_id'] ?? null; + $object->user_id = $data['user_id'] ?? null; + + return $object; + } + } \ No newline at end of file