Passed
Branch master (66f18e)
by Mohammadreza
05:15 queued 14s
created

tgmethod.php (1 issue)

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
            var_dump(curl_error($this->ch));
0 ignored issues
show
Security Debugging Code introduced by
var_dump(curl_error($this->ch)) looks like debug code. Are you sure you do not want to remove it?
Loading history...
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
     * A simple method for testing your bot's auth token
81
     * @return object
82
     */
83
    public function getme(){
84
        return $this->make_http_request(__FUNCTION__);
85
    }
86
87
88
89
    /**
90
     * Use this method to send text messages
91
     * @param int|string $chat_id  Unique identifier for the target chat or username of the target channel (in the format @channelusername)
92
     * @param string $text Text of the message to be sent
93
     * @param int $reply_to_message_id If the message is a reply, ID of the original message
94
     * @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.
95
     * @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.
96
     * @param bool $disable_web_page_preview Disables link previews for links in this message
97
     * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound.
98
     * @return object
99
     */
100
    public function sendMessage($chat_id,$text,$reply_to_message_id=null,$reply_markup=null,$parse_mode=null,$disable_web_page_preview=null,$disable_notification=null){
101
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
102
    }
103
104
105
106
    /**
107
     * Use this method to forward messages of any kind
108
     * @param int|string $chat_id  Unique identifier for the target chat or username of the target channel (in the format @channelusername)
109
     * @param int|string $from_chat_id Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
110
     * @param int $message_id Message identifier in the chat specified in from_chat_id
111
     * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound.
112
     * @return object
113
     */
114
    public function forwardMessage($chat_id,$from_chat_id,$message_id,$disable_notification=null){
115
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
116
    }
117
118
119
120
    /**
121
     * Use this method to send photos
122
     * @param int|string $chat_id  Unique identifier for the target chat or username of the target channel (in the format @channelusername)
123
     * @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
124
     * @param string $caption Photo caption (may also be used when resending photos by file_id), 0-200 characters
125
     * @param int $reply_to_message_id If the message is a reply, ID of the original message
126
     * @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.
127
     * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound.
128
     * @return object
129
     */
130
    public function sendPhoto($chat_id,$photo,$caption=null,$reply_to_message_id=null,$reply_markup=null,$disable_notification=null){
131
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
132
    }
133
134
135
136
    /**
137
     * 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.
138
     * @param int|string $chat_id  Unique identifier for the target chat or username of the target channel (in the format @channelusername)
139
     * @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.
140
     * @param string $caption Audio caption, 0-200 characters
141
     * @param int $reply_to_message_id If the message is a reply, ID of the original message
142
     * @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.
143
     * @param string $title Track name
144
     * @param int $duration Duration of the audio in seconds
145
     * @param string $performer Performer
146
     * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound.
147
     * @return object
148
     */
149
    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){
150
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
151
    }
152
153
154
155
    /**
156
     * Use this method to send general files
157
     * @param int|string $chat_id  Unique identifier for the target chat or username of the target channel (in the format @channelusername)
158
     * @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.
159
     * @param string $caption Document caption (may also be used when resending documents by file_id), 0-200 characters
160
     * @param int $reply_to_message_id If the message is a reply, ID of the original message
161
     * @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.
162
     * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound.
163
     * @return object
164
     */
165
    public function sendDocument($chat_id,$document,$caption=null,$reply_to_message_id=null,$reply_markup=null,$disable_notification=null){
166
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
167
    }
168
169
170
171
    /**
172
     * Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document)
173
     * @param int|string $chat_id  Unique identifier for the target chat or username of the target channel (in the format @channelusername)
174
     * @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
175
     * @param string $caption Video caption (may also be used when resending videos by file_id), 0-200 characters
176
     * @param int $reply_to_message_id If the message is a reply, ID of the original message
177
     * @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.
178
     * @param int $duration Duration of sent video in seconds
179
     * @param string $width	 Video width
180
     * @param string $height Video height
181
     * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound.
182
     * @return object
183
     */
184
    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){
185
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
186
    }
187
188
189
190
    /**
191
     * 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)
192
     * @param int|string $chat_id  Unique identifier for the target chat or username of the target channel (in the format @channelusername)
193
     * @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
194
     * @param string $caption Voice message caption, 0-200 characters
195
     * @param int $reply_to_message_id If the message is a reply, ID of the original message
196
     * @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.
197
     * @param int $duration Duration of the voice message in seconds
198
     * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound.
199
     * @return object
200
     */
