Added the ability to get the current bot short description in the given language as the class [BotShortDescription](https://core.telegram.org/bots/api#botshortdescription) using the method \TgBotLib\Bot > getMyShortDescription()
see [getMyShortDescription](https://core.telegram.org/bots/api#getmyshortdescription) for more information.
This commit is contained in:
parent
5c1bb7c936
commit
38012104ae
3 changed files with 73 additions and 0 deletions
52
src/TgBotLib/Objects/Telegram/BotShortDescription.php
Normal file
52
src/TgBotLib/Objects/Telegram/BotShortDescription.php
Normal file
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
namespace TgBotLib\Objects\Telegram;
|
||||
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
|
||||
class BotShortDescription implements ObjectTypeInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $short_description;
|
||||
|
||||
/**
|
||||
* The bot's short description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getShortDescription(): string
|
||||
{
|
||||
return $this->short_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array representation of the object
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'short_description' => $this->short_description,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs object from an array representation
|
||||
*
|
||||
* @param array $data
|
||||
* @return BotShortDescription
|
||||
*/
|
||||
public static function fromArray(array $data): self
|
||||
{
|
||||
$object = new self();
|
||||
|
||||
$object->short_description = $data['short_description'];
|
||||
|
||||
return $object;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue