2023-02-20 21:27:43 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace commands;
|
|
|
|
|
2024-09-30 02:35:01 -04:00
|
|
|
use TgBotLib\BotOld;
|
2023-02-20 21:27:43 -05:00
|
|
|
use TgBotLib\Exceptions\TelegramException;
|
|
|
|
use TgBotLib\Interfaces\CommandInterface;
|
2024-10-02 00:18:12 -04:00
|
|
|
use TgBotLib\Objects\Update;
|
2023-02-20 21:27:43 -05:00
|
|
|
|
|
|
|
class HashCommand implements CommandInterface
|
|
|
|
{
|
|
|
|
/**
|
2024-09-30 02:35:01 -04:00
|
|
|
* @param BotOld $bot
|
2023-02-20 21:27:43 -05:00
|
|
|
* @param Update $update
|
|
|
|
* @return void
|
|
|
|
* @throws TelegramException
|
|
|
|
*/
|
2024-09-30 02:35:01 -04:00
|
|
|
public function handle(BotOld $bot, Update $update): void
|
2023-02-20 21:27:43 -05:00
|
|
|
{
|
|
|
|
// Usage: /hash <text>
|
2023-08-09 20:02:59 -04:00
|
|
|
$data = str_replace('/hash ', '', $update->getMessage()?->getText());
|
2023-02-20 21:27:43 -05:00
|
|
|
$bot->sendMessage(
|
2023-08-09 20:02:59 -04:00
|
|
|
$update->getMessage()?->getChat()?->getId(), md5($data)
|
2023-02-20 21:27:43 -05:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|