201
    public function sendVoice($chat_id,$voice,$caption=null,$reply_to_message_id=null,$reply_markup=null,$duration=null,$disable_notification=null){
202
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
203
    }
204
205
206
207
    /**
208
     * 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
209
     * @param int|string $chat_id  Unique identifier for the target chat or username of the target channel (in the format @channelusername)
210
     * @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 --
211
     * @param int $reply_to_message_id If the message is a reply, ID of the original message
212
     * @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.
213
     * @param int $duration Duration of sent video in seconds
214
     * @param int $length Video width and 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 sendVideoNote($chat_id,$video_note,$reply_to_message_id=null,$reply_markup=null,$duration=null,$length=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 a group of photos or videos as an album
226
     * @param int|string $chat_id  Unique identifier for the target chat or username of the target channel (in the format @channelusername)
227
     * @param array $media A JSON-serialized array describing photos and videos to be sent, must include 2–10 items
228
     * @param int $reply_to_message_id If the message is a reply, ID of the original message
229
     * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound.
230
     * @return object
231
     */
232
    public function sendMediaGroup($chat_id,$media,$reply_to_message_id=null,$disable_notification=null){
233
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
234
    }
235
236
237
238
    /**
239
     * Use this method to send point on the map
240
     * @param int|string $chat_id  Unique identifier for the target chat or username of the target channel (in the format @channelusername)
241
     * @param float $latitude Latitude of the location
242
     * @param float $longitude Longitude of the location
243
     * @param int $reply_to_message_id If the message is a reply, ID of the original message
244
     * @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.
245
     * @param int $live_period Period in seconds for which the location will be updated (see Live Locations, should be between 60 and 86400
246
     * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound.
247
     * @return object
248
     */
249
    public function sendLocation($chat_id,$latitude,$longitude,$reply_to_message_id=null,$reply_markup=null,$live_period=null,$disable_notification=null){
250
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
251
    }
252
253
254
255
    /**
256
     * 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
257
     * @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)
258
     * @param int $message_id Required if inline_message_id is not specified. Identifier of the sent message
259
     * @param string $inline_message_id Required if chat_id and message_id are not specified. Identifier of the inline message
260
     * @param float $latitude Latitude of new location
261
     * @param float $longitude Longitude of new location
262
     * @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.
263
     * @return object
264
     */
265
    public function editMessageLiveLocation($chat_id=null,$message_id=null,$inline_message_id=null,$latitude,$longitude,$reply_markup=null){
266
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
267
    }
268
269
270
271
    /**
272
     * 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
273
     * @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)
274
     * @param int $message_id Required if inline_message_id is not specified. Identifier of the sent message
275
     * @param string $inline_message_id Required if chat_id and message_id are not specified. Identifier of the inline message
276
     * @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.
277
     * @return object
278
     */
279
    public function stopMessageLiveLocation($chat_id=null,$message_id=null,$inline_message_id=null,$reply_markup=null)
280
    {
281
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
282
    }
283
    
284
    
285
    
286
    /**
287
     * Use this method to send information about a venue.
288
     * @param int|string $chat_id  Unique identifier for the target chat or username of the target channel (in the format @channelusername)
289
     * @param float $latitude Latitude of the venue
290
     * @param float $longitude Longitude of the venue
291
     * @param string $title Name of the venue
292
     * @param string $address Address of the venue
293
     * @param int $reply_to_message_id If the message is a reply, ID of the original message
294
     * @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.
295
     * @param string $foursquare_id Foursquare identifier of the venue
296
     * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound.
297
     * @return object
298
     */
299
    public function sendVenue($chat_id,$latitude,$longitude,$title,$address,$reply_to_message_id=null,$reply_markup=null,$foursquare_id=null,$disable_notification=null)
300
    {
301
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
302
    }
303
    
304
    
305
    
306
    /**
307
     * Use this method to send phone contacts
308
     * @param int|string $chat_id  Unique identifier for the target chat or username of the target channel (in the format @channelusername)
309
     * @param string $phone_number Contact's phone number
310
     * @param string $first_name Contact's first name
311
     * @param string $last_name Contact's last name
312
     * @param int $reply_to_message_id If the message is a reply, ID of the original message
313
     * @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.
314
     * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound.
315
     * @return object
316
     */
317
    public function sendContact($chat_id,$phone_number,$first_name,$last_name=null,$reply_to_message_id=null,$reply_markup=null,$disable_notification=null)
318
    {
319
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
320
    }
321
322
323
324
    /**
325
     * Use this method when you need to tell the user that something is happening on the bot's side.
326
     * @param int|string $chat_id  Unique identifier for the target chat or username of the target channel (in the format @channelusername)
327
     * @param string $action
328
     * @return object
329
     */
330
    public function sendChatAction($chat_id,$action)
331
    {
332
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
333
    }
334
335
336
337
    /**
338
     * Use this method to get a list of profile pictures for a user
339
     * @param int $user_id Unique identifier of the target user
340
     * @param int $limit Limits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to 100.
341
     * @param int $offset Sequential number of the first photo to be returned. By default, all photos are returned.
342
     * @return object
343
     */
344
    public function getUserProfilePhotos($user_id,$limit=null,$offset=null)
345
    {
346
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
347
    }
348
349
350
351
    /**
352
     * 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
353
     * @param string $file_id File identifier to get info about
354
     * @return object
355
     */
356
    public function getFile($file_id)
357
    {
358
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
359
    }
360
361
362
    /**
363
     * Use this method to get File link
364
     * @param string $file_path The file path received from the getFile function
365
     * @return string
366
     */
367
    public function getFileLink($file_path)
368
    {
369
        if (is_object($file_path))
370
            $file_path=$file_path->file_path;
371
        return 'https://api.telegram.org/file/bot'.$this->token.'/'.$file_path;
372
    }
373
374
375
376
    /**
377
     * 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
378
     * @param int|string $chat_id  Unique identifier for the target chat or username of the target channel (in the format @channelusername)
379
     * @param int $user_id Unique identifier of the target user
380
     * @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
381
     * @return object
382
     */
383
    public function kickChatMember($chat_id,$user_id,$until_date=null)
384
    {
385
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
386
    }
387
388
389
390
    /**
391
     * 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
392
     * @param int|string $chat_id  Unique identifier for the target chat or username of the target channel (in the format @channelusername)
393
     * @param int $user_id Unique identifier of the target user
394
     * @return object
395
     */
396
    public function unbanChatMember($chat_id,$user_id)
397
    {
398
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
399
    }
400
401
402
403
    /**
404
     * 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
405
     * @param int|string $chat_id  Unique identifier for the target chat or username of the target channel (in the format @channelusername)
406
     * @param int $user_id Unique identifier of the target user
407
     * @param bool $can_send_messages Pass True, if the user can send text messages, contacts, locations and venues
408
     * @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
409
     * @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
410
     * @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
411
     * @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
412
     * @return object
413
     */
414
    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)
415
    {
416
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
417
    }
418
419
420
421
    /**
422
     * 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
423
     * @param int|string $chat_id  Unique identifier for the target chat or username of the target channel (in the format @channelusername)
424
     * @param int $user_id Unique identifier of the target user
425
     * @param bool $can_post_messages Pass True, if the administrator can create channel posts, channels only
426
     * @param bool $can_edit_messages Pass True, if the administrator can edit messages of other users and can pin messages, channels only
427
     * @param bool $can_delete_messages Pass True, if the administrator can delete messages of other users
428
     * @param bool $can_change_info Pass True, if the administrator can change chat title, photo and other settings
429
     * @param bool $can_pin_messages Pass True, if the administrator can pin messages, supergroups only
430
     * @param bool $can_invite_users Pass True, if the administrator can invite new users to the chat
431
     * @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)
432
     * @param bool $can_restrict_members Pass True, if the administrator can restrict, ban or unban chat members
433
     * @return object
434
     */
435
    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)
436
    {
437
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
438
    }
439
440
441
442
    /**
443
     * 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
444
     * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
445
     * @return object
446
     */
447
    public function exportChatInviteLink($chat_id)
448
    {
449
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
450
    }
451
452
453
454
    /**
455
     * 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
456
     * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
457
     * @param file $photo New chat photo, uploaded using multipart/form-data
458
     * @return object
459
     */
460
    public function setChatPhoto($chat_id,$photo)
461
    {
462
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
463
    }
