|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Greenplugin\TelegramBot\Method; |
|
6
|
|
|
|
|
7
|
|
|
use Greenplugin\TelegramBot\Method\Traits\ChatIdVariableTrait; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* Class SendChatActionMethod. |
|
11
|
|
|
* |
|
12
|
|
|
* @see https://core.telegram.org/bots/api#sendchataction |
|
13
|
|
|
*/ |
|
14
|
|
|
class SendChatActionMethod |
|
15
|
|
|
{ |
|
16
|
|
|
use ChatIdVariableTrait; |
|
17
|
|
|
const ACTION_TYPING = 'typing'; |
|
18
|
|
|
const ACTION_UPLOAD_PHOTO = 'upload_photo'; |
|
19
|
|
|
const ACTION_RECORD_VIDEO = 'record_video'; |
|
20
|
|
|
const ACTION_RECORD_AUDIO = 'record_audio'; |
|
21
|
|
|
const ACTION_UPLOAD_DOCUMENT = 'upload_document'; |
|
22
|
|
|
const ACTION_FIND_LOCATION = 'find_location'; |
|
23
|
|
|
const ACTION_RECORD_VIDEO_NOTE = 'record_video_note'; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Type of action to broadcast. |
|
27
|
|
|
* Choose one, depending on what the user is about to receive: |
|
28
|
|
|
* typing for text messages, |
|
29
|
|
|
* upload_photo for photos, |
|
30
|
|
|
* record_video or upload_video for videos, |
|
31
|
|
|
* record_audio or upload_audio for audio files, |
|
32
|
|
|
* upload_document for general files, |
|
33
|
|
|
* find_location for location data, |
|
34
|
|
|
* record_video_note or upload_video_note for video notes. |
|
35
|
|
|
* |
|
36
|
|
|
* @var string |
|
37
|
|
|
*/ |
|
38
|
|
|
public $action; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* SendChatActionMethod constructor. |
|
42
|
|
|
* |
|
43
|
|
|
* @param int|string $chatId |
|
44
|
|
|
* @param string $action |
|
45
|
|
|
*/ |
|
46
|
|
|
public function __construct($chatId, string $action) |
|
47
|
|
|
{ |
|
48
|
|
|
$this->chatId = $chatId; |
|
49
|
|
|
$this->action = $action; |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|