|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @package Telegram |
|
4
|
|
|
* @link https://github.com/smartwf/tgmethod |
|
5
|
|
|
* @author Smart <[email protected]> |
|
6
|
|
|
*/ |
|
7
|
|
|
class tgmethod |
|
8
|
|
|
{ |
|
9
|
|
|
// Telegram Token |
|
10
|
|
|
protected $token=null; |
|
11
|
|
|
|
|
12
|
|
|
protected $ch; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* initialize Class |
|
16
|
|
|
* @param string $api_token The token looks something like 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11 |
|
17
|
|
|
* @return bool |
|
18
|
|
|
*/ |
|
19
|
|
|
public function __construct($api_token) |
|
20
|
|
|
{ |
|
21
|
|
|
$this->token=$api_token; |
|
22
|
|
|
if (strlen($this->token)==45 && count(explode(':',$this->token))==2){ |
|
23
|
|
|
$this->ch = curl_init(); |
|
24
|
|
|
return true; |
|
25
|
|
|
} |
|
26
|
|
|
else |
|
27
|
|
|
return false; |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* Destruct Class |
|
32
|
|
|
*/ |
|
33
|
|
|
public function __destruct() |
|
34
|
|
|
{ |
|
35
|
|
|
curl_close($this->ch); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Make Http Request |
|
40
|
|
|
* @param string $method Mothod for calling |
|
41
|
|
|
* @param array $datas Datas for Send to Telegram |
|
42
|
|
|
* @return object |
|
43
|
|
|
*/ |
|
44
|
|
|
private function make_http_request($method,$datas=[]){ |
|
45
|
|
|
$url = "https://api.telegram.org/bot".$this->token."/".$method; |
|
46
|
|
|
curl_setopt($this->ch,CURLOPT_RETURNTRANSFER,true); |
|
47
|
|
|
curl_setopt($this->ch,CURLOPT_POSTFIELDS,($datas)); |
|
48
|
|
|
curl_setopt($this->ch,CURLOPT_URL,$url); |
|
49
|
|
|
$res = curl_exec($this->ch); |
|
50
|
|
|
if(curl_error($this->ch)){ |
|
51
|
|
|
return false; |
|
|
|
|
|
|
52
|
|
|
}else{ |
|
53
|
|
|
$res=json_decode($res); |
|
54
|
|
|
if ($res->ok){ |
|
55
|
|
|
$res=$res->result; |
|
56
|
|
|
$res->ok=true; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
return $res; |
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
|
|
64
|
|
|
|
|
65
|
|
|
|
|
66
|
|
|
|
|
67
|
|
|
///////////////////////////////////////////////////////////////////// |
|
68
|
|
|
|
|
69
|
|
|
|
|
70
|
|
|
|
|
71
|
|
|
|
|
72
|
|
|
/****************************************** |
|
73
|
|
|
* * |
|
74
|
|
|
* Method functions * |
|
75
|
|
|
* * |
|
76
|
|
|
******************************************/ |
|
77
|
|
|
|
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* Use this method to specify a url and receive incoming updates via an outgoing webhook |
|
81
|
|
|
* @param string $url HTTPS url to send updates to. Use an empty string to remove webhook integration |
|
82
|
|
|
* @param array $allowed_updates List the types of updates you want your bot to receive. For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types |
|
83
|
|
|
* @param int $max_connections Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100 |
|
84
|
|
|
* @param file $certificate Upload your public key certificate so that the root certificate in use can be checked |
|
85
|
|
|
* @return object |
|
86
|
|
|
*/ |
|
87
|
|
|
public function setWebhook($url,$allowed_updates=null,$max_connections=null,$certificate=null){ |
|
88
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
|
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* Use this method to remove webhook integration if you decide to switch back to getUpdates |
|
95
|
|
|
* @return object |
|
96
|
|
|
*/ |
|
97
|
|
|
public function deleteWebhook(){ |
|
98
|
|
|
return $this->make_http_request(__FUNCTION__); |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
|
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* Use this method to get current webhook status. Requires no parameters |
|
105
|
|
|
* @return object |
|
106
|
|
|
*/ |
|
107
|
|
|
public function getWebhookInfo(){ |
|
108
|
|
|
return $this->make_http_request(__FUNCTION__); |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
|
|
112
|
|
|
|
|
113
|
|
|
/** |
|
114
|
|
|
* A simple method for testing your bot's auth token |
|
115
|
|
|
* @return object |
|
116
|
|
|
*/ |
|
117
|
|
|
public function getme(){ |
|
118
|
|
|
return $this->make_http_request(__FUNCTION__); |
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
|
|
|
|
122
|
|
|
|
|
123
|
|
|
/** |
|
124
|
|
|
* Use this method to send text messages |
|
125
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
126
|
|
|
* @param string $text Text of the message to be sent |
|
127
|
|
|
* @param int $reply_to_message_id If the message is a reply, ID of the original message |
|
128
|
|
|
* @param json $reply_markup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. |
|
129
|
|
|
* @param string $parse_mode Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. |
|
130
|
|
|
* @param bool $disable_web_page_preview Disables link previews for links in this message |
|
131
|
|
|
* @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. |
|
132
|
|
|
* @return object |
|
133
|
|
|
*/ |
|
134
|
|
|
public function sendMessage($chat_id,$text,$reply_to_message_id=null,$parse_mode=null,$disable_web_page_preview=null,$reply_markup=null,$disable_notification=null){ |
|
135
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
136
|
|
|
} |
|
137
|
|
|
|
|
138
|
|
|
|
|
139
|
|
|
|
|
140
|
|
|
/** |
|
141
|
|
|
* Use this method to forward messages of any kind |
|
142
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
143
|
|
|
* @param int|string $from_chat_id Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername) |
|
144
|
|
|
* @param int $message_id Message identifier in the chat specified in from_chat_id |
|
145
|
|
|
* @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. |
|
146
|
|
|
* @return object |
|
147
|
|
|
*/ |
|
148
|
|
|
public function forwardMessage($chat_id,$from_chat_id,$message_id,$disable_notification=null){ |
|
149
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
|
|
153
|
|
|
|
|
154
|
|
|
/** |
|
155
|
|
|
* Use this method to send photos |
|
156
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
157
|
|
|
* @param string $photo Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data |
|
158
|
|
|
* @param string $caption Photo caption (may also be used when resending photos by file_id), 0-200 characters |
|
159
|
|
|
* @param int $reply_to_message_id If the message is a reply, ID of the original message |
|
160
|
|
|
* @param json $reply_markup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. |
|
161
|
|
|
* @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. |
|
162
|
|
|
* @return object |
|
163
|
|
|
*/ |
|
164
|
|
|
public function sendPhoto($chat_id,$photo,$caption=null,$reply_to_message_id=null,$reply_markup=null,$disable_notification=null){ |
|
165
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
166
|
|
|
} |
|
167
|
|
|
|
|
168
|
|
|
|
|
169
|
|
|
|
|
170
|
|
|
/** |
|
171
|
|
|
* Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .mp3 format. |
|
172
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
173
|
|
|
* @param string $audio Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. |
|
174
|
|
|
* @param string $caption Audio caption, 0-200 characters |
|
175
|
|
|
* @param int $reply_to_message_id If the message is a reply, ID of the original message |
|
176
|
|
|
* @param json $reply_markup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. |
|
177
|
|
|
* @param string $title Track name |
|
178
|
|
|
* @param int $duration Duration of the audio in seconds |
|
179
|
|
|
* @param string $performer Performer |
|
180
|
|
|
* @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. |
|
181
|
|
|
* @return object |
|
182
|
|
|
*/ |
|
183
|
|
|
public function sendAudio($chat_id,$audio,$caption=null,$reply_to_message_id=null,$reply_markup=null,$title=null,$duration=null,$performer=null,$disable_notification=null){ |
|
184
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
185
|
|
|
} |
|
186
|
|
|
|
|
187
|
|
|
|
|
188
|
|
|
|
|
189
|
|
|
/** |
|
190
|
|
|
* Use this method to send general files |
|
191
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
192
|
|
|
* @param string $document File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. |
|
193
|
|
|
* @param string $caption Document caption (may also be used when resending documents by file_id), 0-200 characters |
|
194
|
|
|
* @param int $reply_to_message_id If the message is a reply, ID of the original message |
|
195
|
|
|
* @param json $reply_markup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. |
|
196
|
|
|
* @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. |
|
197
|
|
|
* @return object |
|
198
|
|
|
*/ |
|
199
|
|
|
public function sendDocument($chat_id,$document,$caption=null,$reply_to_message_id=null,$reply_markup=null,$disable_notification=null){ |
|
200
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
201
|
|
|
} |
|
202
|
|
|
|
|
203
|
|
|
|
|
204
|
|
|
|
|
205
|
|
|
/** |
|
206
|
|
|
* Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document) |
|
207
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
208
|
|
|
* @param string $video Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data |
|
209
|
|
|
* @param string $caption Video caption (may also be used when resending videos by file_id), 0-200 characters |
|
210
|
|
|
* @param int $reply_to_message_id If the message is a reply, ID of the original message |
|
211
|
|
|
* @param json $reply_markup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. |
|
212
|
|
|
* @param int $duration Duration of sent video in seconds |
|
213
|
|
|
* @param string $width Video width |
|
214
|
|
|
* @param string $height Video height |
|
215
|
|
|
* @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. |
|
216
|
|
|
* @return object |
|
217
|
|
|
*/ |
|
218
|
|
|
public function sendVideo($chat_id,$video,$caption=null,$reply_to_message_id=null,$reply_markup=null,$duration=null,$width=null,$height=null,$disable_notification=null){ |
|
219
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
220
|
|
|
} |
|
221
|
|
|
|
|
222
|
|
|
|
|
223
|
|
|
|
|
224
|
|
|
/** |
|
225
|
|
|
* Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent as Audio or Document) |
|
226
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
227
|
|
|
* @param string $voice Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data |
|
228
|
|
|
* @param string $caption Voice message caption, 0-200 characters |
|
229
|
|
|
* @param int $reply_to_message_id If the message is a reply, ID of the original message |
|
230
|
|
|
* @param json $reply_markup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. |
|
231
|
|
|
* @param int $duration Duration of the voice message in seconds |
|
232
|
|
|
* @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. |
|
233
|
|
|
* @return object |
|
234
|
|
|
*/ |
|
235
|
|
|
public function sendVoice($chat_id,$voice,$caption=null,$reply_to_message_id=null,$reply_markup=null,$duration=null,$disable_notification=null){ |
|
236
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
237
|
|
|
} |
|
238
|
|
|
|
|
239
|
|
|
|
|
240
|
|
|
|
|
241
|
|
|
/** |
|
242
|
|
|
* As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send video messages |
|
243
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
244
|
|
|
* @param string $video_note Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. -- Sending video notes by a URL is currently unsupported -- |
|
245
|
|
|
* @param int $reply_to_message_id If the message is a reply, ID of the original message |
|
246
|
|
|
* @param json $reply_markup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. |
|
247
|
|
|
* @param int $duration Duration of sent video in seconds |
|
248
|
|
|
* @param int $length Video width and height |
|
249
|
|
|
* @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. |
|
250
|
|
|
* @return object |
|
251
|
|
|
*/ |
|
252
|
|
|
public function sendVideoNote($chat_id,$video_note,$reply_to_message_id=null,$reply_markup=null,$duration=null,$length=null,$disable_notification=null){ |
|
253
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
254
|
|
|
} |
|
255
|
|
|
|
|
256
|
|
|
|
|
257
|
|
|
|
|
258
|
|
|
/** |
|
259
|
|
|
* Use this method to send a group of photos or videos as an album |
|
260
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
261
|
|
|
* @param array $media A JSON-serialized array describing photos and videos to be sent, must include 2–10 items |
|
262
|
|
|
* @param int $reply_to_message_id If the message is a reply, ID of the original message |
|
263
|
|
|
* @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. |
|
264
|
|
|
* @return object |
|
265
|
|
|
*/ |
|
266
|
|
|
public function sendMediaGroup($chat_id,$media,$reply_to_message_id=null,$disable_notification=null){ |
|
267
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
268
|
|
|
} |
|
269
|
|
|
|
|
270
|
|
|
|
|
271
|
|
|
|
|
272
|
|
|
/** |
|
273
|
|
|
* Use this method to send point on the map |
|
274
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
275
|
|
|
* @param float $latitude Latitude of the location |
|
276
|
|
|
* @param float $longitude Longitude of the location |
|
277
|
|
|
* @param int $reply_to_message_id If the message is a reply, ID of the original message |
|
278
|
|
|
* @param json $reply_markup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. |
|
279
|
|
|
* @param int $live_period Period in seconds for which the location will be updated (see Live Locations, should be between 60 and 86400 |
|
280
|
|
|
* @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. |
|
281
|
|
|
* @return object |
|
282
|
|
|
*/ |
|
283
|
|
|
public function sendLocation($chat_id,$latitude,$longitude,$reply_to_message_id=null,$reply_markup=null,$live_period=null,$disable_notification=null){ |
|
284
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
285
|
|
|
} |
|
286
|
|
|
|
|
287
|
|
|
|
|
288
|
|
|
|
|
289
|
|
|
/** |
|
290
|
|
|
* Use this method to edit live location messages sent by the bot or via the bot (for inline bots). A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation |
|
291
|
|
|
* @param int|string $chat_id Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
292
|
|
|
* @param int $message_id Required if inline_message_id is not specified. Identifier of the sent message |
|
293
|
|
|
* @param string $inline_message_id Required if chat_id and message_id are not specified. Identifier of the inline message |
|
294
|
|
|
* @param float $latitude Latitude of new location |
|
295
|
|
|
* @param float $longitude Longitude of new location |
|
296
|
|
|
* @param json $reply_markup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. |
|
297
|
|
|
* @return object |
|
298
|
|
|
*/ |
|
299
|
|
|
public function editMessageLiveLocation($chat_id=null,$message_id=null,$inline_message_id=null,$latitude,$longitude,$reply_markup=null){ |
|
300
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
301
|
|
|
} |
|
302
|
|
|
|
|
303
|
|
|
|
|
304
|
|
|
|
|
305
|
|
|
/** |
|
306
|
|
|
* Use this method to stop updating a live location message sent by the bot or via the bot (for inline bots) before live_period expires. |
|
307
|
|
|
* @param int|string $chat_id Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
308
|
|
|
* @param int $message_id Required if inline_message_id is not specified. Identifier of the sent message |
|
309
|
|
|
* @param string $inline_message_id Required if chat_id and message_id are not specified. Identifier of the inline message |
|
310
|
|
|
* @param json $reply_markup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. |
|
311
|
|
|
* @return object |
|
312
|
|
|
*/ |
|
313
|
|
|
public function stopMessageLiveLocation($chat_id=null,$message_id=null,$inline_message_id=null,$reply_markup=null) |
|
314
|
|
|
{ |
|
315
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
316
|
|
|
} |
|
317
|
|
|
|
|
318
|
|
|
|
|
319
|
|
|
|
|
320
|
|
|
/** |
|
321
|
|
|
* Use this method to send information about a venue. |
|
322
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
323
|
|
|
* @param float $latitude Latitude of the venue |
|
324
|
|
|
* @param float $longitude Longitude of the venue |
|
325
|
|
|
* @param string $title Name of the venue |
|
326
|
|
|
* @param string $address Address of the venue |
|
327
|
|
|
* @param int $reply_to_message_id If the message is a reply, ID of the original message |
|
328
|
|
|
* @param json $reply_markup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. |
|
329
|
|
|
* @param string $foursquare_id Foursquare identifier of the venue |
|
330
|
|
|
* @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. |
|
331
|
|
|
* @return object |
|
332
|
|
|
*/ |
|
333
|
|
|
public function sendVenue($chat_id,$latitude,$longitude,$title,$address,$reply_to_message_id=null,$reply_markup=null,$foursquare_id=null,$disable_notification=null) |
|
334
|
|
|
{ |
|
335
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
336
|
|
|
} |
|
337
|
|
|
|
|
338
|
|
|
|
|
339
|
|
|
|
|
340
|
|
|
/** |
|
341
|
|
|
* Use this method to send phone contacts |
|
342
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
343
|
|
|
* @param string $phone_number Contact's phone number |
|
344
|
|
|
* @param string $first_name Contact's first name |
|
345
|
|
|
* @param string $last_name Contact's last name |
|
346
|
|
|
* @param int $reply_to_message_id If the message is a reply, ID of the original message |
|
347
|
|
|
* @param json $reply_markup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. |
|
348
|
|
|
* @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. |
|
349
|
|
|
* @return object |
|
350
|
|
|
*/ |
|
351
|
|
|
public function sendContact($chat_id,$phone_number,$first_name,$last_name=null,$reply_to_message_id=null,$reply_markup=null,$disable_notification=null) |
|
352
|
|
|
{ |
|
353
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
354
|
|
|
} |
|
355
|
|
|
|
|
356
|
|
|
|
|
357
|
|
|
|
|
358
|
|
|
/** |
|
359
|
|
|
* Use this method when you need to tell the user that something is happening on the bot's side. |
|
360
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
361
|
|
|
* @param string $action |
|
362
|
|
|
* @return object |
|
363
|
|
|
*/ |
|
364
|
|
|
public function sendChatAction($chat_id,$action) |
|
365
|
|
|
{ |
|
366
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
367
|
|
|
} |
|
368
|
|
|
|
|
369
|
|
|
|
|
370
|
|
|
|
|
371
|
|
|
/** |
|
372
|
|
|
* Use this method to get a list of profile pictures for a user |
|
373
|
|
|
* @param int $user_id Unique identifier of the target user |
|
374
|
|
|
* @param int $limit Limits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to 100. |
|
375
|
|
|
* @param int $offset Sequential number of the first photo to be returned. By default, all photos are returned. |
|
376
|
|
|
* @return object |
|
377
|
|
|
*/ |
|
378
|
|
|
public function getUserProfilePhotos($user_id,$limit=null,$offset=null) |
|
379
|
|
|
{ |
|
380
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
381
|
|
|
} |
|
382
|
|
|
|
|
383
|
|
|
|
|
384
|
|
|
|
|
385
|
|
|
/** |
|
386
|
|
|
* Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size |
|
387
|
|
|
* @param string $file_id File identifier to get info about |
|
388
|
|
|
* @return object |
|
389
|
|
|
*/ |
|
390
|
|
|
public function getFile($file_id) |
|
391
|
|
|
{ |
|
392
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
393
|
|
|
} |
|
394
|
|
|
|
|
395
|
|
|
|
|
396
|
|
|
/** |
|
397
|
|
|
* Use this method to get File link |
|
398
|
|
|
* @param string|object $file_path The file path received from the getFile function |
|
399
|
|
|
* @return string |
|
400
|
|
|
*/ |
|
401
|
|
|
public function getFileLink($file_path) |
|
402
|
|
|
{ |
|
403
|
|
|
if (is_object($file_path)) |
|
404
|
|
|
$file_path=$file_path->file_path; |
|
405
|
|
|
return 'https://api.telegram.org/file/bot'.$this->token.'/'.$file_path; |
|
406
|
|
|
} |
|
407
|
|
|
|
|
408
|
|
|
|
|
409
|
|
|
|
|
410
|
|
|
/** |
|
411
|
|
|
* Use this method to kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first |
|
412
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
413
|
|
|
* @param int $user_id Unique identifier of the target user |
|
414
|
|
|
* @param int $until_date Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever |
|
415
|
|
|
* @return object |
|
416
|
|
|
*/ |
|
417
|
|
|
public function kickChatMember($chat_id,$user_id,$until_date=null) |
|
418
|
|
|
{ |
|
419
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
420
|
|
|
} |
|
421
|
|
|
|
|
422
|
|
|
|
|
423
|
|
|
|
|
424
|
|
|
/** |
|
425
|
|
|
* Use this method to unban a previously kicked user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc |
|
426
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
427
|
|
|
* @param int $user_id Unique identifier of the target user |
|
428
|
|
|
* @return object |
|
429
|
|
|
*/ |
|
430
|
|
|
public function unbanChatMember($chat_id,$user_id) |
|
431
|
|
|
{ |
|
432
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
433
|
|
|
} |
|
434
|
|
|
|
|
435
|
|
|
|
|
436
|
|
|
|
|
437
|
|
|
/** |
|
438
|
|
|
* Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights |
|
439
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
440
|
|
|
* @param int $user_id Unique identifier of the target user |
|
441
|
|
|
* @param bool $can_send_messages Pass True, if the user can send text messages, contacts, locations and venues |
|
442
|
|
|
* @param bool $can_send_media_messages Pass True, if the user can send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages |
|
443
|
|
|
* @param bool $can_send_other_messages Pass True, if the user can send animations, games, stickers and use inline bots, implies can_send_media_messages |
|
444
|
|
|
* @param bool $can_add_web_page_previews Pass True, if the user may add web page previews to their messages, implies can_send_media_messages |
|
445
|
|
|
* @param int $until_date Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever |
|
446
|
|
|
* @return object |
|
447
|
|
|
*/ |
|
448
|
|
|
public function restrictChatMember($chat_id,$user_id,$can_send_messages=null,$can_send_media_messages=null,$can_send_other_messages=null,$can_add_web_page_previews=null,$until_date=null) |
|
449
|
|
|
{ |
|
450
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
451
|
|
|
} |
|
452
|
|
|
|
|
453
|
|
|
|
|
454
|
|
|
|
|
455
|
|
|
/** |
|
456
|
|
|
* Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights |
|
457
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
458
|
|
|
* @param int $user_id Unique identifier of the target user |
|
459
|
|
|
* @param bool $can_post_messages Pass True, if the administrator can create channel posts, channels only |
|
460
|
|
|
* @param bool $can_edit_messages Pass True, if the administrator can edit messages of other users and can pin messages, channels only |
|
461
|
|
|
* @param bool $can_delete_messages Pass True, if the administrator can delete messages of other users |
|
462
|
|
|
* @param bool $can_change_info Pass True, if the administrator can change chat title, photo and other settings |
|
463
|
|
|
* @param bool $can_pin_messages Pass True, if the administrator can pin messages, supergroups only |
|
464
|
|
|
* @param bool $can_invite_users Pass True, if the administrator can invite new users to the chat |
|
465
|
|
|
* @param bool $can_promote_members Pass True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him) |
|
466
|
|
|
* @param bool $can_restrict_members Pass True, if the administrator can restrict, ban or unban chat members |
|
467
|
|
|
* @return object |
|
468
|
|
|
*/ |
|
469
|
|
|
public function promoteChatMember($chat_id,$user_id,$can_post_messages=null,$can_edit_messages=null,$can_delete_messages=null,$can_change_info=null,$can_pin_messages=null,$can_invite_users=null,$can_promote_members=null,$can_restrict_members=null) |
|
470
|
|
|
{ |
|
471
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
472
|
|
|
} |
|
473
|
|
|
|
|
474
|
|
|
|
|
475
|
|
|
|
|
476
|
|
|
/** |
|
477
|
|
|
* Use this method to export an invite link to a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights |
|
478
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
479
|
|
|
* @return object |
|
480
|
|
|
*/ |
|
481
|
|
|
public function exportChatInviteLink($chat_id) |
|
482
|
|
|
{ |
|
483
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
484
|
|
|
} |
|
485
|
|
|
|
|
486
|
|
|
|
|
487
|
|
|
|
|
488
|
|
|
/** |
|
489
|
|
|
* Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights |
|
490
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
491
|
|
|
* @param file $photo New chat photo, uploaded using multipart/form-data |
|
492
|
|
|
* @return object |
|
493
|
|
|
*/ |
|
494
|
|
|
public function setChatPhoto($chat_id,$photo) |
|
495
|
|
|
{ |
|
496
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
497
|
|
|
} |
|
498
|
|
|
|
|
499
|
|
|
|
|
500
|
|
|
|
|
501
|
|
|
/** |
|
502
|
|
|
* Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights |
|
503
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
504
|
|
|
* @return object |
|
505
|
|
|
*/ |
|
506
|
|
|
public function deleteChatPhoto($chat_id) |
|
507
|
|
|
{ |
|
508
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
509
|
|
|
} |
|
510
|
|
|
|
|
511
|
|
|
|
|
512
|
|
|
|
|
513
|
|
|
/** |
|
514
|
|
|
* Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights |
|
515
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
516
|
|
|
* @param string $title New chat title, 1-255 characters |
|
517
|
|
|
* @return object |
|
518
|
|
|
*/ |
|
519
|
|
|
public function setChatTitle($chat_id,$title) |
|
520
|
|
|
{ |
|
521
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
522
|
|
|
} |
|
523
|
|
|
|
|
524
|
|
|
|
|
525
|
|
|
|
|
526
|
|
|
/** |
|
527
|
|
|
* Use this method to change the description of a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights |
|
528
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
529
|
|
|
* @param string $description New chat description, 0-255 characters |
|
530
|
|
|
* @return object |
|
531
|
|
|
*/ |
|
532
|
|
|
public function setChatDescription($chat_id,$description) |
|
533
|
|
|
{ |
|
534
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
535
|
|
|
} |
|
536
|
|
|
|
|
537
|
|
|
|
|
538
|
|
|
|
|
539
|
|
|
/** |
|
540
|
|
|
* Use this method to pin a message in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ admin right in the supergroup or ‘can_edit_messages’ admin right in the channel |
|
541
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
542
|
|
|
* @param string $message_id Identifier of a message to pin |
|
543
|
|
|
* @param bool $disable_notification Pass True, if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels |
|
544
|
|
|
* @return object |
|
545
|
|
|
*/ |
|
546
|
|
|
public function pinChatMessage($chat_id,$message_id,$disable_notification=null) |
|
547
|
|
|
{ |
|
548
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
549
|
|
|
} |
|
550
|
|
|
|
|
551
|
|
|
|
|
552
|
|
|
|
|
553
|
|
|
/** |
|
554
|
|
|
* Use this method to unpin a message in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ admin right in the supergroup or ‘can_edit_messages’ admin right in the channel |
|
555
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
556
|
|
|
* @return object |
|
557
|
|
|
*/ |
|
558
|
|
|
public function unpinChatMessage($chat_id) |
|
559
|
|
|
{ |
|
560
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
561
|
|
|
} |
|
562
|
|
|
|
|
563
|
|
|
|
|
564
|
|
|
|
|
565
|
|
|
/** |
|
566
|
|
|
* Use this method for your bot to leave a group, supergroup or channel |
|
567
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
568
|
|
|
* @return object |
|
569
|
|
|
*/ |
|
570
|
|
|
public function leaveChat($chat_id) |
|
571
|
|
|
{ |
|
572
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
573
|
|
|
} |
|
574
|
|
|
|
|
575
|
|
|
|
|
576
|
|
|
|
|
577
|
|
|
/** |
|
578
|
|
|
* Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.) |
|
579
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
580
|
|
|
* @return object |
|
581
|
|
|
*/ |
|
582
|
|
|
public function getChat($chat_id) |
|
583
|
|
|
{ |
|
584
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
585
|
|
|
} |
|
586
|
|
|
|
|
587
|
|
|
|
|
588
|
|
|
|
|
589
|
|
|
/** |
|
590
|
|
|
* Use this method to get a list of administrators in a chat |
|
591
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
592
|
|
|
* @return object |
|
593
|
|
|
*/ |
|
594
|
|
|
public function getChatAdministrators($chat_id) |
|
595
|
|
|
{ |
|
596
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
597
|
|
|
} |
|
598
|
|
|
|
|
599
|
|
|
|
|
600
|
|
|
|
|
601
|
|
|
/** |
|
602
|
|
|
* Use this method to get the number of members in a chat |
|
603
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
604
|
|
|
* @return object |
|
605
|
|
|
*/ |
|
606
|
|
|
public function getChatMembersCount($chat_id) |
|
607
|
|
|
{ |
|
608
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
609
|
|
|
} |
|
610
|
|
|
|
|
611
|
|
|
|
|
612
|
|
|
|
|
613
|
|
|
/** |
|
614
|
|
|
* Use this method to get information about a member of a chat |
|
615
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
616
|
|
|
* @param int $user_id Unique identifier of the target user |
|
617
|
|
|
* @return object |
|
618
|
|
|
*/ |
|
619
|
|
|
public function getChatMember($chat_id,$user_id) |
|
620
|
|
|
{ |
|
621
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
622
|
|
|
} |
|
623
|
|
|
|
|
624
|
|
|
|
|
625
|
|
|
|
|
626
|
|
|
/** |
|
627
|
|
|
* Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights |
|
628
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
629
|
|
|
* @param int $sticker_set_name Name of the sticker set to be set as the group sticker set |
|
630
|
|
|
* @return object |
|
631
|
|
|
*/ |
|
632
|
|
|
public function setChatStickerSet($chat_id,$sticker_set_name) |
|
633
|
|
|
{ |
|
634
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
635
|
|
|
} |
|
636
|
|
|
|
|
637
|
|
|
|
|
638
|
|
|
|
|
639
|
|
|
/** |
|
640
|
|
|
* Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights |
|
641
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
642
|
|
|
* @return object |
|
643
|
|
|
*/ |
|
644
|
|
|
public function deleteChatStickerSet($chat_id) |
|
645
|
|
|
{ |
|
646
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
647
|
|
|
} |
|
648
|
|
|
|
|
649
|
|
|
|
|
650
|
|
|
|
|
651
|
|
|
/** |
|
652
|
|
|
* Use this method to send answers to callback queries sent from inline keyboards |
|
653
|
|
|
* @param string $callback_query_id Unique identifier for the query to be answered |
|
654
|
|
|
* @param string $text Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters |
|
655
|
|
|
* @param bool $show_alert If true, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false. |
|
656
|
|
|
* @param string $url URL that will be opened by the user's client. |
|
657
|
|
|
* @param int $cache_time The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0. |
|
658
|
|
|
* @return object |
|
659
|
|
|
*/ |
|
660
|
|
|
public function answerCallbackQuery($callback_query_id,$text=null,$show_alert=null,$url=null,$cache_time=null) |
|
661
|
|
|
{ |
|
662
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
663
|
|
|
} |
|
664
|
|
|
|
|
665
|
|
|
|
|
666
|
|
|
|
|
667
|
|
|
/** |
|
668
|
|
|
* Use this method to send answers to an inline query |
|
669
|
|
|
* @param string $inline_query_id Unique identifier for the answered query |
|
670
|
|
|
* @param json $results A JSON-serialized array of results for the inline query |
|
671
|
|
|
* @param int $cache_time The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. |
|
672
|
|
|
* @param bool $is_personal Pass True, if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query |
|
673
|
|
|
* @param string $next_offset Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don‘t support pagination. Offset length can’t exceed 64 bytes. |
|
674
|
|
|
* @param string $switch_pm_text If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter switch_pm_parameter |
|
675
|
|
|
* @param string $switch_pm_parameter Deep-linking parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed. |
|
676
|
|
|
* @return object |
|
677
|
|
|
*/ |
|
678
|
|
|
public function answerInlineQuery($inline_query_id,$results,$cache_time=null,$is_personal=null,$next_offset=null,$switch_pm_text=null,$switch_pm_parameter=null) |
|
679
|
|
|
{ |
|
680
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
681
|
|
|
} |
|
682
|
|
|
|
|
683
|
|
|
|
|
684
|
|
|
|
|
685
|
|
|
/** |
|
686
|
|
|
* Use this method to edit text and game messages sent by the bot or via the bot (for inline bots) |
|
687
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
688
|
|
|
* @param int $message_id Required if inline_message_id is not specified. Identifier of the sent message |
|
689
|
|
|
* @param string $inline_message_id Required if chat_id and message_id are not specified. Identifier of the inline message |
|
690
|
|
|
* @param string $text New text of the message |
|
691
|
|
|
* @param json $reply_markup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. |
|
692
|
|
|
* @param string $parse_mode Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. |
|
693
|
|
|
* @param bool $disable_web_page_preview Disables link previews for links in this message |
|
694
|
|
|
* @return object |
|
695
|
|
|
*/ |
|
696
|
|
|
public function editMessageText($chat_id,$message_id,$text,$inline_message_id=null,$reply_markup=null,$parse_mode=null,$disable_web_page_preview=null) |
|
697
|
|
|
{ |
|
698
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
699
|
|
|
} |
|
700
|
|
|
|
|
701
|
|
|
|
|
702
|
|
|
|
|
703
|
|
|
/** |
|
704
|
|
|
* Use this method to edit captions of messages sent by the bot or via the bot (for inline bots) |
|
705
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
706
|
|
|
* @param int $message_id Required if inline_message_id is not specified. Identifier of the sent message |
|
707
|
|
|
* @param string $inline_message_id Required if chat_id and message_id are not specified. Identifier of the inline message |
|
708
|
|
|
* @param string $caption New caption of the message |
|
709
|
|
|
* @param json $reply_markup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. |
|
710
|
|
|
* @return object |
|
711
|
|
|
*/ |
|
712
|
|
|
public function editMessageCaption($chat_id,$message_id,$caption,$inline_message_id=null,$reply_markup=null) |
|
713
|
|
|
{ |
|
714
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
715
|
|
|
} |
|
716
|
|
|
|
|
717
|
|
|
|
|
718
|
|
|
|
|
719
|
|
|
/** |
|
720
|
|
|
* Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots) |
|
721
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
722
|
|
|
* @param int $message_id Required if inline_message_id is not specified. Identifier of the sent message |
|
723
|
|
|
* @param json $reply_markup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. |
|
724
|
|
|
* @param string $inline_message_id Required if chat_id and message_id are not specified. Identifier of the inline message |
|
725
|
|
|
* @return object |
|
726
|
|
|
*/ |
|
727
|
|
|
public function editMessageReplyMarkup($chat_id,$message_id,$reply_markup,$inline_message_id=null) |
|
728
|
|
|
{ |
|
729
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
730
|
|
|
} |
|
731
|
|
|
|
|
732
|
|
|
|
|
733
|
|
|
|
|
734
|
|
|
/** |
|
735
|
|
|
* Use this method to delete a message |
|
736
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
737
|
|
|
* @param int $message_id Identifier of the message to delete |
|
738
|
|
|
* @return object |
|
739
|
|
|
*/ |
|
740
|
|
|
public function deleteMessage($chat_id,$message_id) |
|
741
|
|
|
{ |
|
742
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
743
|
|
|
} |
|
744
|
|
|
|
|
745
|
|
|
|
|
746
|
|
|
|
|
747
|
|
|
/** |
|
748
|
|
|
* Use this method to send .webp stickers |
|
749
|
|
|
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
750
|
|
|
* @param string $sticker Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .webp file from the Internet, or upload a new one using multipart/form-data |
|
751
|
|
|
* @param int $reply_to_message_id If the message is a reply, ID of the original message |
|
752
|
|
|
* @param json $reply_markup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. |
|
753
|
|
|
* @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. |
|
754
|
|
|
* @return object |
|
755
|
|
|
*/ |
|
756
|
|
|
public function sendSticker($chat_id,$sticker,$reply_to_message_id=null,$reply_markup=null,$disable_notification=null){ |
|
757
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
758
|
|
|
} |
|
759
|
|
|
|
|
760
|
|
|
|
|
761
|
|
|
|
|
762
|
|
|
/** |
|
763
|
|
|
* Use this method to get a sticker set |
|
764
|
|
|
* @param string $name Name of the sticker set |
|
765
|
|
|
* @return object |
|
766
|
|
|
*/ |
|
767
|
|
|
public function getStickerSet($name){ |
|
768
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
769
|
|
|
} |
|
770
|
|
|
|
|
771
|
|
|
|
|
772
|
|
|
|
|
773
|
|
|
/** |
|
774
|
|
|
* Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times) |
|
775
|
|
|
* @param int $user_id User identifier of sticker file owner |
|
776
|
|
|
* @param file $png_sticker Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px |
|
777
|
|
|
* @return object |
|
778
|
|
|
*/ |
|
779
|
|
|
public function uploadStickerFile($user_id,$png_sticker){ |
|
780
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
781
|
|
|
} |
|
782
|
|
|
|
|
783
|
|
|
|
|
784
|
|
|
|
|
785
|
|
|
/** |
|
786
|
|
|
* Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set |
|
787
|
|
|
* @param int $user_id User identifier of sticker file owner |
|
788
|
|
|
* @param string $name Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals) |
|
789
|
|
|
* @param string $title Sticker set title, 1-64 characters |
|
790
|
|
|
* @param file $png_sticker Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px |
|
791
|
|
|
* @param string $emojis One or more emoji corresponding to the sticker |
|
792
|
|
|
* @param bool $contains_masks Pass True, if a set of mask stickers should be created |
|
793
|
|
|
* @param json $mask_position A JSON-serialized object for position where the mask should be placed on faces |
|
794
|
|
|
* @return object |
|
795
|
|
|
*/ |
|
796
|
|
|
public function createNewStickerSet($user_id,$name,$title,$png_sticker,$emojis,$contains_masks=null,$mask_position=null){ |
|
797
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
798
|
|
|
} |
|
799
|
|
|
|
|
800
|
|
|
|
|
801
|
|
|
|
|
802
|
|
|
/** |
|
803
|
|
|
* Use this method to add a new sticker to a set created by the bot |
|
804
|
|
|
* @param int $user_id User identifier of sticker file owner |
|
805
|
|
|
* @param string $name Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals) |
|
806
|
|
|
* @param file $png_sticker Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px |
|
807
|
|
|
* @param string $emojis One or more emoji corresponding to the sticker |
|
808
|
|
|
* @param json $mask_position A JSON-serialized object for position where the mask should be placed on faces |
|
809
|
|
|
* @return object |
|
810
|
|
|
*/ |
|
811
|
|
|
public function addStickerToSet($user_id,$name,$png_sticker,$emojis,$mask_position=null){ |
|
812
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
813
|
|
|
} |
|
814
|
|
|
|
|
815
|
|
|
|
|
816
|
|
|
|
|
817
|
|
|
/** |
|
818
|
|
|
* Use this method to move a sticker in a set created by the bot to a specific position |
|
819
|
|
|
* @param string $sticker File identifier of the sticker |
|
820
|
|
|
* @param int $position New sticker position in the set, zero-based |
|
821
|
|
|
* @return object |
|
822
|
|
|
*/ |
|
823
|
|
|
public function setStickerPositionInSet($sticker,$position){ |
|
824
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
825
|
|
|
} |
|
826
|
|
|
|
|
827
|
|
|
|
|
828
|
|
|
|
|
829
|
|
|
/** |
|
830
|
|
|
* Use this method to delete a sticker from a set created by the bot |
|
831
|
|
|
* @param string $sticker File identifier of the sticker |
|
832
|
|
|
* @return object |
|
833
|
|
|
*/ |
|
834
|
|
|
public function deleteStickerFromSet($sticker){ |
|
835
|
|
|
return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
|
|
|
|
|
836
|
|
|
} |
|
837
|
|
|
|
|
838
|
|
|
|
|
839
|
|
|
} |