Added single-threaded and multi-threaded example

This commit is contained in:
Netkas 2023-02-20 21:27:43 -05:00
parent da6abceed2
commit 040426a63c
9 changed files with 110 additions and 15 deletions

View file

@ -0,0 +1,26 @@
<?php
namespace commands;
use TgBotLib\Bot;
use TgBotLib\Exceptions\TelegramException;
use TgBotLib\Interfaces\CommandInterface;
use TgBotLib\Objects\Telegram\Update;
class HashCommand implements CommandInterface
{
/**
* @param Bot $bot
* @param Update $update
* @return void
* @throws TelegramException
*/
public function handle(Bot $bot, Update $update): void
{
// Usage: /hash <text>
$data = str_replace('/hash ', '', $update->getMessage()->getText());
$bot->sendMessage(
$update->getMessage()->getChat()->getId(), md5($data)
);
}
}