@@ -16,17 +16,17 @@ discard block |
||
| 16 | 16 | /** |
| 17 | 17 | * @internal Only for BPT self usage , Don't use it in your source! |
| 18 | 18 | */ |
| 19 | - public static function init(string $method,array $data) { |
|
| 19 | + public static function init(string $method, array $data) { |
|
| 20 | 20 | $info = self::getInfo($data); |
| 21 | 21 | $data = $info['data']; |
| 22 | 22 | $handler = $info['handler']; |
| 23 | - self::setTimeout($data,$handler,$method); |
|
| 23 | + self::setTimeout($data, $handler, $method); |
|
| 24 | 24 | self::setData($data); |
| 25 | 25 | $data['method'] = $method; |
| 26 | 26 | curl_setopt($handler, CURLOPT_POSTFIELDS, $data); |
| 27 | 27 | $result = curl_exec($handler); |
| 28 | 28 | if (curl_errno($handler)) { |
| 29 | - logger::write(curl_error($handler),loggerTypes::WARNING); |
|
| 29 | + logger::write(curl_error($handler), loggerTypes::WARNING); |
|
| 30 | 30 | } |
| 31 | 31 | if ($info['token'] != settings::$token) { |
| 32 | 32 | curl_close($handler); |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | curl_setopt($curl_handler, CURLOPT_RETURNTRANSFER, true); |
| 43 | 43 | curl_setopt($curl_handler, CURLOPT_SSL_VERIFYPEER, false); |
| 44 | 44 | } |
| 45 | - else{ |
|
| 45 | + else { |
|
| 46 | 46 | $token = settings::$token; |
| 47 | - if (!isset(self::$curl_handler)){ |
|
| 47 | + if (!isset(self::$curl_handler)) { |
|
| 48 | 48 | self::$curl_handler = curl_init(settings::$base_url."/bot$token/"); |
| 49 | 49 | curl_setopt(self::$curl_handler, CURLOPT_RETURNTRANSFER, true); |
| 50 | 50 | curl_setopt(self::$curl_handler, CURLOPT_SSL_VERIFYPEER, false); |
@@ -60,22 +60,22 @@ discard block |
||
| 60 | 60 | ]; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - private static function setTimeout(array &$data , CurlHandle $curl_handler,string $method): void { |
|
| 63 | + private static function setTimeout(array &$data, CurlHandle $curl_handler, string $method): void { |
|
| 64 | 64 | if (isset($data['forgot'])) { |
| 65 | 65 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, settings::$forgot_time); |
| 66 | 66 | unset($data['forgot']); |
| 67 | 67 | } |
| 68 | - elseif ($method === 'getUpdates' || $method === 'setWebhook'){ |
|
| 68 | + elseif ($method === 'getUpdates' || $method === 'setWebhook') { |
|
| 69 | 69 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, 5000); |
| 70 | 70 | } |
| 71 | - else{ |
|
| 71 | + else { |
|
| 72 | 72 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, settings::$base_timeout); |
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | private static function setData(array &$data): void { |
| 77 | - foreach ($data as &$value){ |
|
| 78 | - if (is_array($value) || (is_object($value) && !is_a($value,'CURLFile'))){ |
|
| 77 | + foreach ($data as &$value) { |
|
| 78 | + if (is_array($value) || (is_object($value) && !is_a($value, 'CURLFile'))) { |
|
| 79 | 79 | $value = json_encode($value); |
| 80 | 80 | } |
| 81 | 81 | } |
@@ -41,8 +41,7 @@ discard block |
||
| 41 | 41 | $curl_handler = curl_init(settings::$base_url."/bot$token/"); |
| 42 | 42 | curl_setopt($curl_handler, CURLOPT_RETURNTRANSFER, true); |
| 43 | 43 | curl_setopt($curl_handler, CURLOPT_SSL_VERIFYPEER, false); |
| 44 | - } |
|
| 45 | - else{ |
|
| 44 | + } else{ |
|
| 46 | 45 | $token = settings::$token; |
| 47 | 46 | if (!isset(self::$curl_handler)){ |
| 48 | 47 | self::$curl_handler = curl_init(settings::$base_url."/bot$token/"); |
@@ -64,11 +63,9 @@ discard block |
||
| 64 | 63 | if (isset($data['forgot'])) { |
| 65 | 64 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, settings::$forgot_time); |
| 66 | 65 | unset($data['forgot']); |
| 67 | - } |
|
| 68 | - elseif ($method === 'getUpdates' || $method === 'setWebhook'){ |
|
| 66 | + } elseif ($method === 'getUpdates' || $method === 'setWebhook'){ |
|
| 69 | 67 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, 5000); |
| 70 | - } |
|
| 71 | - else{ |
|
| 68 | + } else{ |
|
| 72 | 69 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, settings::$base_timeout); |
| 73 | 70 | } |
| 74 | 71 | } |
@@ -480,95 +480,95 @@ discard block |
||
| 480 | 480 | ]; |
| 481 | 481 | |
| 482 | 482 | private const METHODS_KEYS = [ |
| 483 | - 'getUpdates' => ['offset','limit','timeout','allowed_updates','token','return_array','forgot','answer'], |
|
| 484 | - 'setWebhook' => ['url','certificate','ip_address','max_connections','allowed_updates','drop_pending_updates','secret_token','token','return_array','forgot','answer'], |
|
| 485 | - 'deleteWebhook' => ['drop_pending_updates','token','return_array','forgot','answer'], |
|
| 486 | - 'getWebhookInfo' => ['token','return_array','forgot','answer'], |
|
| 487 | - 'getMe' => ['token','return_array','forgot','answer'], |
|
| 488 | - 'logOut' => ['token','return_array','forgot','answer'], |
|
| 489 | - 'close' => ['token','return_array','forgot','answer'], |
|
| 490 | - 'sendMessage' => ['text','chat_id','parse_mode','entities','disable_web_page_preview','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'], |
|
| 491 | - 'forwardMessage' => ['chat_id','from_chat_id','disable_notification','protect_content','message_id','token','return_array','forgot','answer'], |
|
| 492 | - 'copyMessage' => ['chat_id','from_chat_id','message_id','caption','parse_mode','caption_entities','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'], |
|
| 493 | - 'sendPhoto' => ['photo','chat_id','caption','parse_mode','caption_entities','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'], |
|
| 494 | - 'sendAudio' => ['audio','chat_id','caption','parse_mode','caption_entities','duration','performer','title','thumb','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'], |
|
| 495 | - 'sendDocument' => ['document','chat_id','thumb','caption','parse_mode','caption_entities','disable_content_type_detection','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'], |
|
| 496 | - 'sendVideo' => ['video','chat_id','duration','width','height','thumb','caption','parse_mode','caption_entities','supports_streaming','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'], |
|
| 497 | - 'sendAnimation' => ['animation','chat_id','duration','width','height','thumb','caption','parse_mode','caption_entities','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'], |
|
| 498 | - 'sendVoice' => ['voice','chat_id','caption','parse_mode','caption_entities','duration','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'], |
|
| 499 | - 'sendVideoNote' => ['video_note','chat_id','duration','length','thumb','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'], |
|
| 500 | - 'sendMediaGroup' => ['media','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','token','return_array','forgot','answer'], |
|
| 501 | - 'sendLocation' => ['latitude','longitude','chat_id','horizontal_accuracy','live_period','heading','proximity_alert_radius','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'], |
|
| 502 | - 'editMessageLiveLocation' => ['latitude','longitude','chat_id','message_id','inline_message_id','horizontal_accuracy','heading','proximity_alert_radius','reply_markup','token','return_array','forgot','answer'], |
|
| 503 | - 'stopMessageLiveLocation' => ['chat_id','message_id','inline_message_id','reply_markup','token','return_array','forgot','answer'], |
|
| 504 | - 'sendVenue' => ['chat_id','latitude','longitude','title','address','foursquare_id','foursquare_type','google_place_id','google_place_type','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'], |
|
| 505 | - 'sendContact' => ['phone_number','first_name','chat_id','last_name','vcard','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'], |
|
| 506 | - 'sendPoll' => ['question','options','chat_id','is_anonymous','type','allows_multiple_answers','correct_option_id','explanation','explanation_parse_mode','explanation_entities','open_period','close_date','is_closed','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'], |
|
| 507 | - 'sendDice' => ['chat_id','emoji','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'], |
|
| 508 | - 'sendChatAction' => ['chat_id','action','token','return_array','forgot','answer'], |
|
| 509 | - 'getUserProfilePhotos' => ['user_id','offset','limit','token','return_array','forgot','answer'], |
|
| 510 | - 'getFile' => ['file_id','token','return_array','forgot','answer'], |
|
| 511 | - 'banChatMember' => ['chat_id','user_id','until_date','revoke_messages','token','return_array','forgot','answer'], |
|
| 512 | - 'unbanChatMember' => ['chat_id','user_id','only_if_banned','token','return_array','forgot','answer'], |
|
| 513 | - 'restrictChatMember' => ['permissions','chat_id','user_id','until_date','token','return_array','forgot','answer'], |
|
| 514 | - 'promoteChatMember' => ['chat_id','user_id','is_anonymous','can_manage_chat','can_post_messages','can_edit_messages','can_delete_messages','can_manage_video_chats','can_restrict_members','can_promote_members','can_change_info','can_invite_users','can_pin_messages','token','return_array','forgot','answer'], |
|
| 515 | - 'setChatAdministratorCustomTitle' => ['custom_title','chat_id','user_id','token','return_array','forgot','answer'], |
|
| 516 | - 'banChatSenderChat' => ['sender_chat_id','chat_id','token','return_array','forgot','answer'], |
|
| 517 | - 'unbanChatSenderChat' => ['sender_chat_id','chat_id','token','return_array','forgot','answer'], |
|
| 518 | - 'setChatPermissions' => ['permissions','chat_id','token','return_array','forgot','answer'], |
|
| 519 | - 'exportChatInviteLink' => ['chat_id','token','return_array','forgot','answer'], |
|
| 520 | - 'createChatInviteLink' => ['chat_id','name','expire_date','member_limit','creates_join_request','token','return_array','forgot','answer'], |
|
| 521 | - 'editChatInviteLink' => ['invite_link','chat_id','name','expire_date','member_limit','creates_join_request','token','return_array','forgot','answer'], |
|
| 522 | - 'revokeChatInviteLink' => ['invite_link','chat_id','token','return_array','forgot','answer'], |
|
| 523 | - 'approveChatJoinRequest' => ['chat_id','user_id','token','return_array','forgot','answer'], |
|
| 524 | - 'declineChatJoinRequest' => ['chat_id','user_id','token','return_array','forgot','answer'], |
|
| 525 | - 'setChatPhoto' => ['photo','chat_id','token','return_array','forgot','answer'], |
|
| 526 | - 'deleteChatPhoto' => ['chat_id','token','return_array','forgot','answer'], |
|
| 527 | - 'setChatTitle' => ['title','chat_id','token','return_array','forgot','answer'], |
|
| 528 | - 'setChatDescription' => ['chat_id','description','token','return_array','forgot','answer'], |
|
| 529 | - 'pinChatMessage' => ['message_id','chat_id','disable_notification','token','return_array','forgot','answer'], |
|
| 530 | - 'unpinChatMessage' => ['chat_id','message_id','token','return_array','forgot','answer'], |
|
| 531 | - 'unpinAllChatMessages' => ['chat_id','token','return_array','forgot','answer'], |
|
| 532 | - 'leaveChat' => ['chat_id','token','return_array','forgot','answer'], |
|
| 533 | - 'getChat' => ['chat_id','token','return_array','forgot','answer'], |
|
| 534 | - 'getChatAdministrators' => ['chat_id','token','return_array','forgot','answer'], |
|
| 535 | - 'getChatMemberCount' => ['chat_id','token','return_array','forgot','answer'], |
|
| 536 | - 'getChatMember' => ['chat_id','user_id','token','return_array','forgot','answer'], |
|
| 537 | - 'setChatStickerSet' => ['sticker_set_name','chat_id','token','return_array','forgot','answer'], |
|
| 538 | - 'deleteChatStickerSet' => ['chat_id','token','return_array','forgot','answer'], |
|
| 539 | - 'answerCallbackQuery' => ['callback_query_id','text','show_alert','url','cache_time','token','return_array','forgot','answer'], |
|
| 540 | - 'setMyCommands' => ['commands','scope','language_code','token','return_array','forgot','answer'], |
|
| 541 | - 'deleteMyCommands' => ['scope','language_code','token','return_array','forgot','answer'], |
|
| 542 | - 'getMyCommands' => ['scope','language_code','token','return_array','forgot','answer'], |
|
| 543 | - 'setChatMenuButton' => ['chat_id','menu_button','token','return_array','forgot','answer'], |
|
| 544 | - 'getChatMenuButton' => ['chat_id','token','return_array','forgot','answer'], |
|
| 545 | - 'setMyDefaultAdministratorRights' => ['rights','for_channels','token','return_array','forgot','answer'], |
|
| 546 | - 'getMyDefaultAdministratorRights' => ['for_channels','token','return_array','forgot','answer'], |
|
| 547 | - 'editMessageText' => ['text','chat_id','message_id','inline_message_id','parse_mode','entities','disable_web_page_preview','reply_markup','token','return_array','forgot','answer'], |
|
| 548 | - 'editMessageCaption' => ['chat_id','message_id','inline_message_id','caption','parse_mode','caption_entities','reply_markup','token','return_array','forgot','answer'], |
|
| 549 | - 'editMessageMedia' => ['media','chat_id','message_id','inline_message_id','reply_markup','token','return_array','forgot','answer'], |
|
| 550 | - 'editMessageReplyMarkup' => ['chat_id','message_id','inline_message_id','reply_markup','token','return_array','forgot','answer'], |
|
| 551 | - 'stopPoll' => ['chat_id','message_id','reply_markup','token','return_array','forgot','answer'], |
|
| 552 | - 'deleteMessage' => ['chat_id','message_id','token','return_array','forgot','answer'], |
|
| 553 | - 'sendSticker' => ['sticker','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'], |
|
| 554 | - 'getStickerSet' => ['name','token','return_array','forgot','answer'], |
|
| 483 | + 'getUpdates' => ['offset', 'limit', 'timeout', 'allowed_updates', 'token', 'return_array', 'forgot', 'answer'], |
|
| 484 | + 'setWebhook' => ['url', 'certificate', 'ip_address', 'max_connections', 'allowed_updates', 'drop_pending_updates', 'secret_token', 'token', 'return_array', 'forgot', 'answer'], |
|
| 485 | + 'deleteWebhook' => ['drop_pending_updates', 'token', 'return_array', 'forgot', 'answer'], |
|
| 486 | + 'getWebhookInfo' => ['token', 'return_array', 'forgot', 'answer'], |
|
| 487 | + 'getMe' => ['token', 'return_array', 'forgot', 'answer'], |
|
| 488 | + 'logOut' => ['token', 'return_array', 'forgot', 'answer'], |
|
| 489 | + 'close' => ['token', 'return_array', 'forgot', 'answer'], |
|
| 490 | + 'sendMessage' => ['text', 'chat_id', 'parse_mode', 'entities', 'disable_web_page_preview', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 491 | + 'forwardMessage' => ['chat_id', 'from_chat_id', 'disable_notification', 'protect_content', 'message_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 492 | + 'copyMessage' => ['chat_id', 'from_chat_id', 'message_id', 'caption', 'parse_mode', 'caption_entities', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 493 | + 'sendPhoto' => ['photo', 'chat_id', 'caption', 'parse_mode', 'caption_entities', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 494 | + 'sendAudio' => ['audio', 'chat_id', 'caption', 'parse_mode', 'caption_entities', 'duration', 'performer', 'title', 'thumb', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 495 | + 'sendDocument' => ['document', 'chat_id', 'thumb', 'caption', 'parse_mode', 'caption_entities', 'disable_content_type_detection', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 496 | + 'sendVideo' => ['video', 'chat_id', 'duration', 'width', 'height', 'thumb', 'caption', 'parse_mode', 'caption_entities', 'supports_streaming', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 497 | + 'sendAnimation' => ['animation', 'chat_id', 'duration', 'width', 'height', 'thumb', 'caption', 'parse_mode', 'caption_entities', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 498 | + 'sendVoice' => ['voice', 'chat_id', 'caption', 'parse_mode', 'caption_entities', 'duration', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 499 | + 'sendVideoNote' => ['video_note', 'chat_id', 'duration', 'length', 'thumb', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 500 | + 'sendMediaGroup' => ['media', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'token', 'return_array', 'forgot', 'answer'], |
|
| 501 | + 'sendLocation' => ['latitude', 'longitude', 'chat_id', 'horizontal_accuracy', 'live_period', 'heading', 'proximity_alert_radius', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 502 | + 'editMessageLiveLocation' => ['latitude', 'longitude', 'chat_id', 'message_id', 'inline_message_id', 'horizontal_accuracy', 'heading', 'proximity_alert_radius', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 503 | + 'stopMessageLiveLocation' => ['chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 504 | + 'sendVenue' => ['chat_id', 'latitude', 'longitude', 'title', 'address', 'foursquare_id', 'foursquare_type', 'google_place_id', 'google_place_type', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 505 | + 'sendContact' => ['phone_number', 'first_name', 'chat_id', 'last_name', 'vcard', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 506 | + 'sendPoll' => ['question', 'options', 'chat_id', 'is_anonymous', 'type', 'allows_multiple_answers', 'correct_option_id', 'explanation', 'explanation_parse_mode', 'explanation_entities', 'open_period', 'close_date', 'is_closed', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 507 | + 'sendDice' => ['chat_id', 'emoji', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 508 | + 'sendChatAction' => ['chat_id', 'action', 'token', 'return_array', 'forgot', 'answer'], |
|
| 509 | + 'getUserProfilePhotos' => ['user_id', 'offset', 'limit', 'token', 'return_array', 'forgot', 'answer'], |
|
| 510 | + 'getFile' => ['file_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 511 | + 'banChatMember' => ['chat_id', 'user_id', 'until_date', 'revoke_messages', 'token', 'return_array', 'forgot', 'answer'], |
|
| 512 | + 'unbanChatMember' => ['chat_id', 'user_id', 'only_if_banned', 'token', 'return_array', 'forgot', 'answer'], |
|
| 513 | + 'restrictChatMember' => ['permissions', 'chat_id', 'user_id', 'until_date', 'token', 'return_array', 'forgot', 'answer'], |
|
| 514 | + 'promoteChatMember' => ['chat_id', 'user_id', 'is_anonymous', 'can_manage_chat', 'can_post_messages', 'can_edit_messages', 'can_delete_messages', 'can_manage_video_chats', 'can_restrict_members', 'can_promote_members', 'can_change_info', 'can_invite_users', 'can_pin_messages', 'token', 'return_array', 'forgot', 'answer'], |
|
| 515 | + 'setChatAdministratorCustomTitle' => ['custom_title', 'chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 516 | + 'banChatSenderChat' => ['sender_chat_id', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 517 | + 'unbanChatSenderChat' => ['sender_chat_id', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 518 | + 'setChatPermissions' => ['permissions', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 519 | + 'exportChatInviteLink' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 520 | + 'createChatInviteLink' => ['chat_id', 'name', 'expire_date', 'member_limit', 'creates_join_request', 'token', 'return_array', 'forgot', 'answer'], |
|
| 521 | + 'editChatInviteLink' => ['invite_link', 'chat_id', 'name', 'expire_date', 'member_limit', 'creates_join_request', 'token', 'return_array', 'forgot', 'answer'], |
|
| 522 | + 'revokeChatInviteLink' => ['invite_link', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 523 | + 'approveChatJoinRequest' => ['chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 524 | + 'declineChatJoinRequest' => ['chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 525 | + 'setChatPhoto' => ['photo', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 526 | + 'deleteChatPhoto' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 527 | + 'setChatTitle' => ['title', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 528 | + 'setChatDescription' => ['chat_id', 'description', 'token', 'return_array', 'forgot', 'answer'], |
|
| 529 | + 'pinChatMessage' => ['message_id', 'chat_id', 'disable_notification', 'token', 'return_array', 'forgot', 'answer'], |
|
| 530 | + 'unpinChatMessage' => ['chat_id', 'message_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 531 | + 'unpinAllChatMessages' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 532 | + 'leaveChat' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 533 | + 'getChat' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 534 | + 'getChatAdministrators' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 535 | + 'getChatMemberCount' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 536 | + 'getChatMember' => ['chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 537 | + 'setChatStickerSet' => ['sticker_set_name', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 538 | + 'deleteChatStickerSet' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 539 | + 'answerCallbackQuery' => ['callback_query_id', 'text', 'show_alert', 'url', 'cache_time', 'token', 'return_array', 'forgot', 'answer'], |
|
| 540 | + 'setMyCommands' => ['commands', 'scope', 'language_code', 'token', 'return_array', 'forgot', 'answer'], |
|
| 541 | + 'deleteMyCommands' => ['scope', 'language_code', 'token', 'return_array', 'forgot', 'answer'], |
|
| 542 | + 'getMyCommands' => ['scope', 'language_code', 'token', 'return_array', 'forgot', 'answer'], |
|
| 543 | + 'setChatMenuButton' => ['chat_id', 'menu_button', 'token', 'return_array', 'forgot', 'answer'], |
|
| 544 | + 'getChatMenuButton' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 545 | + 'setMyDefaultAdministratorRights' => ['rights', 'for_channels', 'token', 'return_array', 'forgot', 'answer'], |
|
| 546 | + 'getMyDefaultAdministratorRights' => ['for_channels', 'token', 'return_array', 'forgot', 'answer'], |
|
| 547 | + 'editMessageText' => ['text', 'chat_id', 'message_id', 'inline_message_id', 'parse_mode', 'entities', 'disable_web_page_preview', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 548 | + 'editMessageCaption' => ['chat_id', 'message_id', 'inline_message_id', 'caption', 'parse_mode', 'caption_entities', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 549 | + 'editMessageMedia' => ['media', 'chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 550 | + 'editMessageReplyMarkup' => ['chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 551 | + 'stopPoll' => ['chat_id', 'message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 552 | + 'deleteMessage' => ['chat_id', 'message_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 553 | + 'sendSticker' => ['sticker', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 554 | + 'getStickerSet' => ['name', 'token', 'return_array', 'forgot', 'answer'], |
|
| 555 | 555 | 'getCustomEmojiStickers' => ['custom_emoji_ids', 'token', 'return_array', 'forgot', 'answer'], |
| 556 | - 'uploadStickerFile' => ['png_sticker','user_id','token','return_array','forgot','answer'], |
|
| 557 | - 'createNewStickerSet' => ['name','title','emojis','user_id','png_sticker','tgs_sticker','webm_sticker','sticker_type','contains_masks','mask_position','token','return_array','forgot','answer'], |
|
| 558 | - 'addStickerToSet' => ['name','emojis','user_id','png_sticker','tgs_sticker','webm_sticker','mask_position','token','return_array','forgot','answer'], |
|
| 559 | - 'setStickerPositionInSet' => ['sticker','position','token','return_array','forgot','answer'], |
|
| 560 | - 'deleteStickerFromSet' => ['sticker','token','return_array','forgot','answer'], |
|
| 561 | - 'setStickerSetThumb' => ['name','user_id','thumb','token','return_array','forgot','answer'], |
|
| 562 | - 'answerInlineQuery' => ['results','inline_query_id','cache_time','is_personal','next_offset','switch_pm_text','switch_pm_parameter','token','return_array','forgot','answer'], |
|
| 563 | - 'answerWebAppQuery' => ['web_app_query_id','result','token','return_array','forgot','answer'], |
|
| 564 | - 'sendInvoice' => ['title','description','payload','provider_token','currency','prices','chat_id','max_tip_amount','suggested_tip_amounts','start_parameter','provider_data','photo_url','photo_size','photo_width','photo_height','need_name','need_phone_number','need_email','need_shipping_address','send_phone_number_to_provider','send_email_to_provider','is_flexible','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'], |
|
| 565 | - 'createInvoiceLink' => ['title','description','payload','provider_token','currency','prices','max_tip_amount','suggested_tip_amounts','provider_data','photo_url','photo_size','photo_width','photo_height','need_name','need_phone_number','need_email','need_shipping_address','send_phone_number_to_provider','send_email_to_provider','is_flexible','token','return_array','forgot','answer'], |
|
| 566 | - 'answerShippingQuery' => ['ok','shipping_query_id','shipping_options','error_message','token','return_array','forgot','answer'], |
|
| 567 | - 'answerPreCheckoutQuery' => ['ok','pre_checkout_query_id','error_message','token','return_array','forgot','answer'], |
|
| 568 | - 'setPassportDataErrors' => ['errors','user_id','token','return_array','forgot','answer'], |
|
| 569 | - 'sendGame' => ['game_short_name','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'], |
|
| 570 | - 'setGameScore' => ['score','user_id','force','disable_edit_message','chat_id','message_id','inline_message_id','token','return_array','forgot','answer'], |
|
| 571 | - 'getGameHighScores' => ['user_id','chat_id','message_id','inline_message_id','token','return_array','forgot','answer'], |
|
| 556 | + 'uploadStickerFile' => ['png_sticker', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 557 | + 'createNewStickerSet' => ['name', 'title', 'emojis', 'user_id', 'png_sticker', 'tgs_sticker', 'webm_sticker', 'sticker_type', 'contains_masks', 'mask_position', 'token', 'return_array', 'forgot', 'answer'], |
|
| 558 | + 'addStickerToSet' => ['name', 'emojis', 'user_id', 'png_sticker', 'tgs_sticker', 'webm_sticker', 'mask_position', 'token', 'return_array', 'forgot', 'answer'], |
|
| 559 | + 'setStickerPositionInSet' => ['sticker', 'position', 'token', 'return_array', 'forgot', 'answer'], |
|
| 560 | + 'deleteStickerFromSet' => ['sticker', 'token', 'return_array', 'forgot', 'answer'], |
|
| 561 | + 'setStickerSetThumb' => ['name', 'user_id', 'thumb', 'token', 'return_array', 'forgot', 'answer'], |
|
| 562 | + 'answerInlineQuery' => ['results', 'inline_query_id', 'cache_time', 'is_personal', 'next_offset', 'switch_pm_text', 'switch_pm_parameter', 'token', 'return_array', 'forgot', 'answer'], |
|
| 563 | + 'answerWebAppQuery' => ['web_app_query_id', 'result', 'token', 'return_array', 'forgot', 'answer'], |
|
| 564 | + 'sendInvoice' => ['title', 'description', 'payload', 'provider_token', 'currency', 'prices', 'chat_id', 'max_tip_amount', 'suggested_tip_amounts', 'start_parameter', 'provider_data', 'photo_url', 'photo_size', 'photo_width', 'photo_height', 'need_name', 'need_phone_number', 'need_email', 'need_shipping_address', 'send_phone_number_to_provider', 'send_email_to_provider', 'is_flexible', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 565 | + 'createInvoiceLink' => ['title', 'description', 'payload', 'provider_token', 'currency', 'prices', 'max_tip_amount', 'suggested_tip_amounts', 'provider_data', 'photo_url', 'photo_size', 'photo_width', 'photo_height', 'need_name', 'need_phone_number', 'need_email', 'need_shipping_address', 'send_phone_number_to_provider', 'send_email_to_provider', 'is_flexible', 'token', 'return_array', 'forgot', 'answer'], |
|
| 566 | + 'answerShippingQuery' => ['ok', 'shipping_query_id', 'shipping_options', 'error_message', 'token', 'return_array', 'forgot', 'answer'], |
|
| 567 | + 'answerPreCheckoutQuery' => ['ok', 'pre_checkout_query_id', 'error_message', 'token', 'return_array', 'forgot', 'answer'], |
|
| 568 | + 'setPassportDataErrors' => ['errors', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 569 | + 'sendGame' => ['game_short_name', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 570 | + 'setGameScore' => ['score', 'user_id', 'force', 'disable_edit_message', 'chat_id', 'message_id', 'inline_message_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 571 | + 'getGameHighScores' => ['user_id', 'chat_id', 'message_id', 'inline_message_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 572 | 572 | 'getForumTopicIconStickers' => ['token', 'return_array', 'forgot', 'answer'], |
| 573 | 573 | 'createForumTopic' => ['chat_id', 'name', 'icon_color', 'icon_custom_emoji_id', 'token', 'return_array', 'forgot', 'answer'], |
| 574 | 574 | 'editForumTopic' => ['chat_id', 'message_thread_id', 'name', 'icon_custom_emoji_id', 'token', 'return_array', 'forgot', 'answer'], |
@@ -604,8 +604,8 @@ discard block |
||
| 604 | 604 | 'logOut' => [], |
| 605 | 605 | 'close' => [], |
| 606 | 606 | 'sendMessage' => ['chat_id'], |
| 607 | - 'forwardMessage' => ['from_chat_id','message_id'], |
|
| 608 | - 'copyMessage' => ['from_chat_id','message_id'], |
|
| 607 | + 'forwardMessage' => ['from_chat_id', 'message_id'], |
|
| 608 | + 'copyMessage' => ['from_chat_id', 'message_id'], |
|
| 609 | 609 | 'sendPhoto' => ['chat_id'], |
| 610 | 610 | 'sendAudio' => ['chat_id'], |
| 611 | 611 | 'sendDocument' => ['chat_id'], |
@@ -621,15 +621,15 @@ discard block |
||
| 621 | 621 | 'sendContact' => ['chat_id'], |
| 622 | 622 | 'sendPoll' => ['chat_id'], |
| 623 | 623 | 'sendDice' => ['chat_id'], |
| 624 | - 'sendChatAction' => ['chat_id','action'], |
|
| 624 | + 'sendChatAction' => ['chat_id', 'action'], |
|
| 625 | 625 | 'getUserProfilePhotos' => ['user_id'], |
| 626 | 626 | 'getFile' => ['file_id'], |
| 627 | - 'banChatMember' => ['chat_id','user_id'], |
|
| 628 | - 'kickChatMember' => ['chat_id','user_id'], |
|
| 629 | - 'unbanChatMember' => ['chat_id','user_id'], |
|
| 630 | - 'restrictChatMember' => ['chat_id','user_id'], |
|
| 631 | - 'promoteChatMember' => ['chat_id','user_id'], |
|
| 632 | - 'setChatAdministratorCustomTitle' => ['chat_id','user_id'], |
|
| 627 | + 'banChatMember' => ['chat_id', 'user_id'], |
|
| 628 | + 'kickChatMember' => ['chat_id', 'user_id'], |
|
| 629 | + 'unbanChatMember' => ['chat_id', 'user_id'], |
|
| 630 | + 'restrictChatMember' => ['chat_id', 'user_id'], |
|
| 631 | + 'promoteChatMember' => ['chat_id', 'user_id'], |
|
| 632 | + 'setChatAdministratorCustomTitle' => ['chat_id', 'user_id'], |
|
| 633 | 633 | 'banChatSenderChat' => ['chat_id'], |
| 634 | 634 | 'unbanChatSenderChat' => ['chat_id'], |
| 635 | 635 | 'setChatPermissions' => ['chat_id'], |
@@ -637,8 +637,8 @@ discard block |
||
| 637 | 637 | 'createChatInviteLink' => ['chat_id'], |
| 638 | 638 | 'editChatInviteLink' => ['chat_id'], |
| 639 | 639 | 'revokeChatInviteLink' => ['chat_id'], |
| 640 | - 'approveChatJoinRequest' => ['chat_id','user_id'], |
|
| 641 | - 'declineChatJoinRequest' => ['chat_id','user_id'], |
|
| 640 | + 'approveChatJoinRequest' => ['chat_id', 'user_id'], |
|
| 641 | + 'declineChatJoinRequest' => ['chat_id', 'user_id'], |
|
| 642 | 642 | 'setChatPhoto' => ['chat_id'], |
| 643 | 643 | 'deleteChatPhoto' => ['chat_id'], |
| 644 | 644 | 'setChatTitle' => ['chat_id'], |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | 'getChat' => ['chat_id'], |
| 651 | 651 | 'getChatAdministrators' => ['chat_id'], |
| 652 | 652 | 'getChatMembersCount' => ['chat_id'], |
| 653 | - 'getChatMember' => ['chat_id','user_id'], |
|
| 653 | + 'getChatMember' => ['chat_id', 'user_id'], |
|
| 654 | 654 | 'setChatStickerSet' => ['chat_id'], |
| 655 | 655 | 'deleteChatStickerSet' => ['chat_id'], |
| 656 | 656 | 'answerCallbackQuery' => ['callback_query_id'], |
@@ -661,12 +661,12 @@ discard block |
||
| 661 | 661 | 'getChatMenuButton' => [], |
| 662 | 662 | 'setMyDefaultAdministratorRights' => [], |
| 663 | 663 | 'getMyDefaultAdministratorRights' => [], |
| 664 | - 'editMessageText' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
| 665 | - 'editMessageCaption' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
| 666 | - 'editMessageMedia' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
| 667 | - 'editMessageReplyMarkup' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
| 668 | - 'stopPoll' => ['chat_id','message_id'], |
|
| 669 | - 'deleteMessage' => ['chat_id','message_id'], |
|
| 664 | + 'editMessageText' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
| 665 | + 'editMessageCaption' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
| 666 | + 'editMessageMedia' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
| 667 | + 'editMessageReplyMarkup' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
| 668 | + 'stopPoll' => ['chat_id', 'message_id'], |
|
| 669 | + 'deleteMessage' => ['chat_id', 'message_id'], |
|
| 670 | 670 | 'sendSticker' => ['chat_id'], |
| 671 | 671 | 'getStickerSet' => [], |
| 672 | 672 | 'uploadStickerFile' => ['user_id'], |
@@ -682,8 +682,8 @@ discard block |
||
| 682 | 682 | 'answerPreCheckoutQuery' => ['pre_checkout_query_id'], |
| 683 | 683 | 'setPassportDataErrors' => ['user_id'], |
| 684 | 684 | 'sendGame' => ['chat_id'], |
| 685 | - 'setGameScore' => ['user_id','inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
| 686 | - 'getGameHighScores' => ['user_id','inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']] |
|
| 685 | + 'setGameScore' => ['user_id', 'inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
| 686 | + 'getGameHighScores' => ['user_id', 'inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']] |
|
| 687 | 687 | ]; |
| 688 | 688 | |
| 689 | 689 | private const METHODS_RETURN = [ |
@@ -737,25 +737,25 @@ discard block |
||
| 737 | 737 | 'getGameHighScores' => ['BPT\types\gameHighScore'] |
| 738 | 738 | ]; |
| 739 | 739 | |
| 740 | - public static function __callStatic (string $name, array $arguments) { |
|
| 740 | + public static function __callStatic(string $name, array $arguments) { |
|
| 741 | 741 | if ($action = self::methodAction($name)) { |
| 742 | 742 | self::checkArguments($arguments); |
| 743 | - self::keysName($action,$arguments); |
|
| 744 | - self::readyFile($action,$arguments); |
|
| 745 | - self::setDefaults($action,$arguments); |
|
| 743 | + self::keysName($action, $arguments); |
|
| 744 | + self::readyFile($action, $arguments); |
|
| 745 | + self::setDefaults($action, $arguments); |
|
| 746 | 746 | if (isset($arguments['answer'])) { |
| 747 | - return answer::init($action,$arguments); |
|
| 747 | + return answer::init($action, $arguments); |
|
| 748 | 748 | } |
| 749 | 749 | else { |
| 750 | - $result = curl::init($action,$arguments); |
|
| 750 | + $result = curl::init($action, $arguments); |
|
| 751 | 751 | if (is_object($result)) { |
| 752 | - return self::processResponse($action,$result); |
|
| 752 | + return self::processResponse($action, $result); |
|
| 753 | 753 | } |
| 754 | 754 | return false; |
| 755 | 755 | } |
| 756 | 756 | } |
| 757 | 757 | else { |
| 758 | - logger::write("$name method is not supported",loggerTypes::ERROR); |
|
| 758 | + logger::write("$name method is not supported", loggerTypes::ERROR); |
|
| 759 | 759 | throw new bptException('METHOD_NOT_FOUND'); |
| 760 | 760 | } |
| 761 | 761 | } |
@@ -766,7 +766,7 @@ discard block |
||
| 766 | 766 | } |
| 767 | 767 | } |
| 768 | 768 | |
| 769 | - private static function keysName (string $name, array &$arguments): void { |
|
| 769 | + private static function keysName(string $name, array &$arguments): void { |
|
| 770 | 770 | foreach ($arguments as $key => $argument) { |
| 771 | 771 | if (is_numeric($key) && isset(self::METHODS_KEYS[$name][$key])) { |
| 772 | 772 | $arguments[self::METHODS_KEYS[$name][$key]] = $argument; |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | } |
| 776 | 776 | } |
| 777 | 777 | |
| 778 | - private static function methodAction(string $name): string|false { |
|
| 778 | + private static function methodAction(string $name): string | false { |
|
| 779 | 779 | return self::METHODS_ACTION[str_replace('_', '', strtolower($name))] ?? false; |
| 780 | 780 | } |
| 781 | 781 | |
@@ -796,11 +796,11 @@ discard block |
||
| 796 | 796 | } |
| 797 | 797 | } |
| 798 | 798 | |
| 799 | - private static function methodFile(string $name): array|false { |
|
| 799 | + private static function methodFile(string $name): array | false { |
|
| 800 | 800 | return self::METHODS_WITH_FILE[$name] ?? false; |
| 801 | 801 | } |
| 802 | 802 | |
| 803 | - private static function methodReturn(string $name,stdClass $response) { |
|
| 803 | + private static function methodReturn(string $name, stdClass $response) { |
|
| 804 | 804 | if (isset(self::METHODS_RETURN[$name])) { |
| 805 | 805 | $return = self::METHODS_RETURN[$name]; |
| 806 | 806 | if (is_array($return)) { |
@@ -823,13 +823,13 @@ discard block |
||
| 823 | 823 | $defaults = self::METHODS_EXTRA_DEFAULTS[$name]; |
| 824 | 824 | foreach ($defaults as $key => $default) { |
| 825 | 825 | if (is_numeric($key)) { |
| 826 | - if (!isset($arguments[$default])){ |
|
| 826 | + if (!isset($arguments[$default])) { |
|
| 827 | 827 | $arguments[$default] = self::catchFields($default); |
| 828 | 828 | } |
| 829 | 829 | } |
| 830 | 830 | elseif (isset(BPT::$update->$key) || $key === 'other') { |
| 831 | 831 | foreach ($default as $def) { |
| 832 | - if (!isset($arguments[$def])){ |
|
| 832 | + if (!isset($arguments[$def])) { |
|
| 833 | 833 | $arguments[$def] = self::catchFields($def); |
| 834 | 834 | } |
| 835 | 835 | } |
@@ -842,7 +842,7 @@ discard block |
||
| 842 | 842 | if ($response->ok) { |
| 843 | 843 | self::$status = true; |
| 844 | 844 | self::$pure_response = $response; |
| 845 | - return self::methodReturn($name,$response); |
|
| 845 | + return self::methodReturn($name, $response); |
|
| 846 | 846 | } |
| 847 | 847 | else { |
| 848 | 848 | self::$status = false; |
@@ -858,7 +858,7 @@ discard block |
||
| 858 | 858 | * |
| 859 | 859 | * @return int|string|bool |
| 860 | 860 | */ |
| 861 | - public static function catchFields (string $field): int|string|bool { |
|
| 861 | + public static function catchFields(string $field): int | string | bool { |
|
| 862 | 862 | switch ($field) { |
| 863 | 863 | case fields::CHAT_ID : |
| 864 | 864 | case fields::FROM_CHAT_ID : |
@@ -994,7 +994,7 @@ discard block |
||
| 994 | 994 | default => false |
| 995 | 995 | }; |
| 996 | 996 | case fields::URL : |
| 997 | - return 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; |
|
| 997 | + return 'https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; |
|
| 998 | 998 | default: |
| 999 | 999 | return false; |
| 1000 | 1000 | } |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | * telegram class , Adding normal method call to request class and a simple name for being easy to call |
| 9 | 9 | */ |
| 10 | 10 | class telegram extends request { |
| 11 | - public function __call (string $name, array $arguments) { |
|
| 11 | + public function __call(string $name, array $arguments) { |
|
| 12 | 12 | return request::$name(...$arguments); |
| 13 | 13 | } |
| 14 | 14 | |
@@ -26,10 +26,10 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * @return bool |
| 28 | 28 | */ |
| 29 | - public static function downloadFile (string|null $destination = null, string|null $file_id = null): bool { |
|
| 29 | + public static function downloadFile(string | null $destination = null, string | null $file_id = null): bool { |
|
| 30 | 30 | $file = telegram::getFile($file_id); |
| 31 | 31 | if (isset($file->file_path)) { |
| 32 | - $file_path = settings::$down_url . 'bot' . settings::$token . '/' . $file->file_path; |
|
| 32 | + $file_path = settings::$down_url.'bot'.settings::$token.'/'.$file->file_path; |
|
| 33 | 33 | return tools::downloadFile($file_path, $destination); |
| 34 | 34 | } |
| 35 | 35 | else { |
@@ -31,8 +31,7 @@ |
||
| 31 | 31 | if (isset($file->file_path)) { |
| 32 | 32 | $file_path = settings::$down_url . 'bot' . settings::$token . '/' . $file->file_path; |
| 33 | 33 | return tools::downloadFile($file_path, $destination); |
| 34 | - } |
|
| 35 | - else { |
|
| 34 | + } else { |
|
| 36 | 35 | return false; |
| 37 | 36 | } |
| 38 | 37 | } |
@@ -256,13 +256,13 @@ discard block |
||
| 256 | 256 | * @method bool|responseError unpinallforumtopicmessages (int|string|array $chat_id, int $message_thread_id, string|null $token = null, bool|null $return_array = null, bool|null $forgot = null, bool|null $answer = null) Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success. |
| 257 | 257 | * @method bool|responseError unpintopicmessages (int|string|array $chat_id, int $message_thread_id, string|null $token = null, bool|null $return_array = null, bool|null $forgot = null, bool|null $answer = null) Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success. |
| 258 | 258 | */ |
| 259 | -class BPT extends telegram{ |
|
| 259 | +class BPT extends telegram { |
|
| 260 | 260 | public static update $update; |
| 261 | 261 | |
| 262 | 262 | public static BPT $handler; |
| 263 | 263 | |
| 264 | 264 | |
| 265 | - public function __construct (array|stdClass $settings) { |
|
| 265 | + public function __construct(array | stdClass $settings) { |
|
| 266 | 266 | static::$handler = &$this; |
| 267 | 267 | settings::init($settings); |
| 268 | 268 | } |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | settings::done(); |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - public static function exit (string|null $message = null) { |
|
| 274 | + public static function exit (string | null $message = null) { |
|
| 275 | 275 | die($message ?? "<div style='width:98vw;height:98vh;display:flex;justify-content:center;align-items:center;font-size:25vw'>BPT</div>"); |
| 276 | 276 | } |
| 277 | 277 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | /** Keep all of properties which has sub properties */ |
| 12 | 12 | private const subs = []; |
| 13 | 13 | |
| 14 | - public function __construct(stdClass|null $object = null) { |
|
| 14 | + public function __construct(stdClass | null $object = null) { |
|
| 15 | 15 | if ($object != null) { |
| 16 | 16 | parent::__construct($object, self::subs); |
| 17 | 17 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | public string $icon_custom_emoji_id; |
| 22 | 22 | |
| 23 | 23 | |
| 24 | - public function __construct(stdClass|null $object = null) { |
|
| 24 | + public function __construct(stdClass | null $object = null) { |
|
| 25 | 25 | if ($object != null) { |
| 26 | 26 | parent::__construct($object, self::subs); |
| 27 | 27 | } |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | public bool $can_manage_topics; |
| 68 | 68 | |
| 69 | 69 | |
| 70 | - public function __construct(stdClass|null $object = null) { |
|
| 70 | + public function __construct(stdClass | null $object = null) { |
|
| 71 | 71 | if ($object != null) { |
| 72 | 72 | parent::__construct($object, self::subs); |
| 73 | 73 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | public string $icon_custom_emoji_id; |
| 25 | 25 | |
| 26 | 26 | |
| 27 | - public function __construct(stdClass|null $object = null) { |
|
| 27 | + public function __construct(stdClass | null $object = null) { |
|
| 28 | 28 | if ($object != null) { |
| 29 | 29 | parent::__construct($object, self::subs); |
| 30 | 30 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | /** Keep all of properties which has sub properties */ |
| 12 | 12 | private const subs = []; |
| 13 | 13 | |
| 14 | - public function __construct(stdClass|null $object = null) { |
|
| 14 | + public function __construct(stdClass | null $object = null) { |
|
| 15 | 15 | if ($object != null) { |
| 16 | 16 | parent::__construct($object, self::subs); |
| 17 | 17 | } |