Add SetChatDescription method
This commit is contained in:
parent
3acdb17d46
commit
5bf3dde316
2 changed files with 42 additions and 0 deletions
|
@ -47,6 +47,7 @@
|
|||
use TgBotLib\Methods\SendVideoNote;
|
||||
use TgBotLib\Methods\SendVoice;
|
||||
use TgBotLib\Methods\SetChatAdministratorCustomTitle;
|
||||
use TgBotLib\Methods\SetChatDescription;
|
||||
use TgBotLib\Methods\SetChatPermissions;
|
||||
use TgBotLib\Methods\SetChatPhoto;
|
||||
use TgBotLib\Methods\SetChatTitle;
|
||||
|
@ -106,6 +107,7 @@
|
|||
case SET_CHAT_PHOTO = 'setChatPhoto';
|
||||
case DELETE_CHAT_PHOTO = 'deleteChatPhoto';
|
||||
case SET_CHAT_TITLE = 'setChatTitle';
|
||||
case SET_CHAT_DESCRIPTION = 'setChatDescription';
|
||||
|
||||
/**
|
||||
* Executes a command on the provided bot with the given parameters.
|
||||
|
@ -168,6 +170,7 @@
|
|||
self::SET_CHAT_PHOTO => SetChatPhoto::execute($bot, $parameters),
|
||||
self::DELETE_CHAT_PHOTO => DeleteChatPhoto::execute($bot, $parameters),
|
||||
self::SET_CHAT_TITLE => SetChatTitle::execute($bot, $parameters),
|
||||
self::SET_CHAT_DESCRIPTION => SetChatDescription::execute($bot, $parameters),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
39
src/TgBotLib/Methods/SetChatDescription.php
Normal file
39
src/TgBotLib/Methods/SetChatDescription.php
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Methods;
|
||||
|
||||
use TgBotLib\Abstracts\Method;
|
||||
use TgBotLib\Bot;
|
||||
use TgBotLib\Enums\Methods;
|
||||
|
||||
class SetChatDescription extends Method
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function execute(Bot $bot, array $parameters = []): true
|
||||
{
|
||||
return (bool)self::executeCurl(self::buildPost($bot, Methods::SET_CHAT_DESCRIPTION->value, $parameters));
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getRequiredParameters(): ?array
|
||||
{
|
||||
return [
|
||||
'chat_id'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getOptionalParameters(): ?array
|
||||
{
|
||||
return [
|
||||
'description'
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue