1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types = 1); |
4
|
|
|
|
5
|
|
|
namespace unreal4u\TelegramAPI\Telegram\Methods; |
6
|
|
|
|
7
|
|
|
use Generator; |
8
|
|
|
use unreal4u\TelegramAPI\Abstracts\KeyboardMethods; |
9
|
|
|
use unreal4u\TelegramAPI\Abstracts\TelegramMethods; |
10
|
|
|
use unreal4u\TelegramAPI\Telegram\Types\Custom\InputFile; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Use this method to send .webp stickers. On success, the sent Message is returned. |
14
|
|
|
* |
15
|
|
|
* Objects defined as-is july 2016 |
16
|
|
|
* |
17
|
|
|
* @see https://core.telegram.org/bots/api#sendsticker |
18
|
|
|
*/ |
19
|
|
|
class SendSticker extends TelegramMethods |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
23
|
|
|
* @var string |
24
|
|
|
*/ |
25
|
|
|
public $chat_id = ''; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass |
29
|
|
|
* an HTTP URL as a String for Telegram to get a .webp file from the Internet, or upload a new one using the |
30
|
|
|
* InputFile class |
31
|
|
|
* @see InputFile |
32
|
|
|
* @var string|InputFile |
33
|
|
|
*/ |
34
|
|
|
public $sticker = ''; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Optional. Sends the message silently. iOS users will not receive a notification, Android users will receive a |
38
|
|
|
* notification with no sound. |
39
|
|
|
* @see https://telegram.org/blog/channels-2-0#silent-messages |
40
|
|
|
* @var bool |
41
|
|
|
*/ |
42
|
|
|
public $disable_notification = false; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Optional. If the message is a reply, ID of the original message |
46
|
|
|
* @var int |
47
|
|
|
*/ |
48
|
|
|
public $reply_to_message_id = 0; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Optional. Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to |
52
|
|
|
* hide keyboard or to force a reply from the user |
53
|
|
|
* @var KeyboardMethods |
54
|
|
|
*/ |
55
|
|
|
public $reply_markup; |
56
|
|
|
|
57
|
1 |
|
public function getMandatoryFields(): array |
58
|
|
|
{ |
59
|
|
|
return [ |
60
|
1 |
|
'chat_id', |
61
|
|
|
'sticker', |
62
|
|
|
]; |
63
|
|
|
} |
64
|
|
|
|
65
|
1 |
|
public function hasLocalFiles(): bool |
66
|
|
|
{ |
67
|
1 |
|
return $this->sticker instanceof InputFile; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function getLocalFiles(): Generator |
71
|
|
|
{ |
72
|
|
|
yield 'sticker' => $this->sticker; |
73
|
|
|
} |
74
|
|
|
} |
75
|
|
|
|