@@ -450,94 +450,94 @@ discard block |
||
450 | 450 | ]; |
451 | 451 | |
452 | 452 | private const METHODS_KEYS = [ |
453 | - 'getUpdates' => ['offset','limit','timeout','allowed_updates','token','return_array','forgot','answer'], |
|
454 | - 'setWebhook' => ['url','certificate','ip_address','max_connections','allowed_updates','drop_pending_updates','secret_token','token','return_array','forgot','answer'], |
|
455 | - 'deleteWebhook' => ['drop_pending_updates','token','return_array','forgot','answer'], |
|
456 | - 'getWebhookInfo' => ['token','return_array','forgot','answer'], |
|
457 | - 'getMe' => ['token','return_array','forgot','answer'], |
|
458 | - 'logOut' => ['token','return_array','forgot','answer'], |
|
459 | - 'close' => ['token','return_array','forgot','answer'], |
|
460 | - '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'], |
|
461 | - 'forwardMessage' => ['chat_id','from_chat_id','disable_notification','protect_content','message_id','token','return_array','forgot','answer'], |
|
462 | - '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'], |
|
463 | - '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'], |
|
464 | - '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'], |
|
465 | - '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'], |
|
466 | - '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'], |
|
467 | - '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'], |
|
468 | - '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'], |
|
469 | - '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'], |
|
470 | - 'sendMediaGroup' => ['media','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','token','return_array','forgot','answer'], |
|
471 | - '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'], |
|
472 | - 'editMessageLiveLocation' => ['latitude','longitude','chat_id','message_id','inline_message_id','horizontal_accuracy','heading','proximity_alert_radius','reply_markup','token','return_array','forgot','answer'], |
|
473 | - 'stopMessageLiveLocation' => ['chat_id','message_id','inline_message_id','reply_markup','token','return_array','forgot','answer'], |
|
474 | - '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'], |
|
475 | - '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'], |
|
476 | - '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'], |
|
477 | - 'sendDice' => ['chat_id','emoji','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'], |
|
478 | - 'sendChatAction' => ['chat_id','action','token','return_array','forgot','answer'], |
|
479 | - 'getUserProfilePhotos' => ['user_id','offset','limit','token','return_array','forgot','answer'], |
|
480 | - 'getFile' => ['file_id','token','return_array','forgot','answer'], |
|
481 | - 'banChatMember' => ['chat_id','user_id','until_date','revoke_messages','token','return_array','forgot','answer'], |
|
482 | - 'unbanChatMember' => ['chat_id','user_id','only_if_banned','token','return_array','forgot','answer'], |
|
483 | - 'restrictChatMember' => ['permissions','chat_id','user_id','until_date','token','return_array','forgot','answer'], |
|
484 | - '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'], |
|
485 | - 'setChatAdministratorCustomTitle' => ['custom_title','chat_id','user_id','token','return_array','forgot','answer'], |
|
486 | - 'banChatSenderChat' => ['sender_chat_id','chat_id','token','return_array','forgot','answer'], |
|
487 | - 'unbanChatSenderChat' => ['sender_chat_id','chat_id','token','return_array','forgot','answer'], |
|
488 | - 'setChatPermissions' => ['permissions','chat_id','token','return_array','forgot','answer'], |
|
489 | - 'exportChatInviteLink' => ['chat_id','token','return_array','forgot','answer'], |
|
490 | - 'createChatInviteLink' => ['chat_id','name','expire_date','member_limit','creates_join_request','token','return_array','forgot','answer'], |
|
491 | - 'editChatInviteLink' => ['invite_link','chat_id','name','expire_date','member_limit','creates_join_request','token','return_array','forgot','answer'], |
|
492 | - 'revokeChatInviteLink' => ['invite_link','chat_id','token','return_array','forgot','answer'], |
|
493 | - 'approveChatJoinRequest' => ['chat_id','user_id','token','return_array','forgot','answer'], |
|
494 | - 'declineChatJoinRequest' => ['chat_id','user_id','token','return_array','forgot','answer'], |
|
495 | - 'setChatPhoto' => ['photo','chat_id','token','return_array','forgot','answer'], |
|
496 | - 'deleteChatPhoto' => ['chat_id','token','return_array','forgot','answer'], |
|
497 | - 'setChatTitle' => ['title','chat_id','token','return_array','forgot','answer'], |
|
498 | - 'setChatDescription' => ['chat_id','description','token','return_array','forgot','answer'], |
|
499 | - 'pinChatMessage' => ['message_id','chat_id','disable_notification','token','return_array','forgot','answer'], |
|
500 | - 'unpinChatMessage' => ['chat_id','message_id','token','return_array','forgot','answer'], |
|
501 | - 'unpinAllChatMessages' => ['chat_id','token','return_array','forgot','answer'], |
|
502 | - 'leaveChat' => ['chat_id','token','return_array','forgot','answer'], |
|
503 | - 'getChat' => ['chat_id','token','return_array','forgot','answer'], |
|
504 | - 'getChatAdministrators' => ['chat_id','token','return_array','forgot','answer'], |
|
505 | - 'getChatMemberCount' => ['chat_id','token','return_array','forgot','answer'], |
|
506 | - 'getChatMember' => ['chat_id','user_id','token','return_array','forgot','answer'], |
|
507 | - 'setChatStickerSet' => ['sticker_set_name','chat_id','token','return_array','forgot','answer'], |
|
508 | - 'deleteChatStickerSet' => ['chat_id','token','return_array','forgot','answer'], |
|
509 | - 'answerCallbackQuery' => ['callback_query_id','text','show_alert','url','cache_time','token','return_array','forgot','answer'], |
|
510 | - 'setMyCommands' => ['commands','scope','language_code','token','return_array','forgot','answer'], |
|
511 | - 'deleteMyCommands' => ['scope','language_code','token','return_array','forgot','answer'], |
|
512 | - 'getMyCommands' => ['scope','language_code','token','return_array','forgot','answer'], |
|
513 | - 'setChatMenuButton' => ['chat_id','menu_button','token','return_array','forgot','answer'], |
|
514 | - 'getChatMenuButton' => ['chat_id','token','return_array','forgot','answer'], |
|
515 | - 'setMyDefaultAdministratorRights' => ['rights','for_channels','token','return_array','forgot','answer'], |
|
516 | - 'getMyDefaultAdministratorRights' => ['for_channels','token','return_array','forgot','answer'], |
|
517 | - 'editMessageText' => ['text','chat_id','message_id','inline_message_id','parse_mode','entities','disable_web_page_preview','reply_markup','token','return_array','forgot','answer'], |
|
518 | - 'editMessageCaption' => ['chat_id','message_id','inline_message_id','caption','parse_mode','caption_entities','reply_markup','token','return_array','forgot','answer'], |
|
519 | - 'editMessageMedia' => ['media','chat_id','message_id','inline_message_id','reply_markup','token','return_array','forgot','answer'], |
|
520 | - 'editMessageReplyMarkup' => ['chat_id','message_id','inline_message_id','reply_markup','token','return_array','forgot','answer'], |
|
521 | - 'stopPoll' => ['chat_id','message_id','reply_markup','token','return_array','forgot','answer'], |
|
522 | - 'deleteMessage' => ['chat_id','message_id','token','return_array','forgot','answer'], |
|
523 | - 'sendSticker' => ['sticker','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'], |
|
524 | - 'getStickerSet' => ['name','token','return_array','forgot','answer'], |
|
525 | - 'uploadStickerFile' => ['png_sticker','user_id','token','return_array','forgot','answer'], |
|
526 | - 'createNewStickerSet' => ['name','title','emojis','user_id','png_sticker','tgs_sticker','webm_sticker','contains_masks','mask_position','token','return_array','forgot','answer'], |
|
527 | - 'addStickerToSet' => ['name','emojis','user_id','png_sticker','tgs_sticker','webm_sticker','mask_position','token','return_array','forgot','answer'], |
|
528 | - 'setStickerPositionInSet' => ['sticker','position','token','return_array','forgot','answer'], |
|
529 | - 'deleteStickerFromSet' => ['sticker','token','return_array','forgot','answer'], |
|
530 | - 'setStickerSetThumb' => ['name','user_id','thumb','token','return_array','forgot','answer'], |
|
531 | - 'answerInlineQuery' => ['results','inline_query_id','cache_time','is_personal','next_offset','switch_pm_text','switch_pm_parameter','token','return_array','forgot','answer'], |
|
532 | - 'answerWebAppQuery' => ['web_app_query_id','result','token','return_array','forgot','answer'], |
|
533 | - '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'], |
|
534 | - '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'], |
|
535 | - 'answerShippingQuery' => ['ok','shipping_query_id','shipping_options','error_message','token','return_array','forgot','answer'], |
|
536 | - 'answerPreCheckoutQuery' => ['ok','pre_checkout_query_id','error_message','token','return_array','forgot','answer'], |
|
537 | - 'setPassportDataErrors' => ['errors','user_id','token','return_array','forgot','answer'], |
|
538 | - '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'], |
|
539 | - 'setGameScore' => ['score','user_id','force','disable_edit_message','chat_id','message_id','inline_message_id','token','return_array','forgot','answer'], |
|
540 | - 'getGameHighScores' => ['user_id','chat_id','message_id','inline_message_id','token','return_array','forgot','answer'], |
|
453 | + 'getUpdates' => ['offset', 'limit', 'timeout', 'allowed_updates', 'token', 'return_array', 'forgot', 'answer'], |
|
454 | + 'setWebhook' => ['url', 'certificate', 'ip_address', 'max_connections', 'allowed_updates', 'drop_pending_updates', 'secret_token', 'token', 'return_array', 'forgot', 'answer'], |
|
455 | + 'deleteWebhook' => ['drop_pending_updates', 'token', 'return_array', 'forgot', 'answer'], |
|
456 | + 'getWebhookInfo' => ['token', 'return_array', 'forgot', 'answer'], |
|
457 | + 'getMe' => ['token', 'return_array', 'forgot', 'answer'], |
|
458 | + 'logOut' => ['token', 'return_array', 'forgot', 'answer'], |
|
459 | + 'close' => ['token', 'return_array', 'forgot', 'answer'], |
|
460 | + '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'], |
|
461 | + 'forwardMessage' => ['chat_id', 'from_chat_id', 'disable_notification', 'protect_content', 'message_id', 'token', 'return_array', 'forgot', 'answer'], |
|
462 | + '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'], |
|
463 | + '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'], |
|
464 | + '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'], |
|
465 | + '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'], |
|
466 | + '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'], |
|
467 | + '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'], |
|
468 | + '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'], |
|
469 | + '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'], |
|
470 | + 'sendMediaGroup' => ['media', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'token', 'return_array', 'forgot', 'answer'], |
|
471 | + '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'], |
|
472 | + 'editMessageLiveLocation' => ['latitude', 'longitude', 'chat_id', 'message_id', 'inline_message_id', 'horizontal_accuracy', 'heading', 'proximity_alert_radius', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
473 | + 'stopMessageLiveLocation' => ['chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
474 | + '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'], |
|
475 | + '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'], |
|
476 | + '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'], |
|
477 | + 'sendDice' => ['chat_id', 'emoji', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
478 | + 'sendChatAction' => ['chat_id', 'action', 'token', 'return_array', 'forgot', 'answer'], |
|
479 | + 'getUserProfilePhotos' => ['user_id', 'offset', 'limit', 'token', 'return_array', 'forgot', 'answer'], |
|
480 | + 'getFile' => ['file_id', 'token', 'return_array', 'forgot', 'answer'], |
|
481 | + 'banChatMember' => ['chat_id', 'user_id', 'until_date', 'revoke_messages', 'token', 'return_array', 'forgot', 'answer'], |
|
482 | + 'unbanChatMember' => ['chat_id', 'user_id', 'only_if_banned', 'token', 'return_array', 'forgot', 'answer'], |
|
483 | + 'restrictChatMember' => ['permissions', 'chat_id', 'user_id', 'until_date', 'token', 'return_array', 'forgot', 'answer'], |
|
484 | + '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'], |
|
485 | + 'setChatAdministratorCustomTitle' => ['custom_title', 'chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
486 | + 'banChatSenderChat' => ['sender_chat_id', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
487 | + 'unbanChatSenderChat' => ['sender_chat_id', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
488 | + 'setChatPermissions' => ['permissions', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
489 | + 'exportChatInviteLink' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
490 | + 'createChatInviteLink' => ['chat_id', 'name', 'expire_date', 'member_limit', 'creates_join_request', 'token', 'return_array', 'forgot', 'answer'], |
|
491 | + 'editChatInviteLink' => ['invite_link', 'chat_id', 'name', 'expire_date', 'member_limit', 'creates_join_request', 'token', 'return_array', 'forgot', 'answer'], |
|
492 | + 'revokeChatInviteLink' => ['invite_link', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
493 | + 'approveChatJoinRequest' => ['chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
494 | + 'declineChatJoinRequest' => ['chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
495 | + 'setChatPhoto' => ['photo', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
496 | + 'deleteChatPhoto' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
497 | + 'setChatTitle' => ['title', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
498 | + 'setChatDescription' => ['chat_id', 'description', 'token', 'return_array', 'forgot', 'answer'], |
|
499 | + 'pinChatMessage' => ['message_id', 'chat_id', 'disable_notification', 'token', 'return_array', 'forgot', 'answer'], |
|
500 | + 'unpinChatMessage' => ['chat_id', 'message_id', 'token', 'return_array', 'forgot', 'answer'], |
|
501 | + 'unpinAllChatMessages' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
502 | + 'leaveChat' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
503 | + 'getChat' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
504 | + 'getChatAdministrators' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
505 | + 'getChatMemberCount' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
506 | + 'getChatMember' => ['chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
507 | + 'setChatStickerSet' => ['sticker_set_name', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
508 | + 'deleteChatStickerSet' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
509 | + 'answerCallbackQuery' => ['callback_query_id', 'text', 'show_alert', 'url', 'cache_time', 'token', 'return_array', 'forgot', 'answer'], |
|
510 | + 'setMyCommands' => ['commands', 'scope', 'language_code', 'token', 'return_array', 'forgot', 'answer'], |
|
511 | + 'deleteMyCommands' => ['scope', 'language_code', 'token', 'return_array', 'forgot', 'answer'], |
|
512 | + 'getMyCommands' => ['scope', 'language_code', 'token', 'return_array', 'forgot', 'answer'], |
|
513 | + 'setChatMenuButton' => ['chat_id', 'menu_button', 'token', 'return_array', 'forgot', 'answer'], |
|
514 | + 'getChatMenuButton' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
515 | + 'setMyDefaultAdministratorRights' => ['rights', 'for_channels', 'token', 'return_array', 'forgot', 'answer'], |
|
516 | + 'getMyDefaultAdministratorRights' => ['for_channels', 'token', 'return_array', 'forgot', 'answer'], |
|
517 | + 'editMessageText' => ['text', 'chat_id', 'message_id', 'inline_message_id', 'parse_mode', 'entities', 'disable_web_page_preview', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
518 | + 'editMessageCaption' => ['chat_id', 'message_id', 'inline_message_id', 'caption', 'parse_mode', 'caption_entities', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
519 | + 'editMessageMedia' => ['media', 'chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
520 | + 'editMessageReplyMarkup' => ['chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
521 | + 'stopPoll' => ['chat_id', 'message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
522 | + 'deleteMessage' => ['chat_id', 'message_id', 'token', 'return_array', 'forgot', 'answer'], |
|
523 | + 'sendSticker' => ['sticker', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
524 | + 'getStickerSet' => ['name', 'token', 'return_array', 'forgot', 'answer'], |
|
525 | + 'uploadStickerFile' => ['png_sticker', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
526 | + 'createNewStickerSet' => ['name', 'title', 'emojis', 'user_id', 'png_sticker', 'tgs_sticker', 'webm_sticker', 'contains_masks', 'mask_position', 'token', 'return_array', 'forgot', 'answer'], |
|
527 | + 'addStickerToSet' => ['name', 'emojis', 'user_id', 'png_sticker', 'tgs_sticker', 'webm_sticker', 'mask_position', 'token', 'return_array', 'forgot', 'answer'], |
|
528 | + 'setStickerPositionInSet' => ['sticker', 'position', 'token', 'return_array', 'forgot', 'answer'], |
|
529 | + 'deleteStickerFromSet' => ['sticker', 'token', 'return_array', 'forgot', 'answer'], |
|
530 | + 'setStickerSetThumb' => ['name', 'user_id', 'thumb', 'token', 'return_array', 'forgot', 'answer'], |
|
531 | + 'answerInlineQuery' => ['results', 'inline_query_id', 'cache_time', 'is_personal', 'next_offset', 'switch_pm_text', 'switch_pm_parameter', 'token', 'return_array', 'forgot', 'answer'], |
|
532 | + 'answerWebAppQuery' => ['web_app_query_id', 'result', 'token', 'return_array', 'forgot', 'answer'], |
|
533 | + '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'], |
|
534 | + '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'], |
|
535 | + 'answerShippingQuery' => ['ok', 'shipping_query_id', 'shipping_options', 'error_message', 'token', 'return_array', 'forgot', 'answer'], |
|
536 | + 'answerPreCheckoutQuery' => ['ok', 'pre_checkout_query_id', 'error_message', 'token', 'return_array', 'forgot', 'answer'], |
|
537 | + 'setPassportDataErrors' => ['errors', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
538 | + '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'], |
|
539 | + 'setGameScore' => ['score', 'user_id', 'force', 'disable_edit_message', 'chat_id', 'message_id', 'inline_message_id', 'token', 'return_array', 'forgot', 'answer'], |
|
540 | + 'getGameHighScores' => ['user_id', 'chat_id', 'message_id', 'inline_message_id', 'token', 'return_array', 'forgot', 'answer'], |
|
541 | 541 | ]; |
542 | 542 | |
543 | 543 | private const METHODS_WITH_FILE = [ |
@@ -566,8 +566,8 @@ discard block |
||
566 | 566 | 'logOut' => [], |
567 | 567 | 'close' => [], |
568 | 568 | 'sendMessage' => ['chat_id'], |
569 | - 'forwardMessage' => ['from_chat_id','message_id'], |
|
570 | - 'copyMessage' => ['from_chat_id','message_id'], |
|
569 | + 'forwardMessage' => ['from_chat_id', 'message_id'], |
|
570 | + 'copyMessage' => ['from_chat_id', 'message_id'], |
|
571 | 571 | 'sendPhoto' => ['chat_id'], |
572 | 572 | 'sendAudio' => ['chat_id'], |
573 | 573 | 'sendDocument' => ['chat_id'], |
@@ -583,15 +583,15 @@ discard block |
||
583 | 583 | 'sendContact' => ['chat_id'], |
584 | 584 | 'sendPoll' => ['chat_id'], |
585 | 585 | 'sendDice' => ['chat_id'], |
586 | - 'sendChatAction' => ['chat_id','action'], |
|
586 | + 'sendChatAction' => ['chat_id', 'action'], |
|
587 | 587 | 'getUserProfilePhotos' => ['user_id'], |
588 | 588 | 'getFile' => ['file_id'], |
589 | - 'banChatMember' => ['chat_id','user_id'], |
|
590 | - 'kickChatMember' => ['chat_id','user_id'], |
|
591 | - 'unbanChatMember' => ['chat_id','user_id'], |
|
592 | - 'restrictChatMember' => ['chat_id','user_id'], |
|
593 | - 'promoteChatMember' => ['chat_id','user_id'], |
|
594 | - 'setChatAdministratorCustomTitle' => ['chat_id','user_id'], |
|
589 | + 'banChatMember' => ['chat_id', 'user_id'], |
|
590 | + 'kickChatMember' => ['chat_id', 'user_id'], |
|
591 | + 'unbanChatMember' => ['chat_id', 'user_id'], |
|
592 | + 'restrictChatMember' => ['chat_id', 'user_id'], |
|
593 | + 'promoteChatMember' => ['chat_id', 'user_id'], |
|
594 | + 'setChatAdministratorCustomTitle' => ['chat_id', 'user_id'], |
|
595 | 595 | 'banChatSenderChat' => ['chat_id'], |
596 | 596 | 'unbanChatSenderChat' => ['chat_id'], |
597 | 597 | 'setChatPermissions' => ['chat_id'], |
@@ -599,8 +599,8 @@ discard block |
||
599 | 599 | 'createChatInviteLink' => ['chat_id'], |
600 | 600 | 'editChatInviteLink' => ['chat_id'], |
601 | 601 | 'revokeChatInviteLink' => ['chat_id'], |
602 | - 'approveChatJoinRequest' => ['chat_id','user_id'], |
|
603 | - 'declineChatJoinRequest' => ['chat_id','user_id'], |
|
602 | + 'approveChatJoinRequest' => ['chat_id', 'user_id'], |
|
603 | + 'declineChatJoinRequest' => ['chat_id', 'user_id'], |
|
604 | 604 | 'setChatPhoto' => ['chat_id'], |
605 | 605 | 'deleteChatPhoto' => ['chat_id'], |
606 | 606 | 'setChatTitle' => ['chat_id'], |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | 'getChat' => ['chat_id'], |
613 | 613 | 'getChatAdministrators' => ['chat_id'], |
614 | 614 | 'getChatMembersCount' => ['chat_id'], |
615 | - 'getChatMember' => ['chat_id','user_id'], |
|
615 | + 'getChatMember' => ['chat_id', 'user_id'], |
|
616 | 616 | 'setChatStickerSet' => ['chat_id'], |
617 | 617 | 'deleteChatStickerSet' => ['chat_id'], |
618 | 618 | 'answerCallbackQuery' => ['callback_query_id'], |
@@ -623,12 +623,12 @@ discard block |
||
623 | 623 | 'getChatMenuButton' => [], |
624 | 624 | 'setMyDefaultAdministratorRights' => [], |
625 | 625 | 'getMyDefaultAdministratorRights' => [], |
626 | - 'editMessageText' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
627 | - 'editMessageCaption' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
628 | - 'editMessageMedia' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
629 | - 'editMessageReplyMarkup' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
630 | - 'stopPoll' => ['chat_id','message_id'], |
|
631 | - 'deleteMessage' => ['chat_id','message_id'], |
|
626 | + 'editMessageText' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
627 | + 'editMessageCaption' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
628 | + 'editMessageMedia' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
629 | + 'editMessageReplyMarkup' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
630 | + 'stopPoll' => ['chat_id', 'message_id'], |
|
631 | + 'deleteMessage' => ['chat_id', 'message_id'], |
|
632 | 632 | 'sendSticker' => ['chat_id'], |
633 | 633 | 'getStickerSet' => [], |
634 | 634 | 'uploadStickerFile' => ['user_id'], |
@@ -644,8 +644,8 @@ discard block |
||
644 | 644 | 'answerPreCheckoutQuery' => ['pre_checkout_query_id'], |
645 | 645 | 'setPassportDataErrors' => ['user_id'], |
646 | 646 | 'sendGame' => ['chat_id'], |
647 | - 'setGameScore' => ['user_id','inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
648 | - 'getGameHighScores' => ['user_id','inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']] |
|
647 | + 'setGameScore' => ['user_id', 'inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
648 | + 'getGameHighScores' => ['user_id', 'inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']] |
|
649 | 649 | ]; |
650 | 650 | |
651 | 651 | private const METHODS_RETURN = [ |
@@ -697,25 +697,25 @@ discard block |
||
697 | 697 | ]; |
698 | 698 | |
699 | 699 | |
700 | - public static function __callStatic (string $name, array $arguments) { |
|
700 | + public static function __callStatic(string $name, array $arguments) { |
|
701 | 701 | if ($action = self::methodAction($name)) { |
702 | - self::keysName($action,$arguments); |
|
703 | - self::readyFile($action,$arguments); |
|
704 | - self::setDefaults($action,$arguments); |
|
702 | + self::keysName($action, $arguments); |
|
703 | + self::readyFile($action, $arguments); |
|
704 | + self::setDefaults($action, $arguments); |
|
705 | 705 | if (isset($arguments['answer'])) { |
706 | - return answer::init($action,$arguments); |
|
706 | + return answer::init($action, $arguments); |
|
707 | 707 | } |
708 | 708 | else { |
709 | - return self::processResponse($action,curl::init($action,$arguments)); |
|
709 | + return self::processResponse($action, curl::init($action, $arguments)); |
|
710 | 710 | } |
711 | 711 | } |
712 | 712 | else { |
713 | - logger::write("$name method is not supported",loggerTypes::ERROR); |
|
713 | + logger::write("$name method is not supported", loggerTypes::ERROR); |
|
714 | 714 | throw new bptException('METHOD_NOT_FOUND'); |
715 | 715 | } |
716 | 716 | } |
717 | 717 | |
718 | - private static function keysName (string $name, array &$arguments): void { |
|
718 | + private static function keysName(string $name, array &$arguments): void { |
|
719 | 719 | foreach ($arguments as $key => $argument) { |
720 | 720 | if (is_numeric($key) && isset(self::METHODS_KEYS[$name][$key])) { |
721 | 721 | $arguments[self::METHODS_KEYS[$name][$key]] = $argument; |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | } |
725 | 725 | } |
726 | 726 | |
727 | - private static function methodAction(string $name): string|false { |
|
727 | + private static function methodAction(string $name): string | false { |
|
728 | 728 | return self::METHODS_ACTION[str_replace('_', '', strtolower($name))] ?? false; |
729 | 729 | } |
730 | 730 | |
@@ -745,11 +745,11 @@ discard block |
||
745 | 745 | } |
746 | 746 | } |
747 | 747 | |
748 | - private static function methodFile(string $name): array|false { |
|
748 | + private static function methodFile(string $name): array | false { |
|
749 | 749 | return self::METHODS_WITH_FILE[$name] ?? false; |
750 | 750 | } |
751 | 751 | |
752 | - private static function methodReturn(string $name,stdClass $response) { |
|
752 | + private static function methodReturn(string $name, stdClass $response) { |
|
753 | 753 | if (isset(self::METHODS_RETURN[$name])) { |
754 | 754 | $return = self::METHODS_RETURN[$name]; |
755 | 755 | if (is_array($return)) { |
@@ -772,13 +772,13 @@ discard block |
||
772 | 772 | $defaults = self::METHODS_EXTRA_DEFAULTS[$name]; |
773 | 773 | foreach ($defaults as $key => $default) { |
774 | 774 | if (is_numeric($key)) { |
775 | - if (!isset($arguments[$default])){ |
|
775 | + if (!isset($arguments[$default])) { |
|
776 | 776 | $arguments[$default] = self::catchFields($default); |
777 | 777 | } |
778 | 778 | } |
779 | 779 | elseif (isset(BPT::$update->$key) || $key === 'other') { |
780 | 780 | foreach ($default as $def) { |
781 | - if (!isset($arguments[$def])){ |
|
781 | + if (!isset($arguments[$def])) { |
|
782 | 782 | $arguments[$def] = self::catchFields($def); |
783 | 783 | } |
784 | 784 | } |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | if ($response->ok) { |
792 | 792 | self::$status = true; |
793 | 793 | self::$pure_response = $response; |
794 | - return self::methodReturn($name,$response); |
|
794 | + return self::methodReturn($name, $response); |
|
795 | 795 | } |
796 | 796 | else { |
797 | 797 | self::$status = false; |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | * |
808 | 808 | * @return int|string|bool |
809 | 809 | */ |
810 | - public static function catchFields (string $field): int|string|bool { |
|
810 | + public static function catchFields(string $field): int | string | bool { |
|
811 | 811 | switch ($field) { |
812 | 812 | case 'chat_id' : |
813 | 813 | case 'from_chat_id' : |
@@ -943,7 +943,7 @@ discard block |
||
943 | 943 | default => false |
944 | 944 | }; |
945 | 945 | case 'url' : |
946 | - return 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; |
|
946 | + return 'https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; |
|
947 | 947 | default: |
948 | 948 | return false; |
949 | 949 | } |
@@ -5,7 +5,7 @@ |
||
5 | 5 | * telegram class , Adding normal method call to request class and a simple name for being easy to call |
6 | 6 | */ |
7 | 7 | class telegram extends request { |
8 | - public function __call (string $name, array $arguments) { |
|
8 | + public function __call(string $name, array $arguments) { |
|
9 | 9 | if (!isset($arguments[1]) && isset($arguments[0]) && is_array($arguments[0])) { |
10 | 10 | return request::$name(...$arguments[0]); |
11 | 11 | } |
@@ -14,12 +14,12 @@ discard block |
||
14 | 14 | * curl class , for multiprocessing with curl tricks |
15 | 15 | */ |
16 | 16 | class curl extends webhook { |
17 | - public static function init (): string|null { |
|
17 | + public static function init(): string | null { |
|
18 | 18 | if (self::checkIP()) { |
19 | 19 | return self::getUpdate(); |
20 | 20 | } |
21 | 21 | else { |
22 | - logger::write('not authorized access denied. IP : '. $_SERVER['REMOTE_ADDR'] ?? 'unknown',loggerTypes::WARNING); |
|
22 | + logger::write('not authorized access denied. IP : '.$_SERVER['REMOTE_ADDR'] ?? 'unknown', loggerTypes::WARNING); |
|
23 | 23 | BPT::exit(); |
24 | 24 | return null; |
25 | 25 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | return $_SERVER['REMOTE_ADDR'] === $_SERVER['SERVER_ADDR']; |
30 | 30 | } |
31 | 31 | |
32 | - private static function getUpdate (): string { |
|
32 | + private static function getUpdate(): string { |
|
33 | 33 | $input = json_decode(file_get_contents("php://input"), true); |
34 | 34 | webhook::telegramVerify($input['ip']); |
35 | 35 | return $input['update']; |
@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | $urls = self::setURLS(); |
43 | 43 | $file = $urls['file']; |
44 | 44 | $timeout = self::getTimeout($file); |
45 | - self::create($file,$timeout); |
|
45 | + self::create($file, $timeout); |
|
46 | 46 | self::setWebhook($urls['url']); |
47 | 47 | lock::set('BPT-MULTI-CURL'); |
48 | 48 | } |
49 | 49 | |
50 | - private static function getTimeout($url): float|int { |
|
50 | + private static function getTimeout($url): float | int { |
|
51 | 51 | $times = []; |
52 | - for ($i = 0; $i < 10; $i ++) { |
|
52 | + for ($i = 0; $i < 10; $i++) { |
|
53 | 53 | $ch = curl_init($url); |
54 | 54 | curl_setopt_array($ch, [CURLOPT_POSTFIELDS => json_encode([]), CURLOPT_TIMEOUT_MS => 100, CURLOPT_NOBODY => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_CONNECTTIMEOUT_MS => 100, CURLOPT_HTTPHEADER => ['accept: application/json', 'content-type: application/json']]); |
55 | 55 | $start = microtime(true); |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | return $timeout > 50 ? $timeout + 10 : 50; |
61 | 61 | } |
62 | 62 | |
63 | - private static function create($file,$timeout) { |
|
64 | - file_put_contents('receiver.php', '<?php http_response_code(200);ignore_user_abort();$ch = curl_init(\'' . $file . '\');curl_setopt_array($ch, [CURLOPT_POSTFIELDS => json_encode([\'update\'=>file_get_contents(\'php://input\'),\'ip\'=>$_SERVER[\'REMOTE_ADDR\']]), CURLOPT_TIMEOUT_MS => ' . $timeout . ', CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_CONNECTTIMEOUT_MS => ' . $timeout . ', CURLOPT_HTTPHEADER => [\'accept: application/json\', \'content-type: application/json\']]);curl_exec($ch);curl_close($ch);?>'); |
|
63 | + private static function create($file, $timeout) { |
|
64 | + file_put_contents('receiver.php', '<?php http_response_code(200);ignore_user_abort();$ch = curl_init(\''.$file.'\');curl_setopt_array($ch, [CURLOPT_POSTFIELDS => json_encode([\'update\'=>file_get_contents(\'php://input\'),\'ip\'=>$_SERVER[\'REMOTE_ADDR\']]), CURLOPT_TIMEOUT_MS => '.$timeout.', CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_CONNECTTIMEOUT_MS => '.$timeout.', CURLOPT_HTTPHEADER => [\'accept: application/json\', \'content-type: application/json\']]);curl_exec($ch);curl_close($ch);?>'); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | private static function setURLS(): array { |
68 | - $base_url = (isset(settings::$certificate) ? 'http://' : 'https://') . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; |
|
68 | + $base_url = (isset(settings::$certificate) ? 'http://' : 'https://').$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; |
|
69 | 69 | $file = basename($_SERVER['REQUEST_URI']); |
70 | 70 | return [ |
71 | 71 | 'url'=>str_replace($file, 'receiver.php', $base_url), |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * @internal Only for BPT self usage , Don't use it in your source! |
19 | 19 | */ |
20 | - public static function init(): string|null { |
|
20 | + public static function init(): string | null { |
|
21 | 21 | return self::getUpdate(); |
22 | 22 | } |
23 | 23 | |
24 | - private static function getUpdate (): string|null { |
|
24 | + private static function getUpdate(): string | null { |
|
25 | 25 | $up = glob('*.update'); |
26 | 26 | if (isset($up[0])) { |
27 | 27 | $up = end($up); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | return $update; |
33 | 33 | } |
34 | 34 | else { |
35 | - logger::write('not authorized access denied. IP : '. $_SERVER['REMOTE_ADDR'] ?? 'unknown',loggerTypes::WARNING); |
|
35 | + logger::write('not authorized access denied. IP : '.$_SERVER['REMOTE_ADDR'] ?? 'unknown', loggerTypes::WARNING); |
|
36 | 36 | BPT::exit(); |
37 | 37 | return null; |
38 | 38 | } |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | private static function create($file) { |
62 | - file_put_contents('receiver.php', '<?php $BPT = file_get_contents("php://input");$id = json_decode($BPT, true)[\'update_id\'];file_put_contents("{$_SERVER[\'REMOTE_ADDR\']}-$id.update",$BPT);exec("php ' . $file . ' > /dev/null &");'); |
|
62 | + file_put_contents('receiver.php', '<?php $BPT = file_get_contents("php://input");$id = json_decode($BPT, true)[\'update_id\'];file_put_contents("{$_SERVER[\'REMOTE_ADDR\']}-$id.update",$BPT);exec("php '.$file.' > /dev/null &");'); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | private static function setURLS(): array { |
66 | - $base_url = (isset(settings::$certificate) ? 'http://' : 'https://') . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; |
|
66 | + $base_url = (isset(settings::$certificate) ? 'http://' : 'https://').$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; |
|
67 | 67 | return [ |
68 | 68 | 'url'=>str_replace(basename($_SERVER['REQUEST_URI']), 'receiver.php', $base_url), |
69 | 69 | 'file'=>basename($_SERVER['SCRIPT_NAME']) |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | /** |
20 | 20 | * @internal Only for BPT self usage , Don't use it in your source! |
21 | 21 | */ |
22 | - public static function init () { |
|
22 | + public static function init() { |
|
23 | 23 | if (settings::$multi) { |
24 | 24 | multi::init(); |
25 | 25 | } |
@@ -48,26 +48,26 @@ discard block |
||
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
51 | - protected static function setWebhook(string $url,string $secret = '') { |
|
51 | + protected static function setWebhook(string $url, string $secret = '') { |
|
52 | 52 | $res = telegram::setWebhook($url, settings::$certificate, max_connections: settings::$max_connection, allowed_updates: settings::$allowed_updates, drop_pending_updates: settings::$skip_old_updates, secret_token: $secret); |
53 | 53 | if (telegram::$status) { |
54 | - logger::write('Webhook was set successfully',loggerTypes::INFO); |
|
54 | + logger::write('Webhook was set successfully', loggerTypes::INFO); |
|
55 | 55 | } |
56 | 56 | else { |
57 | - logger::write("There is some problem happened , telegram response : \n".json_encode($res),loggerTypes::ERROR); |
|
58 | - BPT::exit(print_r($res,true)); |
|
57 | + logger::write("There is some problem happened , telegram response : \n".json_encode($res), loggerTypes::ERROR); |
|
58 | + BPT::exit(print_r($res, true)); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
62 | 62 | protected static function checkURL() { |
63 | 63 | if (!(isset($_SERVER['SERVER_NAME']) && isset($_SERVER['REQUEST_URI']))) { |
64 | - logger::write('For using webhook receiver , you should open this file in your webserver(by domain)',loggerTypes::ERROR); |
|
64 | + logger::write('For using webhook receiver , you should open this file in your webserver(by domain)', loggerTypes::ERROR); |
|
65 | 65 | throw new bptException('WEBHOOK_NEED_URL'); |
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | 69 | private static function setURL(): string { |
70 | - return (isset(settings::$certificate) ? 'http://' : 'https://') . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME']; |
|
70 | + return (isset(settings::$certificate) ? 'http://' : 'https://').$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | protected static function setCertificate() { |
@@ -89,15 +89,15 @@ discard block |
||
89 | 89 | self::setCertificate(); |
90 | 90 | $url = self::setURL(); |
91 | 91 | $secret = settings::$secret ?? tools::randomString(64); |
92 | - self::setWebhook($url,$secret); |
|
93 | - lock::save('BPT-HOOK',$secret); |
|
92 | + self::setWebhook($url, $secret); |
|
93 | + lock::save('BPT-HOOK', $secret); |
|
94 | 94 | BPT::exit('Done'); |
95 | 95 | } |
96 | 96 | |
97 | 97 | private static function checkSecret() { |
98 | 98 | $secret = lock::read('BPT-HOOK'); |
99 | 99 | if ($secret !== self::getSecret()) { |
100 | - logger::write('This is not webhook set by BPT, webhook will reset',loggerTypes::WARNING); |
|
100 | + logger::write('This is not webhook set by BPT, webhook will reset', loggerTypes::WARNING); |
|
101 | 101 | self::processSetWebhook(); |
102 | 102 | } |
103 | 103 | } |
@@ -41,13 +41,13 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | if (!tools::isTelegram($ip ?? '')) { |
44 | - logger::write('not authorized access denied. IP : '. $ip ?? 'unknown',loggerTypes::WARNING); |
|
44 | + logger::write('not authorized access denied. IP : '.$ip ?? 'unknown', loggerTypes::WARNING); |
|
45 | 45 | BPT::exit(); |
46 | 46 | } |
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
50 | - protected static function processUpdate(string|stdClass|update $update = null): void { |
|
50 | + protected static function processUpdate(string | stdClass | update $update = null): void { |
|
51 | 51 | if (!is_object($update)) { |
52 | 52 | $update = json_decode($update ?? file_get_contents("php://input")); |
53 | 53 | if (!$update) { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | - if (!is_a($update,'update')) { |
|
58 | + if (!is_a($update, 'update')) { |
|
59 | 59 | $update = new update($update); |
60 | 60 | } |
61 | 61 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | db::save(); |
67 | 67 | } |
68 | 68 | |
69 | - protected static function setMessageExtra (update &$update): void { |
|
69 | + protected static function setMessageExtra(update & $update): void { |
|
70 | 70 | if ((isset($update->message) && isset($update->message->text)) || (isset($update->edited_message) && isset($update->edited_message->text))) { |
71 | 71 | $type = isset($update->message) ? 'message' : 'edited_message'; |
72 | 72 | $text = &$update->$type->text; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | BPT::$handler->something_else(BPT::$update); |
140 | 140 | } |
141 | 141 | else { |
142 | - logger::write('Update received but handlers does not set',loggerTypes::WARNING); |
|
142 | + logger::write('Update received but handlers does not set', loggerTypes::WARNING); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | } |
@@ -14,25 +14,25 @@ discard block |
||
14 | 14 | * getUpdates class , For receiving updates by polling methods |
15 | 15 | */ |
16 | 16 | class getUpdates extends receiver { |
17 | - public static function init () { |
|
17 | + public static function init() { |
|
18 | 18 | $last_update_id = self::loadData(); |
19 | - while(true) { |
|
19 | + while (true) { |
|
20 | 20 | if (!lock::exist('getUpdate')) { |
21 | - $updates = telegram::getUpdates($last_update_id,allowed_updates: settings::$allowed_updates); |
|
21 | + $updates = telegram::getUpdates($last_update_id, allowed_updates: settings::$allowed_updates); |
|
22 | 22 | if (telegram::$status) { |
23 | 23 | self::handleUpdates($updates); |
24 | - lock::save('getUpdate',BPT::$update->update_id+1); |
|
25 | - $last_update_id = BPT::$update->update_id+1; |
|
24 | + lock::save('getUpdate', BPT::$update->update_id + 1); |
|
25 | + $last_update_id = BPT::$update->update_id + 1; |
|
26 | 26 | } |
27 | 27 | else { |
28 | - logger::write("There is some problem happened , telegram response : \n".json_encode($updates),loggerTypes::ERROR); |
|
29 | - BPT::exit(print_r($updates,true)); |
|
28 | + logger::write("There is some problem happened , telegram response : \n".json_encode($updates), loggerTypes::ERROR); |
|
29 | + BPT::exit(print_r($updates, true)); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | - private static function loadData(): bool|int|string { |
|
35 | + private static function loadData(): bool | int | string { |
|
36 | 36 | if (lock::exist('getUpdate')) { |
37 | 37 | $last_update_id = lock::read('getUpdate'); |
38 | 38 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | self::deleteOldLocks(); |
41 | 41 | telegram::deleteWebhook(); |
42 | 42 | $last_update_id = 0; |
43 | - lock::save('getUpdate',0); |
|
43 | + lock::save('getUpdate', 0); |
|
44 | 44 | } |
45 | 45 | return $last_update_id; |
46 | 46 | } |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return bool|int |
37 | 37 | */ |
38 | - public static function save(string $name, string $data): bool|int { |
|
39 | - return file_put_contents(settings::$name."$name.lock", $data) && chmod(settings::$name."$name.lock",0640); |
|
38 | + public static function save(string $name, string $data): bool | int { |
|
39 | + return file_put_contents(settings::$name."$name.lock", $data) && chmod(settings::$name."$name.lock", 0640); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return bool|string |
48 | 48 | */ |
49 | - public static function read(string $name): bool|string { |
|
49 | + public static function read(string $name): bool | string { |
|
50 | 50 | return file_get_contents(settings::$name."$name.lock"); |
51 | 51 | } |
52 | 52 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @return bool|int |
59 | 59 | */ |
60 | - public static function mtime(string $name): bool|int { |
|
60 | + public static function mtime(string $name): bool | int { |
|
61 | 61 | return filemtime(settings::$name."$name.lock"); |
62 | 62 | } |
63 | 63 |
@@ -2,12 +2,12 @@ |
||
2 | 2 | |
3 | 3 | namespace BPT; |
4 | 4 | |
5 | -use BPT\tools\{is,file,convert,generator,encrypt}; |
|
5 | +use BPT\tools\{is, file, convert, generator, encrypt}; |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * tools class , gather what ever you need |
9 | 9 | */ |
10 | -class tools{ |
|
10 | +class tools { |
|
11 | 11 | use is; |
12 | 12 | use file; |
13 | 13 | use convert; |