Add DeclineChatJoinRequest Method

This commit is contained in:
netkas 2024-11-06 15:39:58 -05:00
parent 78b4f8c24d
commit 9889abf149
2 changed files with 40 additions and 0 deletions

View file

@ -13,6 +13,7 @@
use TgBotLib\Methods\CopyMessages;
use TgBotLib\Methods\CreateChatInviteLink;
use TgBotLib\Methods\CreateChatSubscriptionInviteLink;
use TgBotLib\Methods\DeclineChatJoinRequest;
use TgBotLib\Methods\DeleteWebhook;
use TgBotLib\Methods\EditChatInviteLink;
use TgBotLib\Methods\EditChatSubscriptionInviteLink;
@ -98,6 +99,7 @@
case EDIT_CHAT_SUBSCRIPTION_INVITE_LINK = 'editChatSubscriptionInviteLink';
case REVOKE_CHAT_INVITE_LINK = 'revokeChatInviteLink';
case APPROVE_CHAT_JOIN_REQUEST = 'approveChatJoinRequest';
case DECLINE_CHAT_JOIN_REQUEST = 'declineChatJoinRequest';
/**
* Executes a command on the provided bot with the given parameters.
@ -156,6 +158,7 @@
self::EDIT_CHAT_SUBSCRIPTION_INVITE_LINK => EditChatSubscriptionInviteLink::execute($bot, $parameters),
self::REVOKE_CHAT_INVITE_LINK => RevokeChatInviteLink::execute($bot, $parameters),
self::APPROVE_CHAT_JOIN_REQUEST => ApproveChatJoinRequest::execute($bot, $parameters),
self::DECLINE_CHAT_JOIN_REQUEST => DeclineChatJoinRequest::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 DeclineChatJoinRequest extends Method
{
/**
* @inheritDoc
*/
public static function execute(Bot $bot, array $parameters = []): true
{
return (bool)self::executeCurl(self::buildPost($bot, Methods::DECLINE_CHAT_JOIN_REQUEST->value, $parameters));
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return [
'chat_id',
'user_id'
];
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return null;
}
}