Add DeleteMyCommands method
This commit is contained in:
parent
b9a46da443
commit
c7eec21824
2 changed files with 47 additions and 0 deletions
|
@ -21,6 +21,7 @@
|
|||
use TgBotLib\Methods\DeleteChatPhoto;
|
||||
use TgBotLib\Methods\DeleteChatStickerSet;
|
||||
use TgBotLib\Methods\DeleteForumTopic;
|
||||
use TgBotLib\Methods\DeleteMyCommands;
|
||||
use TgBotLib\Methods\DeleteWebhook;
|
||||
use TgBotLib\Methods\EditChatInviteLink;
|
||||
use TgBotLib\Methods\EditChatSubscriptionInviteLink;
|
||||
|
@ -162,6 +163,7 @@
|
|||
case GET_USER_CHAT_BOOSTS = 'getUserChatBoosts';
|
||||
case GET_BUSINESS_CONNECTION = 'getBusinessConnection';
|
||||
case SET_MY_COMMANDS = 'setMyCommands';
|
||||
case DELETE_MY_COMMANDS = 'deleteMyCommands';
|
||||
|
||||
/**
|
||||
* Executes a command on the provided bot with the given parameters.
|
||||
|
@ -252,6 +254,7 @@
|
|||
self::GET_USER_CHAT_BOOSTS => GetUserChatBoosts::execute($bot, $parameters),
|
||||
self::GET_BUSINESS_CONNECTION => GetBusinessConnection::execute($bot, $parameters),
|
||||
self::SET_MY_COMMANDS => SetMyCommands::execute($bot, $parameters),
|
||||
self::DELETE_MY_COMMANDS => DeleteMyCommands::execute($bot, $parameters),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
44
src/TgBotLib/Methods/DeleteMyCommands.php
Normal file
44
src/TgBotLib/Methods/DeleteMyCommands.php
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Methods;
|
||||
|
||||
use TgBotLib\Abstracts\Method;
|
||||
use TgBotLib\Bot;
|
||||
use TgBotLib\Enums\Methods;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
|
||||
class DeleteMyCommands extends Method
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function execute(Bot $bot, array $parameters = []): true
|
||||
{
|
||||
if(isset($parameters['scope']) && $parameters['scope'] instanceof ObjectTypeInterface)
|
||||
{
|
||||
$parameters['scope'] = json_encode($parameters['scope']->toArray());
|
||||
}
|
||||
|
||||
return (bool)self::executeCurl(self::buildPost($bot, Methods::DELETE_MY_COMMANDS->value, $parameters));
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getRequiredParameters(): ?array
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getOptionalParameters(): ?array
|
||||
{
|
||||
return [
|
||||
'scope',
|
||||
'language_code'
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue