Updated BotCommandScopes

This commit is contained in:
Netkas 2023-02-13 20:33:55 -05:00
parent 418cdf8497
commit d4b7924358
6 changed files with 98 additions and 0 deletions

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -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;
}
}