tgbotlib/tests/commands/StartCommand.php

25 lines
695 B
PHP
Raw Permalink Normal View History

2023-02-19 17:25:59 -05:00
<?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
2023-02-20 16:06:11 -05:00
$bot->sendMessage(
$update->getMessage()?->getChat()?->getId(), 'Hello, ' . $update->getMessage()?->getFrom()?->getFirstName()
2023-02-20 16:06:11 -05:00
);
2023-02-19 17:25:59 -05:00
}
}