|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace TgBotApi\BotApiBase\Traits; |
|
6
|
|
|
|
|
7
|
|
|
use TgBotApi\BotApiBase\Exception\ResponseException; |
|
8
|
|
|
use TgBotApi\BotApiBase\Method\Interfaces\SendMethodAliasInterface; |
|
9
|
|
|
use TgBotApi\BotApiBase\Method\SendAnimationMethod; |
|
10
|
|
|
use TgBotApi\BotApiBase\Method\SendAudioMethod; |
|
11
|
|
|
use TgBotApi\BotApiBase\Method\SendChatActionMethod; |
|
12
|
|
|
use TgBotApi\BotApiBase\Method\SendContactMethod; |
|
13
|
|
|
use TgBotApi\BotApiBase\Method\SendDiceMethod; |
|
14
|
|
|
use TgBotApi\BotApiBase\Method\SendDocumentMethod; |
|
15
|
|
|
use TgBotApi\BotApiBase\Method\SendGameMethod; |
|
16
|
|
|
use TgBotApi\BotApiBase\Method\SendInvoiceMethod; |
|
17
|
|
|
use TgBotApi\BotApiBase\Method\SendLocationMethod; |
|
18
|
|
|
use TgBotApi\BotApiBase\Method\SendMediaGroupMethod; |
|
19
|
|
|
use TgBotApi\BotApiBase\Method\SendMessageMethod; |
|
20
|
|
|
use TgBotApi\BotApiBase\Method\SendPhotoMethod; |
|
21
|
|
|
use TgBotApi\BotApiBase\Method\SendPollMethod; |
|
22
|
|
|
use TgBotApi\BotApiBase\Method\SendStickerMethod; |
|
23
|
|
|
use TgBotApi\BotApiBase\Method\SendVenueMethod; |
|
24
|
|
|
use TgBotApi\BotApiBase\Method\SendVideoMethod; |
|
25
|
|
|
use TgBotApi\BotApiBase\Method\SendVideoNoteMethod; |
|
26
|
|
|
use TgBotApi\BotApiBase\Method\SendVoiceMethod; |
|
27
|
|
|
use TgBotApi\BotApiBase\Type\MessageType; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Trait SendMethodTrait. |
|
31
|
|
|
*/ |
|
32
|
|
|
trait SendMethodTrait |
|
33
|
|
|
{ |
|
34
|
|
|
/** |
|
35
|
|
|
* @throws ResponseException |
|
36
|
|
|
* |
|
37
|
|
|
* @return MessageType[] |
|
38
|
|
|
*/ |
|
39
|
|
|
abstract public function sendMediaGroup(SendMediaGroupMethod $method): array; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @throws ResponseException |
|
43
|
|
|
*/ |
|
44
|
|
|
abstract public function send(SendMethodAliasInterface $method): MessageType; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @throws ResponseException |
|
48
|
|
|
*/ |
|
49
|
|
|
abstract public function sendChatAction(SendChatActionMethod $method): bool; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @throws ResponseException |
|
53
|
|
|
*/ |
|
54
|
6 |
|
public function sendPhoto(SendPhotoMethod $method): MessageType |
|
55
|
|
|
{ |
|
56
|
6 |
|
return $this->send($method); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @throws ResponseException |
|
61
|
|
|
*/ |
|
62
|
6 |
|
public function sendAudio(SendAudioMethod $method): MessageType |
|
63
|
|
|
{ |
|
64
|
6 |
|
return $this->send($method); |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* @throws ResponseException |
|
69
|
|
|
*/ |
|
70
|
6 |
|
public function sendDocument(SendDocumentMethod $method): MessageType |
|
71
|
|
|
{ |
|
72
|
6 |
|
return $this->send($method); |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* @throws ResponseException |
|
77
|
|
|
*/ |
|
78
|
6 |
|
public function sendVideo(SendVideoMethod $method): MessageType |
|
79
|
|
|
{ |
|
80
|
6 |
|
return $this->send($method); |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* @throws ResponseException |
|
85
|
|
|
*/ |
|
86
|
6 |
|
public function sendAnimation(SendAnimationMethod $method): MessageType |
|
87
|
|
|
{ |
|
88
|
6 |
|
return $this->send($method); |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
/** |
|
92
|
|
|
* @throws ResponseException |
|
93
|
|
|
*/ |
|
94
|
6 |
|
public function sendVoice(SendVoiceMethod $method): MessageType |
|
95
|
|
|
{ |
|
96
|
6 |
|
return $this->send($method); |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* @throws ResponseException |
|
101
|
|
|
*/ |
|
102
|
6 |
|
public function sendVideoNote(SendVideoNoteMethod $method): MessageType |
|
103
|
|
|
{ |
|
104
|
6 |
|
return $this->send($method); |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
/** |
|
108
|
|
|
* @throws ResponseException |
|
109
|
|
|
*/ |
|
110
|
3 |
|
public function sendGame(SendGameMethod $method): MessageType |
|
111
|
|
|
{ |
|
112
|
3 |
|
return $this->send($method); |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
/** |
|
116
|
|
|
* @throws ResponseException |
|
117
|
|
|
*/ |
|
118
|
3 |
|
public function sendInvoice(SendInvoiceMethod $method): MessageType |
|
119
|
|
|
{ |
|
120
|
3 |
|
return $this->send($method); |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
/** |
|
124
|
|
|
* @throws ResponseException |
|
125
|
|
|
*/ |
|
126
|
6 |
|
public function sendLocation(SendLocationMethod $method): MessageType |
|
127
|
|
|
{ |
|
128
|
6 |
|
return $this->send($method); |
|
129
|
|
|
} |
|
130
|
|
|
|
|
131
|
|
|
/** |
|
132
|
|
|
* @throws ResponseException |
|
133
|
|
|
*/ |
|
134
|
6 |
|
public function sendVenue(SendVenueMethod $method): MessageType |
|
135
|
|
|
{ |
|
136
|
6 |
|
return $this->send($method); |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
/** |
|
140
|
|
|
* @throws ResponseException |
|
141
|
|
|
*/ |
|
142
|
6 |
|
public function sendContact(SendContactMethod $method): MessageType |
|
143
|
|
|
{ |
|
144
|
6 |
|
return $this->send($method); |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
|
/** |
|
148
|
|
|
* @throws ResponseException |
|
149
|
|
|
*/ |
|
150
|
3 |
|
public function sendDice(SendDiceMethod $method): MessageType |
|
151
|
|
|
{ |
|
152
|
3 |
|
return $this->send($method); |
|
153
|
|
|
} |
|
154
|
|
|
|
|
155
|
|
|
/** |
|
156
|
|
|
* @throws ResponseException |
|
157
|
|
|
*/ |
|
158
|
3 |
|
public function sendSticker(SendStickerMethod $method): MessageType |
|
159
|
|
|
{ |
|
160
|
3 |
|
return $this->send($method); |
|
161
|
|
|
} |
|
162
|
|
|
|
|
163
|
|
|
/** |
|
164
|
|
|
* @throws ResponseException |
|
165
|
|
|
*/ |
|
166
|
6 |
|
public function sendMessage(SendMessageMethod $method): MessageType |
|
167
|
|
|
{ |
|
168
|
6 |
|
return $this->send($method); |
|
169
|
|
|
} |
|
170
|
|
|
|
|
171
|
|
|
/** |
|
172
|
|
|
* @throws ResponseException |
|
173
|
|
|
*/ |
|
174
|
3 |
|
public function sendPoll(SendPollMethod $method): MessageType |
|
175
|
|
|
{ |
|
176
|
3 |
|
return $this->send($method); |
|
177
|
|
|
} |
|
178
|
|
|
} |
|
179
|
|
|
|