Added CommandHandler

This commit is contained in:
Netkas 2023-02-19 17:25:59 -05:00
parent eacc106666
commit 2362365865
5 changed files with 134 additions and 3 deletions

View file

@ -0,0 +1,23 @@
<?php
namespace commands;
use TgBotLib\Bot;
use TgBotLib\Exceptions\TelegramException;
use TgBotLib\Interfaces\CommandInterface;
use TgBotLib\Objects\Telegram\Update;
class StartCommand implements CommandInterface
{
/**
* @param Bot $bot
* @param Update $update
* @return void
* @throws TelegramException
*/
public function handle(Bot $bot, Update $update): void
{
// reply to the incoming message
$bot->sendMessage($update->getMessage()->getChat()->getId(), 'Hello, ' . $update->getMessage()->getFrom()->getFirstName());
}
}