@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | class tgmethod |
| 8 | 8 | { |
| 9 | 9 | // Telegram Token |
| 10 | - protected $token=null; |
|
| 10 | + protected $token = null; |
|
| 11 | 11 | |
| 12 | 12 | protected $ch; |
| 13 | 13 | |
@@ -18,8 +18,8 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public function __construct($api_token) |
| 20 | 20 | { |
| 21 | - $this->token=$api_token; |
|
| 22 | - if (strlen($this->token)==45 && count(explode(':',$this->token))==2){ |
|
| 21 | + $this->token = $api_token; |
|
| 22 | + if (strlen($this->token) == 45 && count(explode(':', $this->token)) == 2) { |
|
| 23 | 23 | $this->ch = curl_init(); |
| 24 | 24 | return true; |
| 25 | 25 | } |
@@ -41,19 +41,19 @@ discard block |
||
| 41 | 41 | * @param array $datas Datas for Send to Telegram |
| 42 | 42 | * @return object |
| 43 | 43 | */ |
| 44 | - private function make_http_request($method,$datas=[]){ |
|
| 44 | + private function make_http_request($method, $datas = []) { |
|
| 45 | 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); |
|
| 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 | 49 | $res = curl_exec($this->ch); |
| 50 | - if(curl_error($this->ch)){ |
|
| 50 | + if (curl_error($this->ch)) { |
|
| 51 | 51 | return false; |
| 52 | - }else{ |
|
| 53 | - $res=json_decode($res); |
|
| 54 | - if ($res->ok){ |
|
| 55 | - $res=$res->result; |
|
| 56 | - $res->ok=true; |
|
| 52 | + } else { |
|
| 53 | + $res = json_decode($res); |
|
| 54 | + if ($res->ok) { |
|
| 55 | + $res = $res->result; |
|
| 56 | + $res->ok = true; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | return $res; |
@@ -84,8 +84,8 @@ discard block |
||
| 84 | 84 | * @param file $certificate Upload your public key certificate so that the root certificate in use can be checked |
| 85 | 85 | * @return object |
| 86 | 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()); |
|
| 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 | 89 | } |
| 90 | 90 | |
| 91 | 91 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * Use this method to remove webhook integration if you decide to switch back to getUpdates |
| 95 | 95 | * @return object |
| 96 | 96 | */ |
| 97 | - public function deleteWebhook(){ |
|
| 97 | + public function deleteWebhook() { |
|
| 98 | 98 | return $this->make_http_request(__FUNCTION__); |
| 99 | 99 | } |
| 100 | 100 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | * Use this method to get current webhook status. Requires no parameters |
| 105 | 105 | * @return object |
| 106 | 106 | */ |
| 107 | - public function getWebhookInfo(){ |
|
| 107 | + public function getWebhookInfo() { |
|
| 108 | 108 | return $this->make_http_request(__FUNCTION__); |
| 109 | 109 | } |
| 110 | 110 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * A simple method for testing your bot's auth token |
| 115 | 115 | * @return object |
| 116 | 116 | */ |
| 117 | - public function getme(){ |
|
| 117 | + public function getme() { |
|
| 118 | 118 | return $this->make_http_request(__FUNCTION__); |
| 119 | 119 | } |
| 120 | 120 | |
@@ -131,8 +131,8 @@ discard block |
||
| 131 | 131 | * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. |
| 132 | 132 | * @return object |
| 133 | 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()); |
|
| 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 | 136 | } |
| 137 | 137 | |
| 138 | 138 | |
@@ -145,8 +145,8 @@ discard block |
||
| 145 | 145 | * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. |
| 146 | 146 | * @return object |
| 147 | 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()); |
|
| 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 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
@@ -161,8 +161,8 @@ discard block |
||
| 161 | 161 | * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. |
| 162 | 162 | * @return object |
| 163 | 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()); |
|
| 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 | 166 | } |
| 167 | 167 | |
| 168 | 168 | |
@@ -180,8 +180,8 @@ discard block |
||
| 180 | 180 | * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. |
| 181 | 181 | * @return object |
| 182 | 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()); |
|
| 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 | 185 | } |
| 186 | 186 | |
| 187 | 187 | |
@@ -196,8 +196,8 @@ discard block |
||
| 196 | 196 | * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. |
| 197 | 197 | * @return object |
| 198 | 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()); |
|
| 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 | 201 | } |
| 202 | 202 | |
| 203 | 203 | |
@@ -215,8 +215,8 @@ discard block |
||
| 215 | 215 | * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. |
| 216 | 216 | * @return object |
| 217 | 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()); |
|
| 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 | 220 | } |
| 221 | 221 | |
| 222 | 222 | |
@@ -232,8 +232,8 @@ discard block |
||
| 232 | 232 | * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. |
| 233 | 233 | * @return object |
| 234 | 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()); |
|
| 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 | 237 | } |
| 238 | 238 | |
| 239 | 239 | |
@@ -249,8 +249,8 @@ discard block |
||
| 249 | 249 | * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. |
| 250 | 250 | * @return object |
| 251 | 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()); |
|
| 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 | 254 | } |
| 255 | 255 | |
| 256 | 256 | |
@@ -263,8 +263,8 @@ discard block |
||
| 263 | 263 | * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. |
| 264 | 264 | * @return object |
| 265 | 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()); |
|
| 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 | 268 | } |
| 269 | 269 | |
| 270 | 270 | |
@@ -280,8 +280,8 @@ discard block |
||
| 280 | 280 | * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. |
| 281 | 281 | * @return object |
| 282 | 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()); |
|
| 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 | 285 | } |
| 286 | 286 | |
| 287 | 287 | |
@@ -296,8 +296,8 @@ discard block |
||
| 296 | 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 | 297 | * @return object |
| 298 | 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()); |
|
| 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 | 301 | } |
| 302 | 302 | |
| 303 | 303 | |
@@ -310,9 +310,9 @@ discard block |
||
| 310 | 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 | 311 | * @return object |
| 312 | 312 | */ |
| 313 | - public function stopMessageLiveLocation($chat_id=null,$message_id=null,$inline_message_id=null,$reply_markup=null) |
|
| 313 | + public function stopMessageLiveLocation($chat_id = null, $message_id = null, $inline_message_id = null, $reply_markup = null) |
|
| 314 | 314 | { |
| 315 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 315 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | |
@@ -330,9 +330,9 @@ discard block |
||
| 330 | 330 | * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. |
| 331 | 331 | * @return object |
| 332 | 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) |
|
| 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 | 334 | { |
| 335 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 335 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | |
@@ -348,9 +348,9 @@ discard block |
||
| 348 | 348 | * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. |
| 349 | 349 | * @return object |
| 350 | 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) |
|
| 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 | 352 | { |
| 353 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 353 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | |
@@ -361,9 +361,9 @@ discard block |
||
| 361 | 361 | * @param string $action |
| 362 | 362 | * @return object |
| 363 | 363 | */ |
| 364 | - public function sendChatAction($chat_id,$action) |
|
| 364 | + public function sendChatAction($chat_id, $action) |
|
| 365 | 365 | { |
| 366 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 366 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | |
@@ -375,9 +375,9 @@ discard block |
||
| 375 | 375 | * @param int $offset Sequential number of the first photo to be returned. By default, all photos are returned. |
| 376 | 376 | * @return object |
| 377 | 377 | */ |
| 378 | - public function getUserProfilePhotos($user_id,$limit=null,$offset=null) |
|
| 378 | + public function getUserProfilePhotos($user_id, $limit = null, $offset = null) |
|
| 379 | 379 | { |
| 380 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 380 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | */ |
| 390 | 390 | public function getFile($file_id) |
| 391 | 391 | { |
| 392 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 392 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | public function getFileLink($file_path) |
| 402 | 402 | { |
| 403 | 403 | if (is_object($file_path)) |
| 404 | - $file_path=$file_path->file_path; |
|
| 404 | + $file_path = $file_path->file_path; |
|
| 405 | 405 | return 'https://api.telegram.org/file/bot'.$this->token.'/'.$file_path; |
| 406 | 406 | } |
| 407 | 407 | |
@@ -414,9 +414,9 @@ discard block |
||
| 414 | 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 | 415 | * @return object |
| 416 | 416 | */ |
| 417 | - public function kickChatMember($chat_id,$user_id,$until_date=null) |
|
| 417 | + public function kickChatMember($chat_id, $user_id, $until_date = null) |
|
| 418 | 418 | { |
| 419 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 419 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | |
@@ -427,9 +427,9 @@ discard block |
||
| 427 | 427 | * @param int $user_id Unique identifier of the target user |
| 428 | 428 | * @return object |
| 429 | 429 | */ |
| 430 | - public function unbanChatMember($chat_id,$user_id) |
|
| 430 | + public function unbanChatMember($chat_id, $user_id) |
|
| 431 | 431 | { |
| 432 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 432 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | |
@@ -445,9 +445,9 @@ discard block |
||
| 445 | 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 | 446 | * @return object |
| 447 | 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) |
|
| 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 | 449 | { |
| 450 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 450 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | |
@@ -466,9 +466,9 @@ discard block |
||
| 466 | 466 | * @param bool $can_restrict_members Pass True, if the administrator can restrict, ban or unban chat members |
| 467 | 467 | * @return object |
| 468 | 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) |
|
| 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 | 470 | { |
| 471 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 471 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | */ |
| 481 | 481 | public function exportChatInviteLink($chat_id) |
| 482 | 482 | { |
| 483 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 483 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | |
@@ -491,9 +491,9 @@ discard block |
||
| 491 | 491 | * @param file $photo New chat photo, uploaded using multipart/form-data |
| 492 | 492 | * @return object |
| 493 | 493 | */ |
| 494 | - public function setChatPhoto($chat_id,$photo) |
|
| 494 | + public function setChatPhoto($chat_id, $photo) |
|
| 495 | 495 | { |
| 496 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 496 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | */ |
| 506 | 506 | public function deleteChatPhoto($chat_id) |
| 507 | 507 | { |
| 508 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 508 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 509 | 509 | } |
| 510 | 510 | |
| 511 | 511 | |
@@ -516,9 +516,9 @@ discard block |
||
| 516 | 516 | * @param string $title New chat title, 1-255 characters |
| 517 | 517 | * @return object |
| 518 | 518 | */ |
| 519 | - public function setChatTitle($chat_id,$title) |
|
| 519 | + public function setChatTitle($chat_id, $title) |
|
| 520 | 520 | { |
| 521 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 521 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 522 | 522 | } |
| 523 | 523 | |
| 524 | 524 | |
@@ -529,9 +529,9 @@ discard block |
||
| 529 | 529 | * @param string $description New chat description, 0-255 characters |
| 530 | 530 | * @return object |
| 531 | 531 | */ |
| 532 | - public function setChatDescription($chat_id,$description) |
|
| 532 | + public function setChatDescription($chat_id, $description) |
|
| 533 | 533 | { |
| 534 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 534 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 535 | 535 | } |
| 536 | 536 | |
| 537 | 537 | |
@@ -543,9 +543,9 @@ discard block |
||
| 543 | 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 | 544 | * @return object |
| 545 | 545 | */ |
| 546 | - public function pinChatMessage($chat_id,$message_id,$disable_notification=null) |
|
| 546 | + public function pinChatMessage($chat_id, $message_id, $disable_notification = null) |
|
| 547 | 547 | { |
| 548 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 548 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | */ |
| 558 | 558 | public function unpinChatMessage($chat_id) |
| 559 | 559 | { |
| 560 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 560 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 561 | 561 | } |
| 562 | 562 | |
| 563 | 563 | |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | */ |
| 570 | 570 | public function leaveChat($chat_id) |
| 571 | 571 | { |
| 572 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 572 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | */ |
| 582 | 582 | public function getChat($chat_id) |
| 583 | 583 | { |
| 584 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 584 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | */ |
| 594 | 594 | public function getChatAdministrators($chat_id) |
| 595 | 595 | { |
| 596 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 596 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 597 | 597 | } |
| 598 | 598 | |
| 599 | 599 | |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | */ |
| 606 | 606 | public function getChatMembersCount($chat_id) |
| 607 | 607 | { |
| 608 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 608 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | |
@@ -616,9 +616,9 @@ discard block |
||
| 616 | 616 | * @param int $user_id Unique identifier of the target user |
| 617 | 617 | * @return object |
| 618 | 618 | */ |
| 619 | - public function getChatMember($chat_id,$user_id) |
|
| 619 | + public function getChatMember($chat_id, $user_id) |
|
| 620 | 620 | { |
| 621 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 621 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 622 | 622 | } |
| 623 | 623 | |
| 624 | 624 | |
@@ -629,9 +629,9 @@ discard block |
||
| 629 | 629 | * @param int $sticker_set_name Name of the sticker set to be set as the group sticker set |
| 630 | 630 | * @return object |
| 631 | 631 | */ |
| 632 | - public function setChatStickerSet($chat_id,$sticker_set_name) |
|
| 632 | + public function setChatStickerSet($chat_id, $sticker_set_name) |
|
| 633 | 633 | { |
| 634 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 634 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 635 | 635 | } |
| 636 | 636 | |
| 637 | 637 | |
@@ -643,7 +643,7 @@ discard block |
||
| 643 | 643 | */ |
| 644 | 644 | public function deleteChatStickerSet($chat_id) |
| 645 | 645 | { |
| 646 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 646 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 647 | 647 | } |
| 648 | 648 | |
| 649 | 649 | |
@@ -657,9 +657,9 @@ discard block |
||
| 657 | 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 | 658 | * @return object |
| 659 | 659 | */ |
| 660 | - public function answerCallbackQuery($callback_query_id,$text=null,$show_alert=null,$url=null,$cache_time=null) |
|
| 660 | + public function answerCallbackQuery($callback_query_id, $text = null, $show_alert = null, $url = null, $cache_time = null) |
|
| 661 | 661 | { |
| 662 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 662 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 663 | 663 | } |
| 664 | 664 | |
| 665 | 665 | |
@@ -675,9 +675,9 @@ discard block |
||
| 675 | 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 | 676 | * @return object |
| 677 | 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) |
|
| 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 | 679 | { |
| 680 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 680 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 681 | 681 | } |
| 682 | 682 | |
| 683 | 683 | |
@@ -693,9 +693,9 @@ discard block |
||
| 693 | 693 | * @param bool $disable_web_page_preview Disables link previews for links in this message |
| 694 | 694 | * @return object |
| 695 | 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) |
|
| 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 | 697 | { |
| 698 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 698 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 699 | 699 | } |
| 700 | 700 | |
| 701 | 701 | |
@@ -709,9 +709,9 @@ discard block |
||
| 709 | 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 | 710 | * @return object |
| 711 | 711 | */ |
| 712 | - public function editMessageCaption($chat_id,$message_id,$caption,$inline_message_id=null,$reply_markup=null) |
|
| 712 | + public function editMessageCaption($chat_id, $message_id, $caption, $inline_message_id = null, $reply_markup = null) |
|
| 713 | 713 | { |
| 714 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 714 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 715 | 715 | } |
| 716 | 716 | |
| 717 | 717 | |
@@ -724,9 +724,9 @@ discard block |
||
| 724 | 724 | * @param string $inline_message_id Required if chat_id and message_id are not specified. Identifier of the inline message |
| 725 | 725 | * @return object |
| 726 | 726 | */ |
| 727 | - public function editMessageReplyMarkup($chat_id,$message_id,$reply_markup,$inline_message_id=null) |
|
| 727 | + public function editMessageReplyMarkup($chat_id, $message_id, $reply_markup, $inline_message_id = null) |
|
| 728 | 728 | { |
| 729 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 729 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 730 | 730 | } |
| 731 | 731 | |
| 732 | 732 | |
@@ -737,9 +737,9 @@ discard block |
||
| 737 | 737 | * @param int $message_id Identifier of the message to delete |
| 738 | 738 | * @return object |
| 739 | 739 | */ |
| 740 | - public function deleteMessage($chat_id,$message_id) |
|
| 740 | + public function deleteMessage($chat_id, $message_id) |
|
| 741 | 741 | { |
| 742 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 742 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 743 | 743 | } |
| 744 | 744 | |
| 745 | 745 | |
@@ -753,8 +753,8 @@ discard block |
||
| 753 | 753 | * @param bool $disable_notification Sends the message silently. Users will receive a notification with no sound. |
| 754 | 754 | * @return object |
| 755 | 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()); |
|
| 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 | 758 | } |
| 759 | 759 | |
| 760 | 760 | |
@@ -764,8 +764,8 @@ discard block |
||
| 764 | 764 | * @param string $name Name of the sticker set |
| 765 | 765 | * @return object |
| 766 | 766 | */ |
| 767 | - public function getStickerSet($name){ |
|
| 768 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 767 | + public function getStickerSet($name) { |
|
| 768 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 769 | 769 | } |
| 770 | 770 | |
| 771 | 771 | |
@@ -776,8 +776,8 @@ discard block |
||
| 776 | 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 | 777 | * @return object |
| 778 | 778 | */ |
| 779 | - public function uploadStickerFile($user_id,$png_sticker){ |
|
| 780 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 779 | + public function uploadStickerFile($user_id, $png_sticker) { |
|
| 780 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 781 | 781 | } |
| 782 | 782 | |
| 783 | 783 | |
@@ -793,8 +793,8 @@ discard block |
||
| 793 | 793 | * @param json $mask_position A JSON-serialized object for position where the mask should be placed on faces |
| 794 | 794 | * @return object |
| 795 | 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()); |
|
| 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 | 798 | } |
| 799 | 799 | |
| 800 | 800 | |
@@ -808,8 +808,8 @@ discard block |
||
| 808 | 808 | * @param json $mask_position A JSON-serialized object for position where the mask should be placed on faces |
| 809 | 809 | * @return object |
| 810 | 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()); |
|
| 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 | 813 | } |
| 814 | 814 | |
| 815 | 815 | |
@@ -820,8 +820,8 @@ discard block |
||
| 820 | 820 | * @param int $position New sticker position in the set, zero-based |
| 821 | 821 | * @return object |
| 822 | 822 | */ |
| 823 | - public function setStickerPositionInSet($sticker,$position){ |
|
| 824 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 823 | + public function setStickerPositionInSet($sticker, $position) { |
|
| 824 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 825 | 825 | } |
| 826 | 826 | |
| 827 | 827 | |
@@ -831,8 +831,8 @@ discard block |
||
| 831 | 831 | * @param string $sticker File identifier of the sticker |
| 832 | 832 | * @return object |
| 833 | 833 | */ |
| 834 | - public function deleteStickerFromSet($sticker){ |
|
| 835 | - return $this->make_http_request(__FUNCTION__,(object) get_defined_vars()); |
|
| 834 | + public function deleteStickerFromSet($sticker) { |
|
| 835 | + return $this->make_http_request(__FUNCTION__, (object) get_defined_vars()); |
|
| 836 | 836 | } |
| 837 | 837 | |
| 838 | 838 | |
@@ -22,9 +22,9 @@ discard block |
||
| 22 | 22 | if (strlen($this->token)==45 && count(explode(':',$this->token))==2){ |
| 23 | 23 | $this->ch = curl_init(); |
| 24 | 24 | return true; |
| 25 | + } else { |
|
| 26 | + return false; |
|
| 25 | 27 | } |
| 26 | - else |
|
| 27 | - return false; |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $res = curl_exec($this->ch); |
| 50 | 50 | if(curl_error($this->ch)){ |
| 51 | 51 | return false; |
| 52 | - }else{ |
|
| 52 | + } else{ |
|
| 53 | 53 | $res=json_decode($res); |
| 54 | 54 | if ($res->ok){ |
| 55 | 55 | $res=$res->result; |
@@ -400,8 +400,9 @@ discard block |
||
| 400 | 400 | */ |
| 401 | 401 | public function getFileLink($file_path) |
| 402 | 402 | { |
| 403 | - if (is_object($file_path)) |
|
| 404 | - $file_path=$file_path->file_path; |
|
| 403 | + if (is_object($file_path)) { |
|
| 404 | + $file_path=$file_path->file_path; |
|
| 405 | + } |
|
| 405 | 406 | return 'https://api.telegram.org/file/bot'.$this->token.'/'.$file_path; |
| 406 | 407 | } |
| 407 | 408 | |