464
465
466
467
    /**
468
     * 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
469
     * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
470
     * @return object
471
     */
472
    public function deleteChatPhoto($chat_id)
473
    {
474
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
475
    }
476
477
478
479
    /**
480
     * 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
481
     * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
482
     * @param string $title New chat title, 1-255 characters
483
     * @return object
484
     */
485
    public function setChatTitle($chat_id,$title)
486
    {
487
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
488
    }
489
490
491
492
    /**
493
     * 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
494
     * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
495
     * @param string $description New chat description, 0-255 characters
496
     * @return object
497
     */
498
    public function setChatDescription($chat_id,$description)
499
    {
500
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
501
    }
502
503
504
505
    /**
506
     * 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
507
     * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
508
     * @param string $message_id Identifier of a message to pin
509
     * @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
510
     * @return object
511
     */
512
    public function pinChatMessage($chat_id,$message_id,$disable_notification=null)
513
    {
514
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
515
    }
516
517
518
519
    /**
520
     * 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
521
     * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
522
     * @return object
523
     */
524
    public function unpinChatMessage($chat_id)
525
    {
526
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
527
    }
528
529
530
531
    /**
532
     * Use this method for your bot to leave a group, supergroup or channel
533
     * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
534
     * @return object
535
     */
536
    public function leaveChat($chat_id)
537
    {
538
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
539
    }
540
541
542
543
    /**
544
     * 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.)
545
     * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
546
     * @return object
547
     */
548
    public function getChat($chat_id)
549
    {
550
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
551
    }
552
553
554
555
    /**
556
     * Use this method to get a list of administrators in a chat
557
     * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
558
     * @return object
559
     */
560
    public function getChatAdministrators($chat_id)
561
    {
562
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
563
    }
564
565
566
567
    /**
568
     * Use this method to get the number of members in a chat
569
     * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
570
     * @return object
571
     */
572
    public function getChatMembersCount($chat_id)
573
    {
574
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
575
    }
576
577
578
579
    /**
580
     * Use this method to get information about a member of a chat
581
     * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
582
     * @param int $user_id Unique identifier of the target user
583
     * @return object
584
     */
585
    public function getChatMember($chat_id,$user_id)
586
    {
587
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
588
    }
589
590
591
592
    /**
593
     * 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
594
     * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
595
     * @param int $sticker_set_name Name of the sticker set to be set as the group sticker set
596
     * @return object
597
     */
598
    public function setChatStickerSet($chat_id,$sticker_set_name)
599
    {
600
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
601
    }
602
603
604
605
    /**
606
     * 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
607
     * @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
608
     * @return object
609
     */
610
    public function deleteChatStickerSet($chat_id)
611
    {
612
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
613
    }
614
615
616
617
    /**
618
     * Use this method to send answers to callback queries sent from inline keyboards
619
     * @param string $callback_query_id Unique identifier for the query to be answered
620
     * @param string $text Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters
621
     * @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.
622
     * @param string $url URL that will be opened by the user's client.
623
     * @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.
624
     * @return object
625
     */
626
    public function answerCallbackQuery($callback_query_id,$text=null,$show_alert=null,$url=null,$cache_time=null)
627
    {
628
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
629
    }
630
631
632
633
    /**
634
     * Use this method to send answers to an inline query
635
     * @param string $inline_query_id Unique identifier for the answered query
636
     * @param json $results A JSON-serialized array of results for the inline query
637
     * @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.
638
     * @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
639
     * @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.
640
     * @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
641
     * @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.
642
     * @return object
643
     */
644
    public function answerInlineQuery($inline_query_id,$results,$cache_time=null,$is_personal=null,$next_offset=null,$switch_pm_text=null,$switch_pm_parameter=null)
645
    {
646
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
647
    }
648
    
649
    
650
    
651
    /**
652
     * Use this method to edit text and game messages sent by the bot or via the bot (for inline bots)
653
     * @param int|string $chat_id  Unique identifier for the target chat or username of the target channel (in the format @channelusername)
654
     * @param int $message_id Required if inline_message_id is not specified. Identifier of the sent message
655
     * @param string $inline_message_id Required if chat_id and message_id are not specified. Identifier of the inline message
656
     * @param string $text New text of the message
657
     * @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.
658
     * @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.
659
     * @param bool $disable_web_page_preview Disables link previews for links in this message
660
     * @return object
661
     */
