Add GetMyShortDescription

This commit is contained in:
netkas 2024-11-13 15:46:17 -05:00
parent e1f6b63bb7
commit 50d6ddd152
2 changed files with 41 additions and 0 deletions

View file

@ -41,6 +41,7 @@
use TgBotLib\Methods\GetMyCommands;
use TgBotLib\Methods\GetMyDescription;
use TgBotLib\Methods\GetMyName;
use TgBotLib\Methods\GetMyShortDescription;
use TgBotLib\Methods\GetUpdates;
use TgBotLib\Methods\GetUserChatBoosts;
use TgBotLib\Methods\GetUserProfilePhotos;
@ -176,6 +177,7 @@
case SET_MY_DESCRIPTION = 'setMyDescription';
case GET_MY_DESCRIPTION = 'getMyDescription';
case SET_MY_SHORT_DESCRIPTION = 'setMyShortDescription';
case GET_MY_SHORT_DESCRIPTION = 'getMyShortDescription';
/**
* Executes a command on the provided bot with the given parameters.
@ -273,6 +275,7 @@
self::SET_MY_DESCRIPTION => SetMyDescription::execute($bot, $parameters),
self::GET_MY_DESCRIPTION => GetMyDescription::execute($bot, $parameters),
self::SET_MY_SHORT_DESCRIPTION => SetMyShortDescription::execute($bot, $parameters),
self::GET_MY_SHORT_DESCRIPTION => GetMyShortDescription::execute($bot, $parameters),
};
}
}

View file

@ -0,0 +1,38 @@
<?php
namespace TgBotLib\Methods;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
use TgBotLib\Objects\BotShortDescription;
class GetMyShortDescription extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): BotShortDescription
{
return BotShortDescription::fromArray(self::executeCurl(self::buildPost($bot, Methods::GET_MY_SHORT_DESCRIPTION->value, $parameters)));
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return null;
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return [
'language_code'
];
}
}