Add SetMyShortDescription method

This commit is contained in:
netkas 2024-11-13 15:44:36 -05:00
parent d45bf4f261
commit e1f6b63bb7
2 changed files with 41 additions and 0 deletions

View file

@ -80,6 +80,7 @@
use TgBotLib\Methods\SetMyCommands;
use TgBotLib\Methods\SetMyDescription;
use TgBotLib\Methods\SetMyName;
use TgBotLib\Methods\SetMyShortDescription;
use TgBotLib\Methods\SetWebhook;
use TgBotLib\Methods\UnbanChatMember;
use TgBotLib\Methods\UnbanChatSenderChat;
@ -174,6 +175,7 @@
case GET_MY_NAME = 'getMyName';
case SET_MY_DESCRIPTION = 'setMyDescription';
case GET_MY_DESCRIPTION = 'getMyDescription';
case SET_MY_SHORT_DESCRIPTION = 'setMyShortDescription';
/**
* Executes a command on the provided bot with the given parameters.
@ -270,6 +272,7 @@
self::GET_MY_NAME => GetMyName::execute($bot, $parameters),
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),
};
}
}

View file

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