662
    public function editMessageText($chat_id,$message_id,$text,$inline_message_id=null,$reply_markup=null,$parse_mode=null,$disable_web_page_preview=null)
663
    {
664
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
665
    }
666
667
668
669
    /**
670
     * Use this method to edit captions of messages sent by the bot or via the bot (for inline bots)
671
     * @param int|string $chat_id  Unique identifier for the target chat or username of the target channel (in the format @channelusername)
672
     * @param int $message_id Required if inline_message_id is not specified. Identifier of the sent message
673
     * @param string $inline_message_id Required if chat_id and message_id are not specified. Identifier of the inline message
674
     * @param string $caption New caption of the message
675
     * @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.
676
     * @return object
677
     */
678
    public function editMessageCaption($chat_id,$message_id,$caption,$inline_message_id=null,$reply_markup=null)
679
    {
680
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
681
    }
682
683
684
685
    /**
686
     * Use this method to edit only the reply markup of 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 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.
691
     * @return object
692
     */
693
    public function editMessageReplyMarkup($chat_id,$message_id,$inline_message_id=null,$reply_markup=null)
694
    {
695
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
696
    }
697
698
699
700
    /**
701
     * Use this method to delete a message
702
     * @param int|string $chat_id  Unique identifier for the target chat or username of the target channel (in the format @channelusername)
703
     * @param int $message_id Identifier of the message to delete
704
     * @return object
705
     */
706
    public function deleteMessage($chat_id,$message_id)
707
    {
708
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
709
    }
710
711
712
713
    /**
714
     * Use this method to send .webp stickers
715
     * @param int|string $chat_id  Unique identifier for the target chat or username of the target channel (in the format @channelusername)
716
     * @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
717
     * @param int $reply_to_message_id If the message is a reply, ID of the original message
718
     * @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.
719
     * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound.
720
     * @return object
721
     */
722
    public function sendSticker($chat_id,$sticker,$reply_to_message_id=null,$reply_markup=null,$disable_notification=null){
723
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
724
    }
725
726
727
728
    /**
729
     * Use this method to get a sticker set
730
     * @param string $name Name of the sticker set
731
     * @return object
732
     */
733
    public function getStickerSet($name){
734
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
735
    }
736
737
738
739
    /**
740
     * Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times)
741
     * @param int $user_id User identifier of sticker file owner
742
     * @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
743
     * @return object
744
     */
745
    public function uploadStickerFile($user_id,$png_sticker){
746
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
747
    }
748
749
750
751
    /**
752
     * Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set
753
     * @param int $user_id User identifier of sticker file owner
754
     * @param string $name Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals)
755
     * @param string $title Sticker set title, 1-64 characters
756
     * @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
757
     * @param string $emojis One or more emoji corresponding to the sticker
758
     * @param bool $contains_masks Pass True, if a set of mask stickers should be created
759
     * @param json $mask_position A JSON-serialized object for position where the mask should be placed on faces
760
     * @return object
761
     */
762
    public function createNewStickerSet($user_id,$name,$title,$png_sticker,$emojis,$contains_masks=null,$mask_position=null){
763
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
764
    }
765
766
767
768
    /**
769
     * Use this method to add a new sticker to a set created by the bot
770
     * @param int $user_id User identifier of sticker file owner
771
     * @param string $name Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals)
772
     * @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
773
     * @param string $emojis One or more emoji corresponding to the sticker
774
     * @param json $mask_position A JSON-serialized object for position where the mask should be placed on faces
775
     * @return object
776
     */
777
    public function addStickerToSet($user_id,$name,$png_sticker,$emojis,$mask_position=null){
778
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
779
    }
780
781
782
783
    /**
784
     * Use this method to move a sticker in a set created by the bot to a specific position
785
     * @param string $sticker File identifier of the sticker
786
     * @param int $position New sticker position in the set, zero-based
787
     * @return object
788
     */
789
    public function setStickerPositionInSet($sticker,$position){
790
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
791
    }
792
793
794
795
    /**
796
     * Use this method to delete a sticker from a set created by the bot
797
     * @param string $sticker File identifier of the sticker
798
     * @return object
799
     */
800
    public function deleteStickerFromSet($sticker){
801
        return $this->make_http_request(__FUNCTION__,(object) get_defined_vars());
802
    }
803
804
805
}