diff --git a/src/TgBotLib/Objects/BotCommandScope/BotCommandScopeAllChatAdministrators.php b/src/TgBotLib/Objects/BotCommandScope/BotCommandScopeAllChatAdministrators.php index 5e4ad27..36e66f8 100644 --- a/src/TgBotLib/Objects/BotCommandScope/BotCommandScopeAllChatAdministrators.php +++ b/src/TgBotLib/Objects/BotCommandScope/BotCommandScopeAllChatAdministrators.php @@ -5,6 +5,7 @@ namespace TgBotLib\Objects\BotCommandScope; use TgBotLib\Interfaces\ObjectTypeInterface; + use TgBotLib\Objects\BotCommandScope; class BotCommandScopeAllChatAdministrators implements ObjectTypeInterface { @@ -64,4 +65,18 @@ $object->chat_id = $data['chat_id']; return $object; } + + /** + * Constructs object from BotCommandScope + * + * @param BotCommandScope $botCommandScope + * @return static + */ + public static function fromBotCommandScope(BotCommandScope $botCommandScope): self + { + $object = new self(); + $object->type = $botCommandScope->getType(); + $object->chat_id = $botCommandScope->getChatId(); + return $object; + } } \ No newline at end of file diff --git a/src/TgBotLib/Objects/BotCommandScope/BotCommandScopeAllGroupChats.php b/src/TgBotLib/Objects/BotCommandScope/BotCommandScopeAllGroupChats.php index d50d78b..273c8a9 100644 --- a/src/TgBotLib/Objects/BotCommandScope/BotCommandScopeAllGroupChats.php +++ b/src/TgBotLib/Objects/BotCommandScope/BotCommandScopeAllGroupChats.php @@ -5,6 +5,7 @@ namespace TgBotLib\Objects\BotCommandScope; use TgBotLib\Interfaces\ObjectTypeInterface; + use TgBotLib\Objects\BotCommandScope; class BotCommandScopeAllGroupChats implements ObjectTypeInterface { @@ -49,4 +50,19 @@ return $object; } + + /** + * Constructs object from BotCommandScope + * + * @param BotCommandScope $botCommandScope + * @return BotCommandScopeAllGroupChats + */ + public static function fromBotCommandScope(BotCommandScope $botCommandScope): BotCommandScopeAllGroupChats + { + $object = new self(); + + $object->type = $botCommandScope->getType(); + + return $object; + } } \ No newline at end of file diff --git a/src/TgBotLib/Objects/BotCommandScope/BotCommandScopeAllPrivateChats.php b/src/TgBotLib/Objects/BotCommandScope/BotCommandScopeAllPrivateChats.php index 9feea4b..9e1f882 100644 --- a/src/TgBotLib/Objects/BotCommandScope/BotCommandScopeAllPrivateChats.php +++ b/src/TgBotLib/Objects/BotCommandScope/BotCommandScopeAllPrivateChats.php @@ -5,6 +5,7 @@ namespace TgBotLib\Objects\BotCommandScope; use TgBotLib\Interfaces\ObjectTypeInterface; + use TgBotLib\Objects\BotCommandScope; class BotCommandScopeAllPrivateChats implements ObjectTypeInterface { @@ -49,4 +50,20 @@ return $object; } + + /** + * Constructs object from BotCommandScope + * + * @param BotCommandScope $botCommandScope + * @return BotCommandScopeAllPrivateChats + */ + public static function fromBotCommandScope(BotCommandScope $botCommandScope): BotCommandScopeAllPrivateChats + { + $object = new self(); + + $object->type = $botCommandScope->getType(); + + return $object; + } + } \ No newline at end of file diff --git a/src/TgBotLib/Objects/BotCommandScope/BotCommandScopeChat.php b/src/TgBotLib/Objects/BotCommandScope/BotCommandScopeChat.php index 5447210..8732974 100644 --- a/src/TgBotLib/Objects/BotCommandScope/BotCommandScopeChat.php +++ b/src/TgBotLib/Objects/BotCommandScope/BotCommandScopeChat.php @@ -5,6 +5,7 @@ namespace TgBotLib\Objects\BotCommandScope; use TgBotLib\Interfaces\ObjectTypeInterface; + use TgBotLib\Objects\BotCommandScope; class BotCommandScopeChat implements ObjectTypeInterface { @@ -66,4 +67,21 @@ return $object; } + + /** + * Constructs object from BotCommandScope + * + * @param BotCommandScope $botCommandScope + * @return static + */ + public static function fromBotCommandScope(BotCommandScope $botCommandScope): self + { + $object = new self(); + + $object->type = $botCommandScope->getType(); + $object->chat_id = $botCommandScope->getChatId(); + + return $object; + } + } \ No newline at end of file diff --git a/src/TgBotLib/Objects/BotCommandScope/BotCommandScopeChatAdministrators.php b/src/TgBotLib/Objects/BotCommandScope/BotCommandScopeChatAdministrators.php index a1b5270..e214c27 100644 --- a/src/TgBotLib/Objects/BotCommandScope/BotCommandScopeChatAdministrators.php +++ b/src/TgBotLib/Objects/BotCommandScope/BotCommandScopeChatAdministrators.php @@ -5,6 +5,7 @@ namespace TgBotLib\Objects\BotCommandScope; use TgBotLib\Interfaces\ObjectTypeInterface; + use TgBotLib\Objects\BotCommandScope; class BotCommandScopeChatAdministrators implements ObjectTypeInterface { @@ -49,4 +50,19 @@ return $object; } + + /** + * Constructs object from BotCommandScope + * + * @param BotCommandScope $botCommandScope + * @return BotCommandScopeChatAdministrators + */ + public static function fromBotCommandScope(BotCommandScope $botCommandScope): BotCommandScopeChatAdministrators + { + $object = new self(); + + $object->type = $botCommandScope->getType(); + + return $object; + } } \ No newline at end of file diff --git a/src/TgBotLib/Objects/BotCommandScope/BotCommandScopeChatMember.php b/src/TgBotLib/Objects/BotCommandScope/BotCommandScopeChatMember.php index 2b71434..fb5f6d2 100644 --- a/src/TgBotLib/Objects/BotCommandScope/BotCommandScopeChatMember.php +++ b/src/TgBotLib/Objects/BotCommandScope/BotCommandScopeChatMember.php @@ -5,6 +5,7 @@ namespace TgBotLib\Objects\BotCommandScope; use TgBotLib\Interfaces\ObjectTypeInterface; + use TgBotLib\Objects\BotCommandScope; class BotCommandScopeChatMember implements ObjectTypeInterface { @@ -81,4 +82,19 @@ $object->user_id = $data['user_id']; return $object; } + + /** + * Constructs object from BotCommandScope + * + * @param BotCommandScope $botCommandScope + * @return static + */ + public static function fromBotCommandScope(BotCommandScope $botCommandScope): self + { + $object = new self(); + $object->type = $botCommandScope->getType(); + $object->chat_id = $botCommandScope->getChatId(); + $object->user_id = $botCommandScope->getUserId(); + return $object; + } } \ No newline at end of file