From 1231e7d3877db9190e42b4945ee5dab5701e4be5 Mon Sep 17 00:00:00 2001 From: netkas Date: Mon, 30 Sep 2024 02:35:01 -0400 Subject: [PATCH] Add StartCommand and update HashCommand to use BotOld --- tests/commands/HashCommand.php | 6 +++--- tests/commands/StartCommand.php | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 tests/commands/StartCommand.php diff --git a/tests/commands/HashCommand.php b/tests/commands/HashCommand.php index bc5c692..075ca5b 100644 --- a/tests/commands/HashCommand.php +++ b/tests/commands/HashCommand.php @@ -2,7 +2,7 @@ namespace commands; - use TgBotLib\Bot; + use TgBotLib\BotOld; use TgBotLib\Exceptions\TelegramException; use TgBotLib\Interfaces\CommandInterface; use TgBotLib\Objects\Telegram\Update; @@ -10,12 +10,12 @@ class HashCommand implements CommandInterface { /** - * @param Bot $bot + * @param BotOld $bot * @param Update $update * @return void * @throws TelegramException */ - public function handle(Bot $bot, Update $update): void + public function handle(BotOld $bot, Update $update): void { // Usage: /hash $data = str_replace('/hash ', '', $update->getMessage()?->getText()); diff --git a/tests/commands/StartCommand.php b/tests/commands/StartCommand.php new file mode 100644 index 0000000..b75abf1 --- /dev/null +++ b/tests/commands/StartCommand.php @@ -0,0 +1,25 @@ +sendMessage( + $update->getMessage()?->getChat()?->getId(), 'Hello, ' . $update->getMessage()?->getFrom()?->getFirstName() + ); + } + } \ No newline at end of file