@@ -22,20 +22,20 @@ discard block |
||
| 22 | 22 | protected static function telegramVerify(string $ip = null) {
|
| 23 | 23 | if (settings::$telegram_verify) {
|
| 24 | 24 | if (!tools::isTelegram($ip ?? $_SERVER['REMOTE_ADDR'] ?? '')) {
|
| 25 | - logger::write('not authorized access denied. IP : '. $ip ?? $_SERVER['REMOTE_ADDR'] ?? 'unknown',loggerTypes::WARNING);
|
|
| 25 | + logger::write('not authorized access denied. IP : '.$ip ?? $_SERVER['REMOTE_ADDR'] ?? 'unknown', loggerTypes::WARNING);
|
|
| 26 | 26 | BPT::exit(); |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - protected static function processUpdate(string|stdClass|update $update = null) {
|
|
| 31 | + protected static function processUpdate(string | stdClass | update $update = null) {
|
|
| 32 | 32 | if (!is_object($update)) {
|
| 33 | 33 | $update = json_decode($update ?? file_get_contents("php://input"));
|
| 34 | 34 | if (!$update) {
|
| 35 | 35 | BPT::exit(); |
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | - elseif (!is_a($update,'update')) {
|
|
| 38 | + elseif (!is_a($update, 'update')) {
|
|
| 39 | 39 | $update = new update($update); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | self::processHandler(); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - protected static function setMessageExtra (update &$update) {
|
|
| 47 | + protected static function setMessageExtra(update & $update) {
|
|
| 48 | 48 | if ((isset($update->message) && isset($update->message->text)) || (isset($update->edited_message) && isset($update->edited_message->text))) {
|
| 49 | 49 | $type = isset($update->message) ? 'message' : 'edited_message'; |
| 50 | 50 | $text = &$update->$type->text; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | BPT::$handler->something_else(BPT::$update); |
| 93 | 93 | } |
| 94 | 94 | else {
|
| 95 | - logger::write('Update received but handlers does not set',loggerTypes::WARNING);
|
|
| 95 | + logger::write('Update received but handlers does not set', loggerTypes::WARNING);
|
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | } |
@@ -34,8 +34,7 @@ discard block |
||
| 34 | 34 | if (!$update) {
|
| 35 | 35 | BPT::exit(); |
| 36 | 36 | } |
| 37 | - } |
|
| 38 | - elseif (!is_a($update,'update')) {
|
|
| 37 | + } elseif (!is_a($update,'update')) {
|
|
| 39 | 38 | $update = new update($update); |
| 40 | 39 | } |
| 41 | 40 | |
@@ -72,26 +71,21 @@ discard block |
||
| 72 | 71 | if (self::handlerExist('message')) {
|
| 73 | 72 | BPT::$handler->message(BPT::$update->message); |
| 74 | 73 | } |
| 75 | - } |
|
| 76 | - elseif (isset(BPT::$update->callback_query)) {
|
|
| 74 | + } elseif (isset(BPT::$update->callback_query)) {
|
|
| 77 | 75 | if (self::handlerExist('callback_query')) {
|
| 78 | 76 | BPT::$handler->callback_query(BPT::$update->callback_query); |
| 79 | 77 | } |
| 80 | - } |
|
| 81 | - elseif (isset(BPT::$update->inline_query)) {
|
|
| 78 | + } elseif (isset(BPT::$update->inline_query)) {
|
|
| 82 | 79 | if (self::handlerExist('inline_query')) {
|
| 83 | 80 | BPT::$handler->inline_query(BPT::$update->inline_query); |
| 84 | 81 | } |
| 85 | - } |
|
| 86 | - elseif (isset(BPT::$update->edited_message)) {
|
|
| 82 | + } elseif (isset(BPT::$update->edited_message)) {
|
|
| 87 | 83 | if (self::handlerExist('edited_message')) {
|
| 88 | 84 | BPT::$handler->edited_message(BPT::$update->edited_message); |
| 89 | 85 | } |
| 90 | - } |
|
| 91 | - elseif (self::handlerExist('something_else')) {
|
|
| 86 | + } elseif (self::handlerExist('something_else')) {
|
|
| 92 | 87 | BPT::$handler->something_else(BPT::$update); |
| 93 | - } |
|
| 94 | - else {
|
|
| 88 | + } else {
|
|
| 95 | 89 | logger::write('Update received but handlers does not set',loggerTypes::WARNING);
|
| 96 | 90 | } |
| 97 | 91 | } |
@@ -452,94 +452,94 @@ discard block |
||
| 452 | 452 | ]; |
| 453 | 453 | |
| 454 | 454 | private const METHODS_KEYS = [ |
| 455 | - 'getUpdates' => ['offset','limit','timeout','allowed_updates','token','return_array','forgot','answer'], |
|
| 456 | - 'setWebhook' => ['url','certificate','ip_address','max_connections','allowed_updates','drop_pending_updates','secret_token','token','return_array','forgot','answer'], |
|
| 457 | - 'deleteWebhook' => ['drop_pending_updates','token','return_array','forgot','answer'], |
|
| 458 | - 'getWebhookInfo' => ['token','return_array','forgot','answer'], |
|
| 459 | - 'getMe' => ['token','return_array','forgot','answer'], |
|
| 460 | - 'logOut' => ['token','return_array','forgot','answer'], |
|
| 461 | - 'close' => ['token','return_array','forgot','answer'], |
|
| 462 | - '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'], |
|
| 463 | - 'forwardMessage' => ['chat_id','from_chat_id','disable_notification','protect_content','message_id','token','return_array','forgot','answer'], |
|
| 464 | - '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'], |
|
| 465 | - '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'], |
|
| 466 | - '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'], |
|
| 467 | - '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'], |
|
| 468 | - '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'], |
|
| 469 | - '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'], |
|
| 470 | - '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'], |
|
| 471 | - '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'], |
|
| 472 | - 'sendMediaGroup' => ['media','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','token','return_array','forgot','answer'], |
|
| 473 | - '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'], |
|
| 474 | - 'editMessageLiveLocation' => ['latitude','longitude','chat_id','message_id','inline_message_id','horizontal_accuracy','heading','proximity_alert_radius','reply_markup','token','return_array','forgot','answer'], |
|
| 475 | - 'stopMessageLiveLocation' => ['chat_id','message_id','inline_message_id','reply_markup','token','return_array','forgot','answer'], |
|
| 476 | - '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'], |
|
| 477 | - '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'], |
|
| 478 | - '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'], |
|
| 479 | - 'sendDice' => ['chat_id','emoji','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'], |
|
| 480 | - 'sendChatAction' => ['chat_id','action','token','return_array','forgot','answer'], |
|
| 481 | - 'getUserProfilePhotos' => ['user_id','offset','limit','token','return_array','forgot','answer'], |
|
| 482 | - 'getFile' => ['file_id','token','return_array','forgot','answer'], |
|
| 483 | - 'banChatMember' => ['chat_id','user_id','until_date','revoke_messages','token','return_array','forgot','answer'], |
|
| 484 | - 'unbanChatMember' => ['chat_id','user_id','only_if_banned','token','return_array','forgot','answer'], |
|
| 485 | - 'restrictChatMember' => ['permissions','chat_id','user_id','until_date','token','return_array','forgot','answer'], |
|
| 486 | - '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'], |
|
| 487 | - 'setChatAdministratorCustomTitle' => ['custom_title','chat_id','user_id','token','return_array','forgot','answer'], |
|
| 488 | - 'banChatSenderChat' => ['sender_chat_id','chat_id','token','return_array','forgot','answer'], |
|
| 489 | - 'unbanChatSenderChat' => ['sender_chat_id','chat_id','token','return_array','forgot','answer'], |
|
| 490 | - 'setChatPermissions' => ['permissions','chat_id','token','return_array','forgot','answer'], |
|
| 491 | - 'exportChatInviteLink' => ['chat_id','token','return_array','forgot','answer'], |
|
| 492 | - 'createChatInviteLink' => ['chat_id','name','expire_date','member_limit','creates_join_request','token','return_array','forgot','answer'], |
|
| 493 | - 'editChatInviteLink' => ['invite_link','chat_id','name','expire_date','member_limit','creates_join_request','token','return_array','forgot','answer'], |
|
| 494 | - 'revokeChatInviteLink' => ['invite_link','chat_id','token','return_array','forgot','answer'], |
|
| 495 | - 'approveChatJoinRequest' => ['chat_id','user_id','token','return_array','forgot','answer'], |
|
| 496 | - 'declineChatJoinRequest' => ['chat_id','user_id','token','return_array','forgot','answer'], |
|
| 497 | - 'setChatPhoto' => ['photo','chat_id','token','return_array','forgot','answer'], |
|
| 498 | - 'deleteChatPhoto' => ['chat_id','token','return_array','forgot','answer'], |
|
| 499 | - 'setChatTitle' => ['title','chat_id','token','return_array','forgot','answer'], |
|
| 500 | - 'setChatDescription' => ['chat_id','description','token','return_array','forgot','answer'], |
|
| 501 | - 'pinChatMessage' => ['message_id','chat_id','disable_notification','token','return_array','forgot','answer'], |
|
| 502 | - 'unpinChatMessage' => ['chat_id','message_id','token','return_array','forgot','answer'], |
|
| 503 | - 'unpinAllChatMessages' => ['chat_id','token','return_array','forgot','answer'], |
|
| 504 | - 'leaveChat' => ['chat_id','token','return_array','forgot','answer'], |
|
| 505 | - 'getChat' => ['chat_id','token','return_array','forgot','answer'], |
|
| 506 | - 'getChatAdministrators' => ['chat_id','token','return_array','forgot','answer'], |
|
| 507 | - 'getChatMemberCount' => ['chat_id','token','return_array','forgot','answer'], |
|
| 508 | - 'getChatMember' => ['chat_id','user_id','token','return_array','forgot','answer'], |
|
| 509 | - 'setChatStickerSet' => ['sticker_set_name','chat_id','token','return_array','forgot','answer'], |
|
| 510 | - 'deleteChatStickerSet' => ['chat_id','token','return_array','forgot','answer'], |
|
| 511 | - 'answerCallbackQuery' => ['callback_query_id','text','show_alert','url','cache_time','token','return_array','forgot','answer'], |
|
| 512 | - 'setMyCommands' => ['commands','scope','language_code','token','return_array','forgot','answer'], |
|
| 513 | - 'deleteMyCommands' => ['scope','language_code','token','return_array','forgot','answer'], |
|
| 514 | - 'getMyCommands' => ['scope','language_code','token','return_array','forgot','answer'], |
|
| 515 | - 'setChatMenuButton' => ['chat_id','menu_button','token','return_array','forgot','answer'], |
|
| 516 | - 'getChatMenuButton' => ['chat_id','token','return_array','forgot','answer'], |
|
| 517 | - 'setMyDefaultAdministratorRights' => ['rights','for_channels','token','return_array','forgot','answer'], |
|
| 518 | - 'getMyDefaultAdministratorRights' => ['for_channels','token','return_array','forgot','answer'], |
|
| 519 | - 'editMessageText' => ['text','chat_id','message_id','inline_message_id','parse_mode','entities','disable_web_page_preview','reply_markup','token','return_array','forgot','answer'], |
|
| 520 | - 'editMessageCaption' => ['chat_id','message_id','inline_message_id','caption','parse_mode','caption_entities','reply_markup','token','return_array','forgot','answer'], |
|
| 521 | - 'editMessageMedia' => ['media','chat_id','message_id','inline_message_id','reply_markup','token','return_array','forgot','answer'], |
|
| 522 | - 'editMessageReplyMarkup' => ['chat_id','message_id','inline_message_id','reply_markup','token','return_array','forgot','answer'], |
|
| 523 | - 'stopPoll' => ['chat_id','message_id','reply_markup','token','return_array','forgot','answer'], |
|
| 524 | - 'deleteMessage' => ['chat_id','message_id','token','return_array','forgot','answer'], |
|
| 525 | - 'sendSticker' => ['sticker','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'], |
|
| 526 | - 'getStickerSet' => ['name','token','return_array','forgot','answer'], |
|
| 527 | - 'uploadStickerFile' => ['png_sticker','user_id','token','return_array','forgot','answer'], |
|
| 528 | - 'createNewStickerSet' => ['name','title','emojis','user_id','png_sticker','tgs_sticker','webm_sticker','contains_masks','mask_position','token','return_array','forgot','answer'], |
|
| 529 | - 'addStickerToSet' => ['name','emojis','user_id','png_sticker','tgs_sticker','webm_sticker','mask_position','token','return_array','forgot','answer'], |
|
| 530 | - 'setStickerPositionInSet' => ['sticker','position','token','return_array','forgot','answer'], |
|
| 531 | - 'deleteStickerFromSet' => ['sticker','token','return_array','forgot','answer'], |
|
| 532 | - 'setStickerSetThumb' => ['name','user_id','thumb','token','return_array','forgot','answer'], |
|
| 533 | - 'answerInlineQuery' => ['results','inline_query_id','cache_time','is_personal','next_offset','switch_pm_text','switch_pm_parameter','token','return_array','forgot','answer'], |
|
| 534 | - 'answerWebAppQuery' => ['web_app_query_id','result','token','return_array','forgot','answer'], |
|
| 535 | - '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'], |
|
| 536 | - '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'], |
|
| 537 | - 'answerShippingQuery' => ['ok','shipping_query_id','shipping_options','error_message','token','return_array','forgot','answer'], |
|
| 538 | - 'answerPreCheckoutQuery' => ['ok','pre_checkout_query_id','error_message','token','return_array','forgot','answer'], |
|
| 539 | - 'setPassportDataErrors' => ['errors','user_id','token','return_array','forgot','answer'], |
|
| 540 | - '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'], |
|
| 541 | - 'setGameScore' => ['score','user_id','force','disable_edit_message','chat_id','message_id','inline_message_id','token','return_array','forgot','answer'], |
|
| 542 | - 'getGameHighScores' => ['user_id','chat_id','message_id','inline_message_id','token','return_array','forgot','answer'], |
|
| 455 | + 'getUpdates' => ['offset', 'limit', 'timeout', 'allowed_updates', 'token', 'return_array', 'forgot', 'answer'], |
|
| 456 | + 'setWebhook' => ['url', 'certificate', 'ip_address', 'max_connections', 'allowed_updates', 'drop_pending_updates', 'secret_token', 'token', 'return_array', 'forgot', 'answer'], |
|
| 457 | + 'deleteWebhook' => ['drop_pending_updates', 'token', 'return_array', 'forgot', 'answer'], |
|
| 458 | + 'getWebhookInfo' => ['token', 'return_array', 'forgot', 'answer'], |
|
| 459 | + 'getMe' => ['token', 'return_array', 'forgot', 'answer'], |
|
| 460 | + 'logOut' => ['token', 'return_array', 'forgot', 'answer'], |
|
| 461 | + 'close' => ['token', 'return_array', 'forgot', 'answer'], |
|
| 462 | + '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'], |
|
| 463 | + 'forwardMessage' => ['chat_id', 'from_chat_id', 'disable_notification', 'protect_content', 'message_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 464 | + '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'], |
|
| 465 | + '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'], |
|
| 466 | + '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'], |
|
| 467 | + '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'], |
|
| 468 | + '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'], |
|
| 469 | + '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'], |
|
| 470 | + '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'], |
|
| 471 | + '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'], |
|
| 472 | + 'sendMediaGroup' => ['media', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'token', 'return_array', 'forgot', 'answer'], |
|
| 473 | + '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'], |
|
| 474 | + 'editMessageLiveLocation' => ['latitude', 'longitude', 'chat_id', 'message_id', 'inline_message_id', 'horizontal_accuracy', 'heading', 'proximity_alert_radius', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 475 | + 'stopMessageLiveLocation' => ['chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 476 | + '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'], |
|
| 477 | + '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'], |
|
| 478 | + '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'], |
|
| 479 | + 'sendDice' => ['chat_id', 'emoji', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 480 | + 'sendChatAction' => ['chat_id', 'action', 'token', 'return_array', 'forgot', 'answer'], |
|
| 481 | + 'getUserProfilePhotos' => ['user_id', 'offset', 'limit', 'token', 'return_array', 'forgot', 'answer'], |
|
| 482 | + 'getFile' => ['file_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 483 | + 'banChatMember' => ['chat_id', 'user_id', 'until_date', 'revoke_messages', 'token', 'return_array', 'forgot', 'answer'], |
|
| 484 | + 'unbanChatMember' => ['chat_id', 'user_id', 'only_if_banned', 'token', 'return_array', 'forgot', 'answer'], |
|
| 485 | + 'restrictChatMember' => ['permissions', 'chat_id', 'user_id', 'until_date', 'token', 'return_array', 'forgot', 'answer'], |
|
| 486 | + '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'], |
|
| 487 | + 'setChatAdministratorCustomTitle' => ['custom_title', 'chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 488 | + 'banChatSenderChat' => ['sender_chat_id', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 489 | + 'unbanChatSenderChat' => ['sender_chat_id', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 490 | + 'setChatPermissions' => ['permissions', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 491 | + 'exportChatInviteLink' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 492 | + 'createChatInviteLink' => ['chat_id', 'name', 'expire_date', 'member_limit', 'creates_join_request', 'token', 'return_array', 'forgot', 'answer'], |
|
| 493 | + 'editChatInviteLink' => ['invite_link', 'chat_id', 'name', 'expire_date', 'member_limit', 'creates_join_request', 'token', 'return_array', 'forgot', 'answer'], |
|
| 494 | + 'revokeChatInviteLink' => ['invite_link', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 495 | + 'approveChatJoinRequest' => ['chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 496 | + 'declineChatJoinRequest' => ['chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 497 | + 'setChatPhoto' => ['photo', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 498 | + 'deleteChatPhoto' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 499 | + 'setChatTitle' => ['title', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 500 | + 'setChatDescription' => ['chat_id', 'description', 'token', 'return_array', 'forgot', 'answer'], |
|
| 501 | + 'pinChatMessage' => ['message_id', 'chat_id', 'disable_notification', 'token', 'return_array', 'forgot', 'answer'], |
|
| 502 | + 'unpinChatMessage' => ['chat_id', 'message_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 503 | + 'unpinAllChatMessages' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 504 | + 'leaveChat' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 505 | + 'getChat' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 506 | + 'getChatAdministrators' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 507 | + 'getChatMemberCount' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 508 | + 'getChatMember' => ['chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 509 | + 'setChatStickerSet' => ['sticker_set_name', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 510 | + 'deleteChatStickerSet' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 511 | + 'answerCallbackQuery' => ['callback_query_id', 'text', 'show_alert', 'url', 'cache_time', 'token', 'return_array', 'forgot', 'answer'], |
|
| 512 | + 'setMyCommands' => ['commands', 'scope', 'language_code', 'token', 'return_array', 'forgot', 'answer'], |
|
| 513 | + 'deleteMyCommands' => ['scope', 'language_code', 'token', 'return_array', 'forgot', 'answer'], |
|
| 514 | + 'getMyCommands' => ['scope', 'language_code', 'token', 'return_array', 'forgot', 'answer'], |
|
| 515 | + 'setChatMenuButton' => ['chat_id', 'menu_button', 'token', 'return_array', 'forgot', 'answer'], |
|
| 516 | + 'getChatMenuButton' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 517 | + 'setMyDefaultAdministratorRights' => ['rights', 'for_channels', 'token', 'return_array', 'forgot', 'answer'], |
|
| 518 | + 'getMyDefaultAdministratorRights' => ['for_channels', 'token', 'return_array', 'forgot', 'answer'], |
|
| 519 | + 'editMessageText' => ['text', 'chat_id', 'message_id', 'inline_message_id', 'parse_mode', 'entities', 'disable_web_page_preview', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 520 | + 'editMessageCaption' => ['chat_id', 'message_id', 'inline_message_id', 'caption', 'parse_mode', 'caption_entities', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 521 | + 'editMessageMedia' => ['media', 'chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 522 | + 'editMessageReplyMarkup' => ['chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 523 | + 'stopPoll' => ['chat_id', 'message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 524 | + 'deleteMessage' => ['chat_id', 'message_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 525 | + 'sendSticker' => ['sticker', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
| 526 | + 'getStickerSet' => ['name', 'token', 'return_array', 'forgot', 'answer'], |
|
| 527 | + 'uploadStickerFile' => ['png_sticker', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 528 | + 'createNewStickerSet' => ['name', 'title', 'emojis', 'user_id', 'png_sticker', 'tgs_sticker', 'webm_sticker', 'contains_masks', 'mask_position', 'token', 'return_array', 'forgot', 'answer'], |
|
| 529 | + 'addStickerToSet' => ['name', 'emojis', 'user_id', 'png_sticker', 'tgs_sticker', 'webm_sticker', 'mask_position', 'token', 'return_array', 'forgot', 'answer'], |
|
| 530 | + 'setStickerPositionInSet' => ['sticker', 'position', 'token', 'return_array', 'forgot', 'answer'], |
|
| 531 | + 'deleteStickerFromSet' => ['sticker', 'token', 'return_array', 'forgot', 'answer'], |
|
| 532 | + 'setStickerSetThumb' => ['name', 'user_id', 'thumb', 'token', 'return_array', 'forgot', 'answer'], |
|
| 533 | + 'answerInlineQuery' => ['results', 'inline_query_id', 'cache_time', 'is_personal', 'next_offset', 'switch_pm_text', 'switch_pm_parameter', 'token', 'return_array', 'forgot', 'answer'], |
|
| 534 | + 'answerWebAppQuery' => ['web_app_query_id', 'result', 'token', 'return_array', 'forgot', 'answer'], |
|
| 535 | + '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'], |
|
| 536 | + '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'], |
|
| 537 | + 'answerShippingQuery' => ['ok', 'shipping_query_id', 'shipping_options', 'error_message', 'token', 'return_array', 'forgot', 'answer'], |
|
| 538 | + 'answerPreCheckoutQuery' => ['ok', 'pre_checkout_query_id', 'error_message', 'token', 'return_array', 'forgot', 'answer'], |
|
| 539 | + 'setPassportDataErrors' => ['errors', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 540 | + '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'], |
|
| 541 | + 'setGameScore' => ['score', 'user_id', 'force', 'disable_edit_message', 'chat_id', 'message_id', 'inline_message_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 542 | + 'getGameHighScores' => ['user_id', 'chat_id', 'message_id', 'inline_message_id', 'token', 'return_array', 'forgot', 'answer'], |
|
| 543 | 543 | ]; |
| 544 | 544 | |
| 545 | 545 | private const METHODS_WITH_FILE = [ |
@@ -568,8 +568,8 @@ discard block |
||
| 568 | 568 | 'logOut' => [], |
| 569 | 569 | 'close' => [], |
| 570 | 570 | 'sendMessage' => ['chat_id'], |
| 571 | - 'forwardMessage' => ['from_chat_id','message_id'], |
|
| 572 | - 'copyMessage' => ['from_chat_id','message_id'], |
|
| 571 | + 'forwardMessage' => ['from_chat_id', 'message_id'], |
|
| 572 | + 'copyMessage' => ['from_chat_id', 'message_id'], |
|
| 573 | 573 | 'sendPhoto' => ['chat_id'], |
| 574 | 574 | 'sendAudio' => ['chat_id'], |
| 575 | 575 | 'sendDocument' => ['chat_id'], |
@@ -585,15 +585,15 @@ discard block |
||
| 585 | 585 | 'sendContact' => ['chat_id'], |
| 586 | 586 | 'sendPoll' => ['chat_id'], |
| 587 | 587 | 'sendDice' => ['chat_id'], |
| 588 | - 'sendChatAction' => ['chat_id','action'], |
|
| 588 | + 'sendChatAction' => ['chat_id', 'action'], |
|
| 589 | 589 | 'getUserProfilePhotos' => ['user_id'], |
| 590 | 590 | 'getFile' => ['file_id'], |
| 591 | - 'banChatMember' => ['chat_id','user_id'], |
|
| 592 | - 'kickChatMember' => ['chat_id','user_id'], |
|
| 593 | - 'unbanChatMember' => ['chat_id','user_id'], |
|
| 594 | - 'restrictChatMember' => ['chat_id','user_id'], |
|
| 595 | - 'promoteChatMember' => ['chat_id','user_id'], |
|
| 596 | - 'setChatAdministratorCustomTitle' => ['chat_id','user_id'], |
|
| 591 | + 'banChatMember' => ['chat_id', 'user_id'], |
|
| 592 | + 'kickChatMember' => ['chat_id', 'user_id'], |
|
| 593 | + 'unbanChatMember' => ['chat_id', 'user_id'], |
|
| 594 | + 'restrictChatMember' => ['chat_id', 'user_id'], |
|
| 595 | + 'promoteChatMember' => ['chat_id', 'user_id'], |
|
| 596 | + 'setChatAdministratorCustomTitle' => ['chat_id', 'user_id'], |
|
| 597 | 597 | 'banChatSenderChat' => ['chat_id'], |
| 598 | 598 | 'unbanChatSenderChat' => ['chat_id'], |
| 599 | 599 | 'setChatPermissions' => ['chat_id'], |
@@ -601,8 +601,8 @@ discard block |
||
| 601 | 601 | 'createChatInviteLink' => ['chat_id'], |
| 602 | 602 | 'editChatInviteLink' => ['chat_id'], |
| 603 | 603 | 'revokeChatInviteLink' => ['chat_id'], |
| 604 | - 'approveChatJoinRequest' => ['chat_id','user_id'], |
|
| 605 | - 'declineChatJoinRequest' => ['chat_id','user_id'], |
|
| 604 | + 'approveChatJoinRequest' => ['chat_id', 'user_id'], |
|
| 605 | + 'declineChatJoinRequest' => ['chat_id', 'user_id'], |
|
| 606 | 606 | 'setChatPhoto' => ['chat_id'], |
| 607 | 607 | 'deleteChatPhoto' => ['chat_id'], |
| 608 | 608 | 'setChatTitle' => ['chat_id'], |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | 'getChat' => ['chat_id'], |
| 615 | 615 | 'getChatAdministrators' => ['chat_id'], |
| 616 | 616 | 'getChatMembersCount' => ['chat_id'], |
| 617 | - 'getChatMember' => ['chat_id','user_id'], |
|
| 617 | + 'getChatMember' => ['chat_id', 'user_id'], |
|
| 618 | 618 | 'setChatStickerSet' => ['chat_id'], |
| 619 | 619 | 'deleteChatStickerSet' => ['chat_id'], |
| 620 | 620 | 'answerCallbackQuery' => ['callback_query_id'], |
@@ -625,12 +625,12 @@ discard block |
||
| 625 | 625 | 'getChatMenuButton' => [], |
| 626 | 626 | 'setMyDefaultAdministratorRights' => [], |
| 627 | 627 | 'getMyDefaultAdministratorRights' => [], |
| 628 | - 'editMessageText' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
| 629 | - 'editMessageCaption' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
| 630 | - 'editMessageMedia' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
| 631 | - 'editMessageReplyMarkup' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
| 632 | - 'stopPoll' => ['chat_id','message_id'], |
|
| 633 | - 'deleteMessage' => ['chat_id','message_id'], |
|
| 628 | + 'editMessageText' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
| 629 | + 'editMessageCaption' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
| 630 | + 'editMessageMedia' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
| 631 | + 'editMessageReplyMarkup' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
| 632 | + 'stopPoll' => ['chat_id', 'message_id'], |
|
| 633 | + 'deleteMessage' => ['chat_id', 'message_id'], |
|
| 634 | 634 | 'sendSticker' => ['chat_id'], |
| 635 | 635 | 'getStickerSet' => [], |
| 636 | 636 | 'uploadStickerFile' => ['user_id'], |
@@ -646,8 +646,8 @@ discard block |
||
| 646 | 646 | 'answerPreCheckoutQuery' => ['pre_checkout_query_id'], |
| 647 | 647 | 'setPassportDataErrors' => ['user_id'], |
| 648 | 648 | 'sendGame' => ['chat_id'], |
| 649 | - 'setGameScore' => ['user_id','inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
| 650 | - 'getGameHighScores' => ['user_id','inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']] |
|
| 649 | + 'setGameScore' => ['user_id', 'inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
| 650 | + 'getGameHighScores' => ['user_id', 'inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']] |
|
| 651 | 651 | ]; |
| 652 | 652 | |
| 653 | 653 | private const METHODS_RETURN = [ |
@@ -699,25 +699,25 @@ discard block |
||
| 699 | 699 | ]; |
| 700 | 700 | |
| 701 | 701 | |
| 702 | - public static function __callStatic (string $name, array $arguments) {
|
|
| 702 | + public static function __callStatic(string $name, array $arguments) {
|
|
| 703 | 703 | if ($action = self::methodAction($name)) {
|
| 704 | - self::keysName($action,$arguments); |
|
| 705 | - self::readyFile($action,$arguments); |
|
| 706 | - self::setDefaults($action,$arguments); |
|
| 704 | + self::keysName($action, $arguments); |
|
| 705 | + self::readyFile($action, $arguments); |
|
| 706 | + self::setDefaults($action, $arguments); |
|
| 707 | 707 | if (isset($arguments['answer'])) {
|
| 708 | - return answer::init($action,$arguments); |
|
| 708 | + return answer::init($action, $arguments); |
|
| 709 | 709 | } |
| 710 | 710 | else {
|
| 711 | - return self::processResponse($action,curl::init($action,$arguments)); |
|
| 711 | + return self::processResponse($action, curl::init($action, $arguments)); |
|
| 712 | 712 | } |
| 713 | 713 | } |
| 714 | 714 | else {
|
| 715 | - logger::write("$name method is not supported",loggerTypes::ERROR);
|
|
| 715 | + logger::write("$name method is not supported", loggerTypes::ERROR);
|
|
| 716 | 716 | throw new bptException('METHOD_NOT_FOUND');
|
| 717 | 717 | } |
| 718 | 718 | } |
| 719 | 719 | |
| 720 | - private static function keysName (string $name, array &$arguments) {
|
|
| 720 | + private static function keysName(string $name, array &$arguments) {
|
|
| 721 | 721 | foreach ($arguments as $key => $argument) {
|
| 722 | 722 | if (is_numeric($key) && isset(self::METHODS_KEYS[$name][$key])) {
|
| 723 | 723 | $arguments[self::METHODS_KEYS[$name][$key]] = $argument; |
@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | } |
| 727 | 727 | } |
| 728 | 728 | |
| 729 | - private static function methodAction(string $name): string|false {
|
|
| 729 | + private static function methodAction(string $name): string | false {
|
|
| 730 | 730 | return self::METHODS_ACTION[str_replace('_', '', strtolower($name))] ?? false;
|
| 731 | 731 | } |
| 732 | 732 | |
@@ -747,11 +747,11 @@ discard block |
||
| 747 | 747 | } |
| 748 | 748 | } |
| 749 | 749 | |
| 750 | - private static function methodFile(string $name): array|false {
|
|
| 750 | + private static function methodFile(string $name): array | false {
|
|
| 751 | 751 | return self::METHODS_WITH_FILE[$name] ?? false; |
| 752 | 752 | } |
| 753 | 753 | |
| 754 | - private static function methodReturn(string $name,stdClass $response) {
|
|
| 754 | + private static function methodReturn(string $name, stdClass $response) {
|
|
| 755 | 755 | if (isset(self::METHODS_RETURN[$name])) {
|
| 756 | 756 | $return = self::METHODS_RETURN[$name]; |
| 757 | 757 | if (is_array($return)) {
|
@@ -774,13 +774,13 @@ discard block |
||
| 774 | 774 | $defaults = self::METHODS_EXTRA_DEFAULTS[$name]; |
| 775 | 775 | foreach ($defaults as $key => $default) {
|
| 776 | 776 | if (is_numeric($key)) {
|
| 777 | - if (!isset($arguments[$default])){
|
|
| 777 | + if (!isset($arguments[$default])) {
|
|
| 778 | 778 | $arguments[$default] = self::catchFields($default); |
| 779 | 779 | } |
| 780 | 780 | } |
| 781 | 781 | elseif (isset(BPT::$update->$key) || $key === 'other') {
|
| 782 | 782 | foreach ($default as $def) {
|
| 783 | - if (!isset($arguments[$def])){
|
|
| 783 | + if (!isset($arguments[$def])) {
|
|
| 784 | 784 | $arguments[$def] = self::catchFields($def); |
| 785 | 785 | } |
| 786 | 786 | } |
@@ -793,7 +793,7 @@ discard block |
||
| 793 | 793 | if ($response->ok) {
|
| 794 | 794 | self::$status = true; |
| 795 | 795 | self::$pure_response = $response; |
| 796 | - return self::methodReturn($name,$response); |
|
| 796 | + return self::methodReturn($name, $response); |
|
| 797 | 797 | } |
| 798 | 798 | else {
|
| 799 | 799 | self::$status = false; |
@@ -802,7 +802,7 @@ discard block |
||
| 802 | 802 | } |
| 803 | 803 | } |
| 804 | 804 | |
| 805 | - public static function catchFields (string $field): int|string|bool {
|
|
| 805 | + public static function catchFields(string $field): int | string | bool {
|
|
| 806 | 806 | switch ($field) {
|
| 807 | 807 | case 'chat_id' : |
| 808 | 808 | case 'from_chat_id' : |
@@ -938,7 +938,7 @@ discard block |
||
| 938 | 938 | default => false |
| 939 | 939 | }; |
| 940 | 940 | case 'url' : |
| 941 | - return 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; |
|
| 941 | + return 'https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; |
|
| 942 | 942 | default: |
| 943 | 943 | return false; |
| 944 | 944 | } |
@@ -706,12 +706,10 @@ discard block |
||
| 706 | 706 | self::setDefaults($action,$arguments); |
| 707 | 707 | if (isset($arguments['answer'])) {
|
| 708 | 708 | return answer::init($action,$arguments); |
| 709 | - } |
|
| 710 | - else {
|
|
| 709 | + } else {
|
|
| 711 | 710 | return self::processResponse($action,curl::init($action,$arguments)); |
| 712 | 711 | } |
| 713 | - } |
|
| 714 | - else {
|
|
| 712 | + } else {
|
|
| 715 | 713 | logger::write("$name method is not supported",loggerTypes::ERROR);
|
| 716 | 714 | throw new bptException('METHOD_NOT_FOUND');
|
| 717 | 715 | } |
@@ -737,8 +735,7 @@ discard block |
||
| 737 | 735 | $arguments['media'][$key]['media'] = new CURLFile($media['media']); |
| 738 | 736 | } |
| 739 | 737 | } |
| 740 | - } |
|
| 741 | - elseif ($file_params = self::methodFile($name)) {
|
|
| 738 | + } elseif ($file_params = self::methodFile($name)) {
|
|
| 742 | 739 | foreach ($file_params as $param) {
|
| 743 | 740 | if (isset($arguments[$param]) && file_exists($arguments[$param])) {
|
| 744 | 741 | $arguments[$param] = new CURLFile($arguments[$param]); |
@@ -760,12 +757,10 @@ discard block |
||
| 760 | 757 | $value = new ($return[0]) ($value); |
| 761 | 758 | } |
| 762 | 759 | return $response; |
| 763 | - } |
|
| 764 | - else {
|
|
| 760 | + } else {
|
|
| 765 | 761 | return new ($return) ($response->result); |
| 766 | 762 | } |
| 767 | - } |
|
| 768 | - else {
|
|
| 763 | + } else {
|
|
| 769 | 764 | return $response->result; |
| 770 | 765 | } |
| 771 | 766 | } |
@@ -777,8 +772,7 @@ discard block |
||
| 777 | 772 | if (!isset($arguments[$default])){
|
| 778 | 773 | $arguments[$default] = self::catchFields($default); |
| 779 | 774 | } |
| 780 | - } |
|
| 781 | - elseif (isset(BPT::$update->$key) || $key === 'other') {
|
|
| 775 | + } elseif (isset(BPT::$update->$key) || $key === 'other') {
|
|
| 782 | 776 | foreach ($default as $def) {
|
| 783 | 777 | if (!isset($arguments[$def])){
|
| 784 | 778 | $arguments[$def] = self::catchFields($def); |
@@ -794,8 +788,7 @@ discard block |
||
| 794 | 788 | self::$status = true; |
| 795 | 789 | self::$pure_response = $response; |
| 796 | 790 | return self::methodReturn($name,$response); |
| 797 | - } |
|
| 798 | - else {
|
|
| 791 | + } else {
|
|
| 799 | 792 | self::$status = false; |
| 800 | 793 | self::$pure_response = $response; |
| 801 | 794 | return new responseError($response); |
@@ -831,9 +824,13 @@ discard block |
||
| 831 | 824 | default => false |
| 832 | 825 | }; |
| 833 | 826 | case 'file_id' : |
| 834 | - if (isset(BPT::$update->message)) $type = 'message'; |
|
| 835 | - elseif (isset(BPT::$update->edited_message)) $type = 'edited_message'; |
|
| 836 | - else return false; |
|
| 827 | + if (isset(BPT::$update->message)) { |
|
| 828 | + $type = 'message'; |
|
| 829 | + } elseif (isset(BPT::$update->edited_message)) { |
|
| 830 | + $type = 'edited_message'; |
|
| 831 | + } else { |
|
| 832 | + return false; |
|
| 833 | + } |
|
| 837 | 834 | |
| 838 | 835 | return match(true) {
|
| 839 | 836 | isset(BPT::$update->$type->animation) => BPT::$update->$type->animation->file_id, |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | public int $file_size; |
| 34 | 34 | |
| 35 | 35 | |
| 36 | - public function __construct(stdClass|null $object = null) { |
|
| 36 | + public function __construct(stdClass | null $object = null) { |
|
| 37 | 37 | if ($object != null) { |
| 38 | 38 | parent::__construct($object, self::subs); |
| 39 | 39 | } |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | public bool $request_write_access; |
| 42 | 42 | |
| 43 | 43 | |
| 44 | - public function __construct(stdClass|null $object = null) { |
|
| 44 | + public function __construct(stdClass | null $object = null) { |
|
| 45 | 45 | if ($object != null) { |
| 46 | 46 | parent::__construct($object, self::subs); |
| 47 | 47 | } |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | public chatInviteLink $invite_link; |
| 32 | 32 | |
| 33 | 33 | |
| 34 | - public function __construct(stdClass|null $object = null) { |
|
| 34 | + public function __construct(stdClass | null $object = null) { |
|
| 35 | 35 | if ($object != null) { |
| 36 | 36 | parent::__construct($object, self::subs); |
| 37 | 37 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | public shippingAddress $shipping_address; |
| 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 | } |
@@ -26,12 +26,12 @@ discard block |
||
| 26 | 26 | $this->$key[$sub_key][] = new ($subs['array']['array'][$key]) ($sub2_value); |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | - else{ |
|
| 29 | + else { |
|
| 30 | 30 | $this->$key[] = new ($subs['array'][$key]) ($sub_value); |
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | - else{ |
|
| 34 | + else { |
|
| 35 | 35 | $this->$key = $value; |
| 36 | 36 | if (ucfirst($key) === basename(get_class($this)).'_id') { |
| 37 | 37 | $this->{'id'} = $value; |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | public function __call(string $name, array $arguments) { |
| 46 | 46 | $name = strtolower($name); |
| 47 | 47 | if (str_starts_with($name, 'set')) { |
| 48 | - $name = substr($name,3); |
|
| 48 | + $name = substr($name, 3); |
|
| 49 | 49 | if (isset($arguments[0])) { |
| 50 | 50 | $this->$name = $arguments[0]; |
| 51 | 51 | } |
@@ -17,21 +17,18 @@ discard block |
||
| 17 | 17 | foreach ($object as $key=>$value) { |
| 18 | 18 | if (isset($subs[$key])) { |
| 19 | 19 | $this->$key = new ($subs[$key]) ($value); |
| 20 | - } |
|
| 21 | - else { |
|
| 20 | + } else { |
|
| 22 | 21 | if (is_array($value)) { |
| 23 | 22 | foreach ($value as $sub_key=>$sub_value) { |
| 24 | 23 | if (is_array($sub_value)) { |
| 25 | 24 | foreach ($sub_value as $sub2_value) { |
| 26 | 25 | $this->$key[$sub_key][] = new ($subs['array']['array'][$key]) ($sub2_value); |
| 27 | 26 | } |
| 28 | - } |
|
| 29 | - else{ |
|
| 27 | + } else{ |
|
| 30 | 28 | $this->$key[] = new ($subs['array'][$key]) ($sub_value); |
| 31 | 29 | } |
| 32 | 30 | } |
| 33 | - } |
|
| 34 | - else{ |
|
| 31 | + } else{ |
|
| 35 | 32 | $this->$key = $value; |
| 36 | 33 | if (ucfirst($key) === basename(get_class($this)).'_id') { |
| 37 | 34 | $this->{'id'} = $value; |
@@ -48,8 +45,7 @@ discard block |
||
| 48 | 45 | $name = substr($name,3); |
| 49 | 46 | if (isset($arguments[0])) { |
| 50 | 47 | $this->$name = $arguments[0]; |
| 51 | - } |
|
| 52 | - elseif (isset($arguments['value'])) { |
|
| 48 | + } elseif (isset($arguments['value'])) { |
|
| 53 | 49 | $this->$name = $arguments['value']; |
| 54 | 50 | } |
| 55 | 51 | } |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | public animation $animation; |
| 45 | 45 | |
| 46 | 46 | |
| 47 | - public function __construct(stdClass|null $object = null) { |
|
| 47 | + public function __construct(stdClass | null $object = null) { |
|
| 48 | 48 | if ($object != null) { |
| 49 | 49 | parent::__construct($object, self::subs); |
| 50 | 50 | } |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | public float $scale; |
| 38 | 38 | |
| 39 | 39 | |
| 40 | - public function __construct(stdClass|null $object = null) { |
|
| 40 | + public function __construct(stdClass | null $object = null) { |
|
| 41 | 41 | if ($object != null) { |
| 42 | 42 | parent::__construct($object, self::subs); |
| 43 | 43 | } |