|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Greenplugin\TelegramBot\Method; |
|
6
|
|
|
|
|
7
|
|
|
use Greenplugin\TelegramBot\Method\Interfaces\HasParseModeVariableInterface; |
|
8
|
|
|
use Greenplugin\TelegramBot\Method\Traits\EditMessageVariablesTrait; |
|
9
|
|
|
use Greenplugin\TelegramBot\Method\Traits\FillFromArrayTrait; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Class EditMessageTextMethod. |
|
13
|
|
|
* |
|
14
|
|
|
* @see https://core.telegram.org/bots/api#editmessagetext |
|
15
|
|
|
*/ |
|
16
|
|
|
class EditMessageTextMethod implements HasParseModeVariableInterface |
|
17
|
|
|
{ |
|
18
|
|
|
use FillFromArrayTrait; |
|
19
|
|
|
use EditMessageVariablesTrait; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* New text of the message. |
|
23
|
|
|
* |
|
24
|
|
|
* @var string |
|
25
|
|
|
*/ |
|
26
|
|
|
public $text; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, |
|
30
|
|
|
* fixed-width text or inline URLs in your bot's message. |
|
31
|
|
|
* |
|
32
|
|
|
* @var string|null |
|
33
|
|
|
*/ |
|
34
|
|
|
public $parseMode; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Optional. Disables link previews for links in this message. |
|
38
|
|
|
* |
|
39
|
|
|
* @var bool|null |
|
40
|
|
|
*/ |
|
41
|
|
|
public $disableWebPagePreview; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* EditMessageTextMethod constructor. |
|
45
|
|
|
* |
|
46
|
|
|
* @param int|string $chatId |
|
47
|
|
|
* @param string $text |
|
48
|
|
|
* @param array|null $data |
|
49
|
|
|
*/ |
|
50
|
|
|
public function __construct($chatId, string $text, array $data = null) |
|
51
|
|
|
{ |
|
52
|
|
|
$this->chatId = $chatId; |
|
53
|
|
|
$this->text = $text; |
|
54
|
|
|
if ($data) { |
|
55
|
|
|
$this->fill($data); |
|
56
|
|
|
} |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @param int|string $chatId |
|
61
|
|
|
* @param int $messageId |
|
62
|
|
|
* @param string $text |
|
63
|
|
|
* @param array|null $data |
|
64
|
|
|
* |
|
65
|
|
|
* @return EditMessageTextMethod |
|
66
|
|
|
*/ |
|
67
|
|
|
public static function create($chatId, int $messageId, string $text, array $data = null): EditMessageTextMethod |
|
68
|
|
|
{ |
|
69
|
|
|
$instance = new self($chatId, $text, $data); |
|
70
|
|
|
$instance->messageId = $messageId; |
|
71
|
|
|
|
|
72
|
|
|
return $instance; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* @param int|string $chatId |
|
77
|
|
|
* @param string $inlineMessageId |
|
78
|
|
|
* @param string $text |
|
79
|
|
|
* @param array|null $data |
|
80
|
|
|
* |
|
81
|
|
|
* @return EditMessageTextMethod |
|
82
|
|
|
*/ |
|
83
|
|
|
public static function createInline( |
|
84
|
|
|
$chatId, |
|
85
|
|
|
string $inlineMessageId, |
|
86
|
|
|
string $text, |
|
87
|
|
|
array $data = null |
|
88
|
|
|
): EditMessageTextMethod { |
|
89
|
|
|
$instance = new self($chatId, $text, $data); |
|
90
|
|
|
$instance->inlineMessageId = $inlineMessageId; |
|
91
|
|
|
|
|
92
|
|
|
return $instance; |
|
93
|
|
|
} |
|
94
|
|
|
} |
|
95
|
|
|
|