Add SetChatTitle method

This commit is contained in:
netkas 2024-11-06 15:46:39 -05:00
parent 4d40f8f3a3
commit 3acdb17d46
2 changed files with 40 additions and 0 deletions

View file

@ -49,6 +49,7 @@
use TgBotLib\Methods\SetChatAdministratorCustomTitle;
use TgBotLib\Methods\SetChatPermissions;
use TgBotLib\Methods\SetChatPhoto;
use TgBotLib\Methods\SetChatTitle;
use TgBotLib\Methods\SetMessageReaction;
use TgBotLib\Methods\SetWebhook;
use TgBotLib\Methods\UnbanChatMember;
@ -104,6 +105,7 @@
case DECLINE_CHAT_JOIN_REQUEST = 'declineChatJoinRequest';
case SET_CHAT_PHOTO = 'setChatPhoto';
case DELETE_CHAT_PHOTO = 'deleteChatPhoto';
case SET_CHAT_TITLE = 'setChatTitle';
/**
* Executes a command on the provided bot with the given parameters.
@ -165,6 +167,7 @@
self::DECLINE_CHAT_JOIN_REQUEST => DeclineChatJoinRequest::execute($bot, $parameters),
self::SET_CHAT_PHOTO => SetChatPhoto::execute($bot, $parameters),
self::DELETE_CHAT_PHOTO => DeleteChatPhoto::execute($bot, $parameters),
self::SET_CHAT_TITLE => SetChatTitle::execute($bot, $parameters),
};
}
}

View file

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