forked from OxMohsen/pass-generator-webbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGenericmessageCommand.php
43 lines (36 loc) · 961 Bytes
/
GenericmessageCommand.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
namespace Longman\TelegramBot\Commands\SystemCommands;
use OxMohsen\TgBot\Messages;
use Longman\TelegramBot\Commands\SystemCommand;
use Longman\TelegramBot\Entities\ServerResponse;
class GenericmessageCommand extends SystemCommand
{
/**
* @var string
*/
protected $name = 'genericmessage';
/**
* @var string
*/
protected $description = 'Handle generic message';
/**
* @var string
*/
protected $version = '1.0';
/**
* Main command execution.
*
* @return ServerResponse
*/
public function execute(): ServerResponse
{
$web_app_data = $this->getMessage()->getWebAppData();
if ($web_app_data) {
return $this->replyToChat(
sprintf(Messages::WEBAPP_DATA_MESSAGE, $web_app_data->getData()),
['parse_mode' => 'Markdown']
);
}
return $this->telegram->executeCommand('start');
}
}