Add DeleteMessage method
This commit is contained in:
parent
06b57feb9c
commit
ae7facc255
2 changed files with 41 additions and 0 deletions
|
@ -21,6 +21,7 @@
|
||||||
use TgBotLib\Methods\DeleteChatPhoto;
|
use TgBotLib\Methods\DeleteChatPhoto;
|
||||||
use TgBotLib\Methods\DeleteChatStickerSet;
|
use TgBotLib\Methods\DeleteChatStickerSet;
|
||||||
use TgBotLib\Methods\DeleteForumTopic;
|
use TgBotLib\Methods\DeleteForumTopic;
|
||||||
|
use TgBotLib\Methods\DeleteMessage;
|
||||||
use TgBotLib\Methods\DeleteMyCommands;
|
use TgBotLib\Methods\DeleteMyCommands;
|
||||||
use TgBotLib\Methods\DeleteWebhook;
|
use TgBotLib\Methods\DeleteWebhook;
|
||||||
use TgBotLib\Methods\EditChatInviteLink;
|
use TgBotLib\Methods\EditChatInviteLink;
|
||||||
|
@ -200,6 +201,7 @@
|
||||||
case STOP_MESSAGE_LIVE_LOCATION = 'stopMessageLiveLocation';
|
case STOP_MESSAGE_LIVE_LOCATION = 'stopMessageLiveLocation';
|
||||||
case EDIT_MESSAGE_REPLY_MARKUP = 'editMessageReplyMarkup';
|
case EDIT_MESSAGE_REPLY_MARKUP = 'editMessageReplyMarkup';
|
||||||
case STOP_POLL = 'stopPoll';
|
case STOP_POLL = 'stopPoll';
|
||||||
|
case DELETE_MESSAGE = 'deleteMessage';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes a command on the provided bot with the given parameters.
|
* Executes a command on the provided bot with the given parameters.
|
||||||
|
@ -309,6 +311,7 @@
|
||||||
self::STOP_MESSAGE_LIVE_LOCATION => StopMessageLiveLocation::execute($bot, $parameters),
|
self::STOP_MESSAGE_LIVE_LOCATION => StopMessageLiveLocation::execute($bot, $parameters),
|
||||||
self::EDIT_MESSAGE_REPLY_MARKUP => EditMessageReplyMarkup::execute($bot, $parameters),
|
self::EDIT_MESSAGE_REPLY_MARKUP => EditMessageReplyMarkup::execute($bot, $parameters),
|
||||||
self::STOP_POLL => StopPoll::execute($bot, $parameters),
|
self::STOP_POLL => StopPoll::execute($bot, $parameters),
|
||||||
|
self::DELETE_MESSAGE => DeleteMessage::execute($bot, $parameters),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
38
src/TgBotLib/Methods/DeleteMessage.php
Normal file
38
src/TgBotLib/Methods/DeleteMessage.php
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace TgBotLib\Methods;
|
||||||
|
|
||||||
|
use TgBotLib\Abstracts\Method;
|
||||||
|
use TgBotLib\Bot;
|
||||||
|
use TgBotLib\Enums\Methods;
|
||||||
|
|
||||||
|
class DeleteMessage extends Method
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function execute(Bot $bot, array $parameters = []): true
|
||||||
|
{
|
||||||
|
return (bool)self::executeCurl(self::buildPost($bot, Methods::DELETE_MESSAGE->value, $parameters));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function getRequiredParameters(): ?array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'chat_id',
|
||||||
|
'message_id'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function getOptionalParameters(): ?array
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue