Add DeleteChatPhoto method

This commit is contained in:
netkas 2024-11-06 15:44:14 -05:00
parent 17f1599797
commit 4d40f8f3a3
2 changed files with 39 additions and 0 deletions

View file

@ -14,6 +14,7 @@
use TgBotLib\Methods\CreateChatInviteLink; use TgBotLib\Methods\CreateChatInviteLink;
use TgBotLib\Methods\CreateChatSubscriptionInviteLink; use TgBotLib\Methods\CreateChatSubscriptionInviteLink;
use TgBotLib\Methods\DeclineChatJoinRequest; use TgBotLib\Methods\DeclineChatJoinRequest;
use TgBotLib\Methods\DeleteChatPhoto;
use TgBotLib\Methods\DeleteWebhook; use TgBotLib\Methods\DeleteWebhook;
use TgBotLib\Methods\EditChatInviteLink; use TgBotLib\Methods\EditChatInviteLink;
use TgBotLib\Methods\EditChatSubscriptionInviteLink; use TgBotLib\Methods\EditChatSubscriptionInviteLink;
@ -102,6 +103,7 @@
case APPROVE_CHAT_JOIN_REQUEST = 'approveChatJoinRequest'; case APPROVE_CHAT_JOIN_REQUEST = 'approveChatJoinRequest';
case DECLINE_CHAT_JOIN_REQUEST = 'declineChatJoinRequest'; case DECLINE_CHAT_JOIN_REQUEST = 'declineChatJoinRequest';
case SET_CHAT_PHOTO = 'setChatPhoto'; case SET_CHAT_PHOTO = 'setChatPhoto';
case DELETE_CHAT_PHOTO = 'deleteChatPhoto';
/** /**
* Executes a command on the provided bot with the given parameters. * Executes a command on the provided bot with the given parameters.
@ -162,6 +164,7 @@
self::APPROVE_CHAT_JOIN_REQUEST => ApproveChatJoinRequest::execute($bot, $parameters), self::APPROVE_CHAT_JOIN_REQUEST => ApproveChatJoinRequest::execute($bot, $parameters),
self::DECLINE_CHAT_JOIN_REQUEST => DeclineChatJoinRequest::execute($bot, $parameters), self::DECLINE_CHAT_JOIN_REQUEST => DeclineChatJoinRequest::execute($bot, $parameters),
self::SET_CHAT_PHOTO => SetChatPhoto::execute($bot, $parameters), self::SET_CHAT_PHOTO => SetChatPhoto::execute($bot, $parameters),
self::DELETE_CHAT_PHOTO => DeleteChatPhoto::execute($bot, $parameters),
}; };
} }
} }

View file

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