Added the ability to get the current bot description in the given language as the class [BotDescription](https://core.telegram.org/bots/api#botdescription) using the method \TgBotLib\Bot > getMyDescription()

This commit is contained in:
Netkas 2023-04-06 13:33:29 -04:00
parent 7252854c44
commit ccd910938b
3 changed files with 72 additions and 0 deletions

View file

@ -0,0 +1,53 @@
<?php
/** @noinspection PhpMissingFieldTypeInspection */
namespace TgBotLib\Objects\Telegram;
use TgBotLib\Interfaces\ObjectTypeInterface;
class BotDescription implements ObjectTypeInterface
{
/**
* @var string
*/
private $description;
/**
* The bot's short description
*
* @return string
*/
public function getDescription(): string
{
return $this->description;
}
/**
* Returns an array representation of the object
*
* @return string[]
*/
public function toArray(): array
{
return [
'description' => $this->description,
];
}
/**
* Constructs object from an array representation
*
* @param array $data
* @return BotDescription
*/
public static function fromArray(array $data): self
{
$object = new self();
$object->description = $data['description'];
return $object;
}
}