Add PinChatMessage method
This commit is contained in:
parent
5bf3dde316
commit
2aca204f16
2 changed files with 44 additions and 0 deletions
|
@ -27,6 +27,7 @@
|
|||
use TgBotLib\Methods\GetUserProfilePhotos;
|
||||
use TgBotLib\Methods\GetWebhookInfo;
|
||||
use TgBotLib\Methods\Logout;
|
||||
use TgBotLib\Methods\PinChatMessage;
|
||||
use TgBotLib\Methods\PromoteChatMember;
|
||||
use TgBotLib\Methods\RestrictChatMember;
|
||||
use TgBotLib\Methods\RevokeChatInviteLink;
|
||||
|
@ -108,6 +109,7 @@
|
|||
case DELETE_CHAT_PHOTO = 'deleteChatPhoto';
|
||||
case SET_CHAT_TITLE = 'setChatTitle';
|
||||
case SET_CHAT_DESCRIPTION = 'setChatDescription';
|
||||
case PIN_CHAT_MESSAGE = 'pinChatMessage';
|
||||
|
||||
/**
|
||||
* Executes a command on the provided bot with the given parameters.
|
||||
|
@ -171,6 +173,7 @@
|
|||
self::DELETE_CHAT_PHOTO => DeleteChatPhoto::execute($bot, $parameters),
|
||||
self::SET_CHAT_TITLE => SetChatTitle::execute($bot, $parameters),
|
||||
self::SET_CHAT_DESCRIPTION => SetChatDescription::execute($bot, $parameters),
|
||||
self::PIN_CHAT_MESSAGE => PinChatMessage::execute($bot, $parameters),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
41
src/TgBotLib/Methods/PinChatMessage.php
Normal file
41
src/TgBotLib/Methods/PinChatMessage.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Methods;
|
||||
|
||||
use TgBotLib\Abstracts\Method;
|
||||
use TgBotLib\Bot;
|
||||
use TgBotLib\Enums\Methods;
|
||||
|
||||
class PinChatMessage extends Method
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function execute(Bot $bot, array $parameters = []): true
|
||||
{
|
||||
return (bool)self::executeCurl(self::buildPost($bot, Methods::PIN_CHAT_MESSAGE->value, $parameters));
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getRequiredParameters(): ?array
|
||||
{
|
||||
return [
|
||||
'chat_id',
|
||||
'message_id'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getOptionalParameters(): ?array
|
||||
{
|
||||
return [
|
||||
'business_connection_id',
|
||||
'disable_notification'
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue