Add execute method to Methods enum
This commit is contained in:
parent
b37eeaf09c
commit
1720455918
1 changed files with 9 additions and 0 deletions
|
@ -3,12 +3,21 @@
|
||||||
namespace TgBotLib\Enums;
|
namespace TgBotLib\Enums;
|
||||||
|
|
||||||
use TgBotLib\Bot;
|
use TgBotLib\Bot;
|
||||||
|
use TgBotLib\Exceptions\TelegramException;
|
||||||
use TgBotLib\Methods\GetMe;
|
use TgBotLib\Methods\GetMe;
|
||||||
|
|
||||||
enum Methods : string
|
enum Methods : string
|
||||||
{
|
{
|
||||||
case GET_ME = 'getMe';
|
case GET_ME = 'getMe';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Executes a command on the provided bot with the given parameters.
|
||||||
|
*
|
||||||
|
* @param Bot $bot The bot instance on which the command will be executed.
|
||||||
|
* @param array $parameters Optional parameters for the command.
|
||||||
|
* @return mixed The result of the command execution, varies based on the command.
|
||||||
|
* @throws TelegramException if the command execution fails.
|
||||||
|
*/
|
||||||
public function execute(Bot $bot, array $parameters=[]): mixed
|
public function execute(Bot $bot, array $parameters=[]): mixed
|
||||||
{
|
{
|
||||||
return match($this)
|
return match($this)
|
||||||
|
|
Loading…
Add table
Reference in a new issue