@@ -480,95 +480,95 @@ discard block |
||
| 480 | 480 | ]; |
| 481 | 481 | |
| 482 | 482 | private const METHODS_KEYS = [ |
| 483 | - 'getUpdates' => ['offset','limit','timeout','allowed_updates','token','forgot','answer'], |
|
| 484 | - 'setWebhook' => ['url','certificate','ip_address','max_connections','allowed_updates','drop_pending_updates','secret_token','token','forgot','answer'], |
|
| 485 | - 'deleteWebhook' => ['drop_pending_updates','token','forgot','answer'], |
|
| 486 | - 'getWebhookInfo' => ['token','forgot','answer'], |
|
| 487 | - 'getMe' => ['token','forgot','answer'], |
|
| 488 | - 'logOut' => ['token','forgot','answer'], |
|
| 489 | - 'close' => ['token','forgot','answer'], |
|
| 490 | - 'sendMessage' => ['text','chat_id','parse_mode','entities','disable_web_page_preview','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
| 491 | - 'forwardMessage' => ['chat_id','from_chat_id','disable_notification','protect_content','message_id','token','forgot','answer'], |
|
| 492 | - 'copyMessage' => ['chat_id','from_chat_id','message_id','caption','parse_mode','caption_entities','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
| 493 | - 'sendPhoto' => ['photo','chat_id','caption','parse_mode','caption_entities','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
| 494 | - 'sendAudio' => ['audio','chat_id','caption','parse_mode','caption_entities','duration','performer','title','thumb','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
| 495 | - 'sendDocument' => ['document','chat_id','thumb','caption','parse_mode','caption_entities','disable_content_type_detection','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
| 496 | - 'sendVideo' => ['video','chat_id','duration','width','height','thumb','caption','parse_mode','caption_entities','supports_streaming','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
| 497 | - 'sendAnimation' => ['animation','chat_id','duration','width','height','thumb','caption','parse_mode','caption_entities','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
| 498 | - 'sendVoice' => ['voice','chat_id','caption','parse_mode','caption_entities','duration','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
| 499 | - 'sendVideoNote' => ['video_note','chat_id','duration','length','thumb','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
| 500 | - 'sendMediaGroup' => ['media','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','token','forgot','answer'], |
|
| 501 | - 'sendLocation' => ['latitude','longitude','chat_id','horizontal_accuracy','live_period','heading','proximity_alert_radius','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
| 502 | - 'editMessageLiveLocation' => ['latitude','longitude','chat_id','message_id','inline_message_id','horizontal_accuracy','heading','proximity_alert_radius','reply_markup','token','forgot','answer'], |
|
| 503 | - 'stopMessageLiveLocation' => ['chat_id','message_id','inline_message_id','reply_markup','token','forgot','answer'], |
|
| 504 | - 'sendVenue' => ['chat_id','latitude','longitude','title','address','foursquare_id','foursquare_type','google_place_id','google_place_type','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
| 505 | - 'sendContact' => ['phone_number','first_name','chat_id','last_name','vcard','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
| 506 | - 'sendPoll' => ['question','options','chat_id','is_anonymous','type','allows_multiple_answers','correct_option_id','explanation','explanation_parse_mode','explanation_entities','open_period','close_date','is_closed','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
| 507 | - 'sendDice' => ['chat_id','emoji','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
| 508 | - 'sendChatAction' => ['chat_id','action','token','forgot','answer'], |
|
| 509 | - 'getUserProfilePhotos' => ['user_id','offset','limit','token','forgot','answer'], |
|
| 510 | - 'getFile' => ['file_id','token','forgot','answer'], |
|
| 511 | - 'banChatMember' => ['chat_id','user_id','until_date','revoke_messages','token','forgot','answer'], |
|
| 512 | - 'unbanChatMember' => ['chat_id','user_id','only_if_banned','token','forgot','answer'], |
|
| 513 | - 'restrictChatMember' => ['permissions','chat_id','user_id','until_date','token','forgot','answer'], |
|
| 514 | - 'promoteChatMember' => ['chat_id','user_id','is_anonymous','can_manage_chat','can_post_messages','can_edit_messages','can_delete_messages','can_manage_video_chats','can_restrict_members','can_promote_members','can_change_info','can_invite_users','can_pin_messages','token','forgot','answer'], |
|
| 515 | - 'setChatAdministratorCustomTitle' => ['custom_title','chat_id','user_id','token','forgot','answer'], |
|
| 516 | - 'banChatSenderChat' => ['sender_chat_id','chat_id','token','forgot','answer'], |
|
| 517 | - 'unbanChatSenderChat' => ['sender_chat_id','chat_id','token','forgot','answer'], |
|
| 518 | - 'setChatPermissions' => ['permissions','chat_id','token','forgot','answer'], |
|
| 519 | - 'exportChatInviteLink' => ['chat_id','token','forgot','answer'], |
|
| 520 | - 'createChatInviteLink' => ['chat_id','name','expire_date','member_limit','creates_join_request','token','forgot','answer'], |
|
| 521 | - 'editChatInviteLink' => ['invite_link','chat_id','name','expire_date','member_limit','creates_join_request','token','forgot','answer'], |
|
| 522 | - 'revokeChatInviteLink' => ['invite_link','chat_id','token','forgot','answer'], |
|
| 523 | - 'approveChatJoinRequest' => ['chat_id','user_id','token','forgot','answer'], |
|
| 524 | - 'declineChatJoinRequest' => ['chat_id','user_id','token','forgot','answer'], |
|
| 525 | - 'setChatPhoto' => ['photo','chat_id','token','forgot','answer'], |
|
| 526 | - 'deleteChatPhoto' => ['chat_id','token','forgot','answer'], |
|
| 527 | - 'setChatTitle' => ['title','chat_id','token','forgot','answer'], |
|
| 528 | - 'setChatDescription' => ['chat_id','description','token','forgot','answer'], |
|
| 529 | - 'pinChatMessage' => ['message_id','chat_id','disable_notification','token','forgot','answer'], |
|
| 530 | - 'unpinChatMessage' => ['chat_id','message_id','token','forgot','answer'], |
|
| 531 | - 'unpinAllChatMessages' => ['chat_id','token','forgot','answer'], |
|
| 532 | - 'leaveChat' => ['chat_id','token','forgot','answer'], |
|
| 533 | - 'getChat' => ['chat_id','token','forgot','answer'], |
|
| 534 | - 'getChatAdministrators' => ['chat_id','token','forgot','answer'], |
|
| 535 | - 'getChatMemberCount' => ['chat_id','token','forgot','answer'], |
|
| 536 | - 'getChatMember' => ['chat_id','user_id','token','forgot','answer'], |
|
| 537 | - 'setChatStickerSet' => ['sticker_set_name','chat_id','token','forgot','answer'], |
|
| 538 | - 'deleteChatStickerSet' => ['chat_id','token','forgot','answer'], |
|
| 539 | - 'answerCallbackQuery' => ['callback_query_id','text','show_alert','url','cache_time','token','forgot','answer'], |
|
| 540 | - 'setMyCommands' => ['commands','scope','language_code','token','forgot','answer'], |
|
| 541 | - 'deleteMyCommands' => ['scope','language_code','token','forgot','answer'], |
|
| 542 | - 'getMyCommands' => ['scope','language_code','token','forgot','answer'], |
|
| 543 | - 'setChatMenuButton' => ['chat_id','menu_button','token','forgot','answer'], |
|
| 544 | - 'getChatMenuButton' => ['chat_id','token','forgot','answer'], |
|
| 545 | - 'setMyDefaultAdministratorRights' => ['rights','for_channels','token','forgot','answer'], |
|
| 546 | - 'getMyDefaultAdministratorRights' => ['for_channels','token','forgot','answer'], |
|
| 547 | - 'editMessageText' => ['text','chat_id','message_id','inline_message_id','parse_mode','entities','disable_web_page_preview','reply_markup','token','forgot','answer'], |
|
| 548 | - 'editMessageCaption' => ['chat_id','message_id','inline_message_id','caption','parse_mode','caption_entities','reply_markup','token','forgot','answer'], |
|
| 549 | - 'editMessageMedia' => ['media','chat_id','message_id','inline_message_id','reply_markup','token','forgot','answer'], |
|
| 550 | - 'editMessageReplyMarkup' => ['chat_id','message_id','inline_message_id','reply_markup','token','forgot','answer'], |
|
| 551 | - 'stopPoll' => ['chat_id','message_id','reply_markup','token','forgot','answer'], |
|
| 552 | - 'deleteMessage' => ['chat_id','message_id','token','forgot','answer'], |
|
| 553 | - 'sendSticker' => ['sticker','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
| 554 | - 'getStickerSet' => ['name','token','forgot','answer'], |
|
| 483 | + 'getUpdates' => ['offset', 'limit', 'timeout', 'allowed_updates', 'token', 'forgot', 'answer'], |
|
| 484 | + 'setWebhook' => ['url', 'certificate', 'ip_address', 'max_connections', 'allowed_updates', 'drop_pending_updates', 'secret_token', 'token', 'forgot', 'answer'], |
|
| 485 | + 'deleteWebhook' => ['drop_pending_updates', 'token', 'forgot', 'answer'], |
|
| 486 | + 'getWebhookInfo' => ['token', 'forgot', 'answer'], |
|
| 487 | + 'getMe' => ['token', 'forgot', 'answer'], |
|
| 488 | + 'logOut' => ['token', 'forgot', 'answer'], |
|
| 489 | + 'close' => ['token', 'forgot', 'answer'], |
|
| 490 | + 'sendMessage' => ['text', 'chat_id', 'parse_mode', 'entities', 'disable_web_page_preview', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
| 491 | + 'forwardMessage' => ['chat_id', 'from_chat_id', 'disable_notification', 'protect_content', 'message_id', 'token', 'forgot', 'answer'], |
|
| 492 | + 'copyMessage' => ['chat_id', 'from_chat_id', 'message_id', 'caption', 'parse_mode', 'caption_entities', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
| 493 | + 'sendPhoto' => ['photo', 'chat_id', 'caption', 'parse_mode', 'caption_entities', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
| 494 | + 'sendAudio' => ['audio', 'chat_id', 'caption', 'parse_mode', 'caption_entities', 'duration', 'performer', 'title', 'thumb', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
| 495 | + 'sendDocument' => ['document', 'chat_id', 'thumb', 'caption', 'parse_mode', 'caption_entities', 'disable_content_type_detection', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
| 496 | + 'sendVideo' => ['video', 'chat_id', 'duration', 'width', 'height', 'thumb', 'caption', 'parse_mode', 'caption_entities', 'supports_streaming', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
| 497 | + 'sendAnimation' => ['animation', 'chat_id', 'duration', 'width', 'height', 'thumb', 'caption', 'parse_mode', 'caption_entities', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
| 498 | + 'sendVoice' => ['voice', 'chat_id', 'caption', 'parse_mode', 'caption_entities', 'duration', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
| 499 | + 'sendVideoNote' => ['video_note', 'chat_id', 'duration', 'length', 'thumb', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
| 500 | + 'sendMediaGroup' => ['media', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'token', 'forgot', 'answer'], |
|
| 501 | + 'sendLocation' => ['latitude', 'longitude', 'chat_id', 'horizontal_accuracy', 'live_period', 'heading', 'proximity_alert_radius', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
| 502 | + 'editMessageLiveLocation' => ['latitude', 'longitude', 'chat_id', 'message_id', 'inline_message_id', 'horizontal_accuracy', 'heading', 'proximity_alert_radius', 'reply_markup', 'token', 'forgot', 'answer'], |
|
| 503 | + 'stopMessageLiveLocation' => ['chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'forgot', 'answer'], |
|
| 504 | + 'sendVenue' => ['chat_id', 'latitude', 'longitude', 'title', 'address', 'foursquare_id', 'foursquare_type', 'google_place_id', 'google_place_type', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
| 505 | + 'sendContact' => ['phone_number', 'first_name', 'chat_id', 'last_name', 'vcard', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
| 506 | + 'sendPoll' => ['question', 'options', 'chat_id', 'is_anonymous', 'type', 'allows_multiple_answers', 'correct_option_id', 'explanation', 'explanation_parse_mode', 'explanation_entities', 'open_period', 'close_date', 'is_closed', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
| 507 | + 'sendDice' => ['chat_id', 'emoji', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
| 508 | + 'sendChatAction' => ['chat_id', 'action', 'token', 'forgot', 'answer'], |
|
| 509 | + 'getUserProfilePhotos' => ['user_id', 'offset', 'limit', 'token', 'forgot', 'answer'], |
|
| 510 | + 'getFile' => ['file_id', 'token', 'forgot', 'answer'], |
|
| 511 | + 'banChatMember' => ['chat_id', 'user_id', 'until_date', 'revoke_messages', 'token', 'forgot', 'answer'], |
|
| 512 | + 'unbanChatMember' => ['chat_id', 'user_id', 'only_if_banned', 'token', 'forgot', 'answer'], |
|
| 513 | + 'restrictChatMember' => ['permissions', 'chat_id', 'user_id', 'until_date', 'token', 'forgot', 'answer'], |
|
| 514 | + 'promoteChatMember' => ['chat_id', 'user_id', 'is_anonymous', 'can_manage_chat', 'can_post_messages', 'can_edit_messages', 'can_delete_messages', 'can_manage_video_chats', 'can_restrict_members', 'can_promote_members', 'can_change_info', 'can_invite_users', 'can_pin_messages', 'token', 'forgot', 'answer'], |
|
| 515 | + 'setChatAdministratorCustomTitle' => ['custom_title', 'chat_id', 'user_id', 'token', 'forgot', 'answer'], |
|
| 516 | + 'banChatSenderChat' => ['sender_chat_id', 'chat_id', 'token', 'forgot', 'answer'], |
|
| 517 | + 'unbanChatSenderChat' => ['sender_chat_id', 'chat_id', 'token', 'forgot', 'answer'], |
|
| 518 | + 'setChatPermissions' => ['permissions', 'chat_id', 'token', 'forgot', 'answer'], |
|
| 519 | + 'exportChatInviteLink' => ['chat_id', 'token', 'forgot', 'answer'], |
|
| 520 | + 'createChatInviteLink' => ['chat_id', 'name', 'expire_date', 'member_limit', 'creates_join_request', 'token', 'forgot', 'answer'], |
|
| 521 | + 'editChatInviteLink' => ['invite_link', 'chat_id', 'name', 'expire_date', 'member_limit', 'creates_join_request', 'token', 'forgot', 'answer'], |
|
| 522 | + 'revokeChatInviteLink' => ['invite_link', 'chat_id', 'token', 'forgot', 'answer'], |
|
| 523 | + 'approveChatJoinRequest' => ['chat_id', 'user_id', 'token', 'forgot', 'answer'], |
|
| 524 | + 'declineChatJoinRequest' => ['chat_id', 'user_id', 'token', 'forgot', 'answer'], |
|
| 525 | + 'setChatPhoto' => ['photo', 'chat_id', 'token', 'forgot', 'answer'], |
|
| 526 | + 'deleteChatPhoto' => ['chat_id', 'token', 'forgot', 'answer'], |
|
| 527 | + 'setChatTitle' => ['title', 'chat_id', 'token', 'forgot', 'answer'], |
|
| 528 | + 'setChatDescription' => ['chat_id', 'description', 'token', 'forgot', 'answer'], |
|
| 529 | + 'pinChatMessage' => ['message_id', 'chat_id', 'disable_notification', 'token', 'forgot', 'answer'], |
|
| 530 | + 'unpinChatMessage' => ['chat_id', 'message_id', 'token', 'forgot', 'answer'], |
|
| 531 | + 'unpinAllChatMessages' => ['chat_id', 'token', 'forgot', 'answer'], |
|
| 532 | + 'leaveChat' => ['chat_id', 'token', 'forgot', 'answer'], |
|
| 533 | + 'getChat' => ['chat_id', 'token', 'forgot', 'answer'], |
|
| 534 | + 'getChatAdministrators' => ['chat_id', 'token', 'forgot', 'answer'], |
|
| 535 | + 'getChatMemberCount' => ['chat_id', 'token', 'forgot', 'answer'], |
|
| 536 | + 'getChatMember' => ['chat_id', 'user_id', 'token', 'forgot', 'answer'], |
|
| 537 | + 'setChatStickerSet' => ['sticker_set_name', 'chat_id', 'token', 'forgot', 'answer'], |
|
| 538 | + 'deleteChatStickerSet' => ['chat_id', 'token', 'forgot', 'answer'], |
|
| 539 | + 'answerCallbackQuery' => ['callback_query_id', 'text', 'show_alert', 'url', 'cache_time', 'token', 'forgot', 'answer'], |
|
| 540 | + 'setMyCommands' => ['commands', 'scope', 'language_code', 'token', 'forgot', 'answer'], |
|
| 541 | + 'deleteMyCommands' => ['scope', 'language_code', 'token', 'forgot', 'answer'], |
|
| 542 | + 'getMyCommands' => ['scope', 'language_code', 'token', 'forgot', 'answer'], |
|
| 543 | + 'setChatMenuButton' => ['chat_id', 'menu_button', 'token', 'forgot', 'answer'], |
|
| 544 | + 'getChatMenuButton' => ['chat_id', 'token', 'forgot', 'answer'], |
|
| 545 | + 'setMyDefaultAdministratorRights' => ['rights', 'for_channels', 'token', 'forgot', 'answer'], |
|
| 546 | + 'getMyDefaultAdministratorRights' => ['for_channels', 'token', 'forgot', 'answer'], |
|
| 547 | + 'editMessageText' => ['text', 'chat_id', 'message_id', 'inline_message_id', 'parse_mode', 'entities', 'disable_web_page_preview', 'reply_markup', 'token', 'forgot', 'answer'], |
|
| 548 | + 'editMessageCaption' => ['chat_id', 'message_id', 'inline_message_id', 'caption', 'parse_mode', 'caption_entities', 'reply_markup', 'token', 'forgot', 'answer'], |
|
| 549 | + 'editMessageMedia' => ['media', 'chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'forgot', 'answer'], |
|
| 550 | + 'editMessageReplyMarkup' => ['chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'forgot', 'answer'], |
|
| 551 | + 'stopPoll' => ['chat_id', 'message_id', 'reply_markup', 'token', 'forgot', 'answer'], |
|
| 552 | + 'deleteMessage' => ['chat_id', 'message_id', 'token', 'forgot', 'answer'], |
|
| 553 | + 'sendSticker' => ['sticker', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
| 554 | + 'getStickerSet' => ['name', 'token', 'forgot', 'answer'], |
|
| 555 | 555 | 'getCustomEmojiStickers' => ['custom_emoji_ids', 'token', 'return_array', 'forgot', 'answer'], |
| 556 | - 'uploadStickerFile' => ['png_sticker','user_id','token','forgot','answer'], |
|
| 557 | - 'createNewStickerSet' => ['name','title','emojis','user_id','png_sticker','tgs_sticker','webm_sticker','sticker_type','contains_masks','mask_position','token','forgot','answer'], |
|
| 558 | - 'addStickerToSet' => ['name','emojis','user_id','png_sticker','tgs_sticker','webm_sticker','mask_position','token','forgot','answer'], |
|
| 559 | - 'setStickerPositionInSet' => ['sticker','position','token','forgot','answer'], |
|
| 560 | - 'deleteStickerFromSet' => ['sticker','token','forgot','answer'], |
|
| 561 | - 'setStickerSetThumb' => ['name','user_id','thumb','token','forgot','answer'], |
|
| 562 | - 'answerInlineQuery' => ['results','inline_query_id','cache_time','is_personal','next_offset','switch_pm_text','switch_pm_parameter','token','forgot','answer'], |
|
| 563 | - 'answerWebAppQuery' => ['web_app_query_id','result','token','forgot','answer'], |
|
| 564 | - 'sendInvoice' => ['title','description','payload','provider_token','currency','prices','chat_id','max_tip_amount','suggested_tip_amounts','start_parameter','provider_data','photo_url','photo_size','photo_width','photo_height','need_name','need_phone_number','need_email','need_shipping_address','send_phone_number_to_provider','send_email_to_provider','is_flexible','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
| 565 | - 'createInvoiceLink' => ['title','description','payload','provider_token','currency','prices','max_tip_amount','suggested_tip_amounts','provider_data','photo_url','photo_size','photo_width','photo_height','need_name','need_phone_number','need_email','need_shipping_address','send_phone_number_to_provider','send_email_to_provider','is_flexible','token','forgot','answer'], |
|
| 566 | - 'answerShippingQuery' => ['ok','shipping_query_id','shipping_options','error_message','token','forgot','answer'], |
|
| 567 | - 'answerPreCheckoutQuery' => ['ok','pre_checkout_query_id','error_message','token','forgot','answer'], |
|
| 568 | - 'setPassportDataErrors' => ['errors','user_id','token','forgot','answer'], |
|
| 569 | - 'sendGame' => ['game_short_name','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer'], |
|
| 570 | - 'setGameScore' => ['score','user_id','force','disable_edit_message','chat_id','message_id','inline_message_id','token','forgot','answer'], |
|
| 571 | - 'getGameHighScores' => ['user_id','chat_id','message_id','inline_message_id','token','forgot','answer'], |
|
| 556 | + 'uploadStickerFile' => ['png_sticker', 'user_id', 'token', 'forgot', 'answer'], |
|
| 557 | + 'createNewStickerSet' => ['name', 'title', 'emojis', 'user_id', 'png_sticker', 'tgs_sticker', 'webm_sticker', 'sticker_type', 'contains_masks', 'mask_position', 'token', 'forgot', 'answer'], |
|
| 558 | + 'addStickerToSet' => ['name', 'emojis', 'user_id', 'png_sticker', 'tgs_sticker', 'webm_sticker', 'mask_position', 'token', 'forgot', 'answer'], |
|
| 559 | + 'setStickerPositionInSet' => ['sticker', 'position', 'token', 'forgot', 'answer'], |
|
| 560 | + 'deleteStickerFromSet' => ['sticker', 'token', 'forgot', 'answer'], |
|
| 561 | + 'setStickerSetThumb' => ['name', 'user_id', 'thumb', 'token', 'forgot', 'answer'], |
|
| 562 | + 'answerInlineQuery' => ['results', 'inline_query_id', 'cache_time', 'is_personal', 'next_offset', 'switch_pm_text', 'switch_pm_parameter', 'token', 'forgot', 'answer'], |
|
| 563 | + 'answerWebAppQuery' => ['web_app_query_id', 'result', 'token', 'forgot', 'answer'], |
|
| 564 | + 'sendInvoice' => ['title', 'description', 'payload', 'provider_token', 'currency', 'prices', 'chat_id', 'max_tip_amount', 'suggested_tip_amounts', 'start_parameter', 'provider_data', 'photo_url', 'photo_size', 'photo_width', 'photo_height', 'need_name', 'need_phone_number', 'need_email', 'need_shipping_address', 'send_phone_number_to_provider', 'send_email_to_provider', 'is_flexible', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
| 565 | + 'createInvoiceLink' => ['title', 'description', 'payload', 'provider_token', 'currency', 'prices', 'max_tip_amount', 'suggested_tip_amounts', 'provider_data', 'photo_url', 'photo_size', 'photo_width', 'photo_height', 'need_name', 'need_phone_number', 'need_email', 'need_shipping_address', 'send_phone_number_to_provider', 'send_email_to_provider', 'is_flexible', 'token', 'forgot', 'answer'], |
|
| 566 | + 'answerShippingQuery' => ['ok', 'shipping_query_id', 'shipping_options', 'error_message', 'token', 'forgot', 'answer'], |
|
| 567 | + 'answerPreCheckoutQuery' => ['ok', 'pre_checkout_query_id', 'error_message', 'token', 'forgot', 'answer'], |
|
| 568 | + 'setPassportDataErrors' => ['errors', 'user_id', 'token', 'forgot', 'answer'], |
|
| 569 | + 'sendGame' => ['game_short_name', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer'], |
|
| 570 | + 'setGameScore' => ['score', 'user_id', 'force', 'disable_edit_message', 'chat_id', 'message_id', 'inline_message_id', 'token', 'forgot', 'answer'], |
|
| 571 | + 'getGameHighScores' => ['user_id', 'chat_id', 'message_id', 'inline_message_id', 'token', 'forgot', 'answer'], |
|
| 572 | 572 | 'getForumTopicIconStickers' => ['token', 'return_array', 'forgot', 'answer'], |
| 573 | 573 | 'createForumTopic' => ['chat_id', 'name', 'icon_color', 'icon_custom_emoji_id', 'token', 'return_array', 'forgot', 'answer'], |
| 574 | 574 | 'editForumTopic' => ['chat_id', 'message_thread_id', 'name', 'icon_custom_emoji_id', 'token', 'return_array', 'forgot', 'answer'], |
@@ -604,8 +604,8 @@ discard block |
||
| 604 | 604 | 'logOut' => [], |
| 605 | 605 | 'close' => [], |
| 606 | 606 | 'sendMessage' => ['chat_id'], |
| 607 | - 'forwardMessage' => ['from_chat_id','message_id'], |
|
| 608 | - 'copyMessage' => ['from_chat_id','message_id'], |
|
| 607 | + 'forwardMessage' => ['from_chat_id', 'message_id'], |
|
| 608 | + 'copyMessage' => ['from_chat_id', 'message_id'], |
|
| 609 | 609 | 'sendPhoto' => ['chat_id'], |
| 610 | 610 | 'sendAudio' => ['chat_id'], |
| 611 | 611 | 'sendDocument' => ['chat_id'], |
@@ -621,15 +621,15 @@ discard block |
||
| 621 | 621 | 'sendContact' => ['chat_id'], |
| 622 | 622 | 'sendPoll' => ['chat_id'], |
| 623 | 623 | 'sendDice' => ['chat_id'], |
| 624 | - 'sendChatAction' => ['chat_id','action'], |
|
| 624 | + 'sendChatAction' => ['chat_id', 'action'], |
|
| 625 | 625 | 'getUserProfilePhotos' => ['user_id'], |
| 626 | 626 | 'getFile' => ['file_id'], |
| 627 | - 'banChatMember' => ['chat_id','user_id'], |
|
| 628 | - 'kickChatMember' => ['chat_id','user_id'], |
|
| 629 | - 'unbanChatMember' => ['chat_id','user_id'], |
|
| 630 | - 'restrictChatMember' => ['chat_id','user_id'], |
|
| 631 | - 'promoteChatMember' => ['chat_id','user_id'], |
|
| 632 | - 'setChatAdministratorCustomTitle' => ['chat_id','user_id'], |
|
| 627 | + 'banChatMember' => ['chat_id', 'user_id'], |
|
| 628 | + 'kickChatMember' => ['chat_id', 'user_id'], |
|
| 629 | + 'unbanChatMember' => ['chat_id', 'user_id'], |
|
| 630 | + 'restrictChatMember' => ['chat_id', 'user_id'], |
|
| 631 | + 'promoteChatMember' => ['chat_id', 'user_id'], |
|
| 632 | + 'setChatAdministratorCustomTitle' => ['chat_id', 'user_id'], |
|
| 633 | 633 | 'banChatSenderChat' => ['chat_id'], |
| 634 | 634 | 'unbanChatSenderChat' => ['chat_id'], |
| 635 | 635 | 'setChatPermissions' => ['chat_id'], |
@@ -637,8 +637,8 @@ discard block |
||
| 637 | 637 | 'createChatInviteLink' => ['chat_id'], |
| 638 | 638 | 'editChatInviteLink' => ['chat_id'], |
| 639 | 639 | 'revokeChatInviteLink' => ['chat_id'], |
| 640 | - 'approveChatJoinRequest' => ['chat_id','user_id'], |
|
| 641 | - 'declineChatJoinRequest' => ['chat_id','user_id'], |
|
| 640 | + 'approveChatJoinRequest' => ['chat_id', 'user_id'], |
|
| 641 | + 'declineChatJoinRequest' => ['chat_id', 'user_id'], |
|
| 642 | 642 | 'setChatPhoto' => ['chat_id'], |
| 643 | 643 | 'deleteChatPhoto' => ['chat_id'], |
| 644 | 644 | 'setChatTitle' => ['chat_id'], |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | 'getChat' => ['chat_id'], |
| 651 | 651 | 'getChatAdministrators' => ['chat_id'], |
| 652 | 652 | 'getChatMembersCount' => ['chat_id'], |
| 653 | - 'getChatMember' => ['chat_id','user_id'], |
|
| 653 | + 'getChatMember' => ['chat_id', 'user_id'], |
|
| 654 | 654 | 'setChatStickerSet' => ['chat_id'], |
| 655 | 655 | 'deleteChatStickerSet' => ['chat_id'], |
| 656 | 656 | 'answerCallbackQuery' => ['callback_query_id'], |
@@ -661,12 +661,12 @@ discard block |
||
| 661 | 661 | 'getChatMenuButton' => [], |
| 662 | 662 | 'setMyDefaultAdministratorRights' => [], |
| 663 | 663 | 'getMyDefaultAdministratorRights' => [], |
| 664 | - 'editMessageText' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
| 665 | - 'editMessageCaption' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
| 666 | - 'editMessageMedia' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
| 667 | - 'editMessageReplyMarkup' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
| 668 | - 'stopPoll' => ['chat_id','message_id'], |
|
| 669 | - 'deleteMessage' => ['chat_id','message_id'], |
|
| 664 | + 'editMessageText' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
| 665 | + 'editMessageCaption' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
| 666 | + 'editMessageMedia' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
| 667 | + 'editMessageReplyMarkup' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
| 668 | + 'stopPoll' => ['chat_id', 'message_id'], |
|
| 669 | + 'deleteMessage' => ['chat_id', 'message_id'], |
|
| 670 | 670 | 'sendSticker' => ['chat_id'], |
| 671 | 671 | 'getStickerSet' => [], |
| 672 | 672 | 'uploadStickerFile' => ['user_id'], |
@@ -682,8 +682,8 @@ discard block |
||
| 682 | 682 | 'answerPreCheckoutQuery' => ['pre_checkout_query_id'], |
| 683 | 683 | 'setPassportDataErrors' => ['user_id'], |
| 684 | 684 | 'sendGame' => ['chat_id'], |
| 685 | - 'setGameScore' => ['user_id','inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
| 686 | - 'getGameHighScores' => ['user_id','inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']] |
|
| 685 | + 'setGameScore' => ['user_id', 'inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
| 686 | + 'getGameHighScores' => ['user_id', 'inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']] |
|
| 687 | 687 | ]; |
| 688 | 688 | |
| 689 | 689 | private const METHODS_RETURN = [ |
@@ -737,24 +737,24 @@ discard block |
||
| 737 | 737 | 'getGameHighScores' => ['BPT\types\gameHighScore'] |
| 738 | 738 | ]; |
| 739 | 739 | |
| 740 | - public static function __callStatic (string $name, array $arguments) { |
|
| 740 | + public static function __callStatic(string $name, array $arguments) { |
|
| 741 | 741 | if (!$action = self::methodAction($name)) { |
| 742 | - logger::write("$name method is not supported",loggerTypes::ERROR); |
|
| 742 | + logger::write("$name method is not supported", loggerTypes::ERROR); |
|
| 743 | 743 | throw new bptException('METHOD_NOT_FOUND'); |
| 744 | 744 | } |
| 745 | 745 | self::checkArguments($arguments); |
| 746 | - self::keysName($action,$arguments); |
|
| 747 | - self::readyFile($action,$arguments); |
|
| 748 | - self::setDefaults($action,$arguments); |
|
| 746 | + self::keysName($action, $arguments); |
|
| 747 | + self::readyFile($action, $arguments); |
|
| 748 | + self::setDefaults($action, $arguments); |
|
| 749 | 749 | if (isset($arguments['answer'])) { |
| 750 | - return answer::init($action,$arguments); |
|
| 750 | + return answer::init($action, $arguments); |
|
| 751 | 751 | } |
| 752 | 752 | else { |
| 753 | - $result = curl::init($action,$arguments); |
|
| 753 | + $result = curl::init($action, $arguments); |
|
| 754 | 754 | if (!is_object($result)) { |
| 755 | 755 | return false; |
| 756 | 756 | } |
| 757 | - return self::processResponse($action,$result); |
|
| 757 | + return self::processResponse($action, $result); |
|
| 758 | 758 | } |
| 759 | 759 | } |
| 760 | 760 | |
@@ -764,7 +764,7 @@ discard block |
||
| 764 | 764 | } |
| 765 | 765 | } |
| 766 | 766 | |
| 767 | - private static function keysName (string $name, array &$arguments): void { |
|
| 767 | + private static function keysName(string $name, array &$arguments): void { |
|
| 768 | 768 | foreach ($arguments as $key => $argument) { |
| 769 | 769 | if (is_numeric($key) && isset(self::METHODS_KEYS[$name][$key])) { |
| 770 | 770 | $arguments[self::METHODS_KEYS[$name][$key]] = $argument; |
@@ -773,7 +773,7 @@ discard block |
||
| 773 | 773 | } |
| 774 | 774 | } |
| 775 | 775 | |
| 776 | - private static function methodAction(string $name): string|false { |
|
| 776 | + private static function methodAction(string $name): string | false { |
|
| 777 | 777 | return self::METHODS_ACTION[str_replace('_', '', strtolower($name))] ?? false; |
| 778 | 778 | } |
| 779 | 779 | |
@@ -794,11 +794,11 @@ discard block |
||
| 794 | 794 | } |
| 795 | 795 | } |
| 796 | 796 | |
| 797 | - private static function methodFile(string $name): array|false { |
|
| 797 | + private static function methodFile(string $name): array | false { |
|
| 798 | 798 | return self::METHODS_WITH_FILE[$name] ?? false; |
| 799 | 799 | } |
| 800 | 800 | |
| 801 | - private static function methodReturn(string $name,stdClass $response) { |
|
| 801 | + private static function methodReturn(string $name, stdClass $response) { |
|
| 802 | 802 | if (isset(self::METHODS_RETURN[$name])) { |
| 803 | 803 | $return = self::METHODS_RETURN[$name]; |
| 804 | 804 | if (is_array($return)) { |
@@ -821,13 +821,13 @@ discard block |
||
| 821 | 821 | $defaults = self::METHODS_EXTRA_DEFAULTS[$name]; |
| 822 | 822 | foreach ($defaults as $key => $default) { |
| 823 | 823 | if (is_numeric($key)) { |
| 824 | - if (!isset($arguments[$default])){ |
|
| 824 | + if (!isset($arguments[$default])) { |
|
| 825 | 825 | $arguments[$default] = self::catchFields($default); |
| 826 | 826 | } |
| 827 | 827 | } |
| 828 | 828 | elseif (isset(BPT::$update->$key) || $key === 'other') { |
| 829 | 829 | foreach ($default as $def) { |
| 830 | - if (!isset($arguments[$def])){ |
|
| 830 | + if (!isset($arguments[$def])) { |
|
| 831 | 831 | $arguments[$def] = self::catchFields($def); |
| 832 | 832 | } |
| 833 | 833 | } |
@@ -840,7 +840,7 @@ discard block |
||
| 840 | 840 | if ($response->ok) { |
| 841 | 841 | self::$status = true; |
| 842 | 842 | self::$pure_response = $response; |
| 843 | - return self::methodReturn($name,$response); |
|
| 843 | + return self::methodReturn($name, $response); |
|
| 844 | 844 | } |
| 845 | 845 | else { |
| 846 | 846 | self::$status = false; |
@@ -856,7 +856,7 @@ discard block |
||
| 856 | 856 | * |
| 857 | 857 | * @return int|string|bool |
| 858 | 858 | */ |
| 859 | - public static function catchFields (string $field): int|string|bool { |
|
| 859 | + public static function catchFields(string $field): int | string | bool { |
|
| 860 | 860 | switch ($field) { |
| 861 | 861 | case fields::CHAT_ID : |
| 862 | 862 | case fields::FROM_CHAT_ID : |
@@ -992,7 +992,7 @@ discard block |
||
| 992 | 992 | default => false |
| 993 | 993 | }; |
| 994 | 994 | case fields::URL : |
| 995 | - return 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; |
|
| 995 | + return 'https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; |
|
| 996 | 996 | default: |
| 997 | 997 | return false; |
| 998 | 998 | } |
@@ -748,8 +748,7 @@ discard block |
||
| 748 | 748 | self::setDefaults($action,$arguments); |
| 749 | 749 | if (isset($arguments['answer'])) { |
| 750 | 750 | return answer::init($action,$arguments); |
| 751 | - } |
|
| 752 | - else { |
|
| 751 | + } else { |
|
| 753 | 752 | $result = curl::init($action,$arguments); |
| 754 | 753 | if (!is_object($result)) { |
| 755 | 754 | return false; |
@@ -784,8 +783,7 @@ discard block |
||
| 784 | 783 | $arguments['media'][$key]['media'] = new CURLFile($media['media']); |
| 785 | 784 | } |
| 786 | 785 | } |
| 787 | - } |
|
| 788 | - elseif ($file_params = self::methodFile($name)) { |
|
| 786 | + } elseif ($file_params = self::methodFile($name)) { |
|
| 789 | 787 | foreach ($file_params as $param) { |
| 790 | 788 | if (isset($arguments[$param]) && is_string($arguments[$param]) && file_exists(realpath($arguments[$param]))) { |
| 791 | 789 | $arguments[$param] = new CURLFile($arguments[$param]); |
@@ -807,12 +805,10 @@ discard block |
||
| 807 | 805 | $value = new ($return[0]) ($value); |
| 808 | 806 | } |
| 809 | 807 | return $response; |
| 810 | - } |
|
| 811 | - else { |
|
| 808 | + } else { |
|
| 812 | 809 | return new ($return) ($response->result); |
| 813 | 810 | } |
| 814 | - } |
|
| 815 | - else { |
|
| 811 | + } else { |
|
| 816 | 812 | return $response->result; |
| 817 | 813 | } |
| 818 | 814 | } |
@@ -824,8 +820,7 @@ discard block |
||
| 824 | 820 | if (!isset($arguments[$default])){ |
| 825 | 821 | $arguments[$default] = self::catchFields($default); |
| 826 | 822 | } |
| 827 | - } |
|
| 828 | - elseif (isset(BPT::$update->$key) || $key === 'other') { |
|
| 823 | + } elseif (isset(BPT::$update->$key) || $key === 'other') { |
|
| 829 | 824 | foreach ($default as $def) { |
| 830 | 825 | if (!isset($arguments[$def])){ |
| 831 | 826 | $arguments[$def] = self::catchFields($def); |
@@ -841,8 +836,7 @@ discard block |
||
| 841 | 836 | self::$status = true; |
| 842 | 837 | self::$pure_response = $response; |
| 843 | 838 | return self::methodReturn($name,$response); |
| 844 | - } |
|
| 845 | - else { |
|
| 839 | + } else { |
|
| 846 | 840 | self::$status = false; |
| 847 | 841 | self::$pure_response = $response; |
| 848 | 842 | return new responseError($response); |
@@ -885,9 +879,13 @@ discard block |
||
| 885 | 879 | default => false |
| 886 | 880 | }; |
| 887 | 881 | case fields::FILE_ID : |
| 888 | - if (isset(BPT::$update->message)) $type = 'message'; |
|
| 889 | - elseif (isset(BPT::$update->edited_message)) $type = 'edited_message'; |
|
| 890 | - else return false; |
|
| 882 | + if (isset(BPT::$update->message)) { |
|
| 883 | + $type = 'message'; |
|
| 884 | + } elseif (isset(BPT::$update->edited_message)) { |
|
| 885 | + $type = 'edited_message'; |
|
| 886 | + } else { |
|
| 887 | + return false; |
|
| 888 | + } |
|
| 891 | 889 | |
| 892 | 890 | return match(true) { |
| 893 | 891 | isset(BPT::$update->$type->animation) => BPT::$update->$type->animation->file_id, |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * telegram class , Adding normal method call to request class and a simple name for being easy to call |
| 17 | 17 | */ |
| 18 | 18 | class telegram extends request { |
| 19 | - public function __call (string $name, array $arguments) { |
|
| 19 | + public function __call(string $name, array $arguments) { |
|
| 20 | 20 | return request::$name(...$arguments); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -34,12 +34,12 @@ discard block |
||
| 34 | 34 | * |
| 35 | 35 | * @return bool |
| 36 | 36 | */ |
| 37 | - public static function downloadFile (string|null $destination = null, string|null $file_id = null): bool { |
|
| 37 | + public static function downloadFile(string | null $destination = null, string | null $file_id = null): bool { |
|
| 38 | 38 | $file = telegram::getFile($file_id); |
| 39 | 39 | if (!isset($file->file_path)) { |
| 40 | 40 | return false; |
| 41 | 41 | } |
| 42 | - $file_path = settings::$down_url . 'bot' . settings::$token . '/' . $file->file_path; |
|
| 42 | + $file_path = settings::$down_url.'bot'.settings::$token.'/'.$file->file_path; |
|
| 43 | 43 | return tools::downloadFile($file_path, $destination); |
| 44 | 44 | } |
| 45 | 45 | |
@@ -57,31 +57,31 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @return message|bool|responseError |
| 59 | 59 | */ |
| 60 | - public static function sendFile (string $file_id, int|string $chat_id = null, int $message_thread_id = null, string $caption = null, string $parse_mode = null, array $caption_entities = null, bool $disable_notification = null, bool $protect_content = null, int $reply_to_message_id = null, bool $allow_sending_without_reply = null, inlineKeyboardMarkup|replyKeyboardMarkup|replyKeyboardRemove|forceReply|stdClass|array $reply_markup = null, string $token = null, bool $forgot = null, bool $answer = null): message|bool|responseError { |
|
| 60 | + public static function sendFile(string $file_id, int | string $chat_id = null, int $message_thread_id = null, string $caption = null, string $parse_mode = null, array $caption_entities = null, bool $disable_notification = null, bool $protect_content = null, int $reply_to_message_id = null, bool $allow_sending_without_reply = null, inlineKeyboardMarkup | replyKeyboardMarkup | replyKeyboardRemove | forceReply | stdClass | array $reply_markup = null, string $token = null, bool $forgot = null, bool $answer = null): message | bool | responseError { |
|
| 61 | 61 | $type = tools::fileType($file_id); |
| 62 | 62 | if ($type === fileTypes::VIDEO) { |
| 63 | - return self::sendVideo($file_id,$chat_id,$message_thread_id,null,null,null,null,$caption,$parse_mode,$caption_entities,null,$disable_notification,$protect_content,$reply_to_message_id,$allow_sending_without_reply,$reply_markup,$token,$forgot,$answer); |
|
| 63 | + return self::sendVideo($file_id, $chat_id, $message_thread_id, null, null, null, null, $caption, $parse_mode, $caption_entities, null, $disable_notification, $protect_content, $reply_to_message_id, $allow_sending_without_reply, $reply_markup, $token, $forgot, $answer); |
|
| 64 | 64 | } |
| 65 | 65 | elseif ($type === fileTypes::VIDEO_NOTE) { |
| 66 | - return self::sendVideoNote($file_id,$chat_id,$message_thread_id,null,null,null,$disable_notification,$protect_content,$reply_to_message_id,$allow_sending_without_reply,$reply_markup,$token,$forgot,$answer); |
|
| 66 | + return self::sendVideoNote($file_id, $chat_id, $message_thread_id, null, null, null, $disable_notification, $protect_content, $reply_to_message_id, $allow_sending_without_reply, $reply_markup, $token, $forgot, $answer); |
|
| 67 | 67 | } |
| 68 | 68 | elseif ($type === fileTypes::ANIMATION) { |
| 69 | - return self::sendAnimation($file_id,$chat_id,$message_thread_id,null,null,null,null,$caption,$parse_mode,$caption_entities,$disable_notification,$protect_content,$reply_to_message_id,$allow_sending_without_reply,$reply_markup,$token,$forgot,$answer); |
|
| 69 | + return self::sendAnimation($file_id, $chat_id, $message_thread_id, null, null, null, null, $caption, $parse_mode, $caption_entities, $disable_notification, $protect_content, $reply_to_message_id, $allow_sending_without_reply, $reply_markup, $token, $forgot, $answer); |
|
| 70 | 70 | } |
| 71 | 71 | elseif ($type === fileTypes::AUDIO) { |
| 72 | - return self::sendAudio($file_id,$chat_id,$message_thread_id,$caption,$parse_mode,$caption_entities,null,null,null,null,$disable_notification,$protect_content,$reply_to_message_id,$allow_sending_without_reply,$reply_markup,$token,$forgot,$answer); |
|
| 72 | + return self::sendAudio($file_id, $chat_id, $message_thread_id, $caption, $parse_mode, $caption_entities, null, null, null, null, $disable_notification, $protect_content, $reply_to_message_id, $allow_sending_without_reply, $reply_markup, $token, $forgot, $answer); |
|
| 73 | 73 | } |
| 74 | 74 | elseif ($type === fileTypes::PHOTO || $type === fileTypes::PROFILE_PHOTO) { |
| 75 | - return self::sendPhoto($file_id,$chat_id,$message_thread_id,$caption,$parse_mode,$caption_entities,$disable_notification,$protect_content,$reply_to_message_id,$allow_sending_without_reply,$reply_markup,$token,$forgot,$answer); |
|
| 75 | + return self::sendPhoto($file_id, $chat_id, $message_thread_id, $caption, $parse_mode, $caption_entities, $disable_notification, $protect_content, $reply_to_message_id, $allow_sending_without_reply, $reply_markup, $token, $forgot, $answer); |
|
| 76 | 76 | } |
| 77 | 77 | elseif ($type === fileTypes::VOICE) { |
| 78 | - return self::sendVoice($file_id,$chat_id,$message_thread_id,$caption,$parse_mode,$caption_entities,null,$disable_notification,$protect_content,$reply_to_message_id,$allow_sending_without_reply,$reply_markup,$token,$forgot,$answer); |
|
| 78 | + return self::sendVoice($file_id, $chat_id, $message_thread_id, $caption, $parse_mode, $caption_entities, null, $disable_notification, $protect_content, $reply_to_message_id, $allow_sending_without_reply, $reply_markup, $token, $forgot, $answer); |
|
| 79 | 79 | } |
| 80 | 80 | elseif ($type === fileTypes::STICKER) { |
| 81 | - return self::sendSticker($file_id,$chat_id,$message_thread_id,$disable_notification,$protect_content,$reply_to_message_id,$allow_sending_without_reply,$reply_markup,$token,$forgot,$answer); |
|
| 81 | + return self::sendSticker($file_id, $chat_id, $message_thread_id, $disable_notification, $protect_content, $reply_to_message_id, $allow_sending_without_reply, $reply_markup, $token, $forgot, $answer); |
|
| 82 | 82 | } |
| 83 | 83 | elseif ($type === fileTypes::DOCUMENT) { |
| 84 | - return self::sendDocument($file_id,$chat_id,$message_thread_id,null,$caption,$parse_mode,$caption_entities,null,$disable_notification,$protect_content,$reply_to_message_id,$allow_sending_without_reply,$reply_markup,$token,$forgot,$answer); |
|
| 84 | + return self::sendDocument($file_id, $chat_id, $message_thread_id, null, $caption, $parse_mode, $caption_entities, null, $disable_notification, $protect_content, $reply_to_message_id, $allow_sending_without_reply, $reply_markup, $token, $forgot, $answer); |
|
| 85 | 85 | } |
| 86 | 86 | else return false; |
| 87 | 87 | } |
@@ -61,28 +61,22 @@ |
||
| 61 | 61 | $type = tools::fileType($file_id); |
| 62 | 62 | if ($type === fileTypes::VIDEO) { |
| 63 | 63 | return self::sendVideo($file_id,$chat_id,$message_thread_id,null,null,null,null,$caption,$parse_mode,$caption_entities,null,$disable_notification,$protect_content,$reply_to_message_id,$allow_sending_without_reply,$reply_markup,$token,$forgot,$answer); |
| 64 | - } |
|
| 65 | - elseif ($type === fileTypes::VIDEO_NOTE) { |
|
| 64 | + } elseif ($type === fileTypes::VIDEO_NOTE) { |
|
| 66 | 65 | return self::sendVideoNote($file_id,$chat_id,$message_thread_id,null,null,null,$disable_notification,$protect_content,$reply_to_message_id,$allow_sending_without_reply,$reply_markup,$token,$forgot,$answer); |
| 67 | - } |
|
| 68 | - elseif ($type === fileTypes::ANIMATION) { |
|
| 66 | + } elseif ($type === fileTypes::ANIMATION) { |
|
| 69 | 67 | return self::sendAnimation($file_id,$chat_id,$message_thread_id,null,null,null,null,$caption,$parse_mode,$caption_entities,$disable_notification,$protect_content,$reply_to_message_id,$allow_sending_without_reply,$reply_markup,$token,$forgot,$answer); |
| 70 | - } |
|
| 71 | - elseif ($type === fileTypes::AUDIO) { |
|
| 68 | + } elseif ($type === fileTypes::AUDIO) { |
|
| 72 | 69 | return self::sendAudio($file_id,$chat_id,$message_thread_id,$caption,$parse_mode,$caption_entities,null,null,null,null,$disable_notification,$protect_content,$reply_to_message_id,$allow_sending_without_reply,$reply_markup,$token,$forgot,$answer); |
| 73 | - } |
|
| 74 | - elseif ($type === fileTypes::PHOTO || $type === fileTypes::PROFILE_PHOTO) { |
|
| 70 | + } elseif ($type === fileTypes::PHOTO || $type === fileTypes::PROFILE_PHOTO) { |
|
| 75 | 71 | return self::sendPhoto($file_id,$chat_id,$message_thread_id,$caption,$parse_mode,$caption_entities,$disable_notification,$protect_content,$reply_to_message_id,$allow_sending_without_reply,$reply_markup,$token,$forgot,$answer); |
| 76 | - } |
|
| 77 | - elseif ($type === fileTypes::VOICE) { |
|
| 72 | + } elseif ($type === fileTypes::VOICE) { |
|
| 78 | 73 | return self::sendVoice($file_id,$chat_id,$message_thread_id,$caption,$parse_mode,$caption_entities,null,$disable_notification,$protect_content,$reply_to_message_id,$allow_sending_without_reply,$reply_markup,$token,$forgot,$answer); |
| 79 | - } |
|
| 80 | - elseif ($type === fileTypes::STICKER) { |
|
| 74 | + } elseif ($type === fileTypes::STICKER) { |
|
| 81 | 75 | return self::sendSticker($file_id,$chat_id,$message_thread_id,$disable_notification,$protect_content,$reply_to_message_id,$allow_sending_without_reply,$reply_markup,$token,$forgot,$answer); |
| 82 | - } |
|
| 83 | - elseif ($type === fileTypes::DOCUMENT) { |
|
| 76 | + } elseif ($type === fileTypes::DOCUMENT) { |
|
| 84 | 77 | return self::sendDocument($file_id,$chat_id,$message_thread_id,null,$caption,$parse_mode,$caption_entities,null,$disable_notification,$protect_content,$reply_to_message_id,$allow_sending_without_reply,$reply_markup,$token,$forgot,$answer); |
| 78 | + } else { |
|
| 79 | + return false; |
|
| 85 | 80 | } |
| 86 | - else return false; |
|
| 87 | 81 | } |
| 88 | 82 | } |
| 89 | 83 | \ No newline at end of file |
@@ -17,14 +17,14 @@ 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 | - logger::write('not authorized access denied. IP : '. $_SERVER['REMOTE_ADDR'] ?? 'unknown',loggerTypes::WARNING); |
|
| 27 | + logger::write('not authorized access denied. IP : '.$_SERVER['REMOTE_ADDR'] ?? 'unknown', loggerTypes::WARNING); |
|
| 28 | 28 | BPT::exit(); |
| 29 | 29 | } |
| 30 | 30 | $up = end($up); |
@@ -56,12 +56,12 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | private static function create($file) { |
| 59 | - 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 &");'); |
|
| 59 | + 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 &");'); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | #[ArrayShape(['url' => "array|string|string[]", 'file' => "string"])] |
| 63 | 63 | private static function setURLS(): array { |
| 64 | - $base_url = (isset(settings::$certificate) ? 'http://' : 'https://') . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; |
|
| 64 | + $base_url = (isset(settings::$certificate) ? 'http://' : 'https://').$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; |
|
| 65 | 65 | return [ |
| 66 | 66 | 'url'=>str_replace(basename($_SERVER['REQUEST_URI']), 'receiver.php', $base_url), |
| 67 | 67 | 'file'=>basename($_SERVER['SCRIPT_NAME']) |
@@ -14,9 +14,9 @@ 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 | - logger::write('not authorized access denied. IP : '. $_SERVER['REMOTE_ADDR'] ?? 'unknown',loggerTypes::WARNING); |
|
| 19 | + logger::write('not authorized access denied. IP : '.$_SERVER['REMOTE_ADDR'] ?? 'unknown', loggerTypes::WARNING); |
|
| 20 | 20 | BPT::exit(); |
| 21 | 21 | } |
| 22 | 22 | return self::getUpdate(); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | return $_SERVER['REMOTE_ADDR'] === $_SERVER['SERVER_ADDR']; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - private static function getUpdate (): string { |
|
| 29 | + private static function getUpdate(): string { |
|
| 30 | 30 | $input = json_decode(file_get_contents("php://input"), true); |
| 31 | 31 | webhook::telegramVerify($input['ip']); |
| 32 | 32 | return $input['update']; |
@@ -39,14 +39,14 @@ discard block |
||
| 39 | 39 | $urls = self::setURLS(); |
| 40 | 40 | $file = $urls['file']; |
| 41 | 41 | $timeout = self::getTimeout($file); |
| 42 | - self::create($file,$timeout); |
|
| 42 | + self::create($file, $timeout); |
|
| 43 | 43 | self::setWebhook($urls['url']); |
| 44 | 44 | lock::set('BPT-MULTI-CURL'); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - private static function getTimeout($url): float|int { |
|
| 47 | + private static function getTimeout($url): float | int { |
|
| 48 | 48 | $times = []; |
| 49 | - for ($i = 0; $i < 10; $i ++) { |
|
| 49 | + for ($i = 0; $i < 10; $i++) { |
|
| 50 | 50 | $ch = curl_init($url); |
| 51 | 51 | 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']]); |
| 52 | 52 | $start = microtime(true); |
@@ -57,13 +57,13 @@ discard block |
||
| 57 | 57 | return $timeout > 50 ? $timeout + 10 : 50; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - private static function create($file,$timeout) { |
|
| 61 | - 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);?>'); |
|
| 60 | + private static function create($file, $timeout) { |
|
| 61 | + 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);?>'); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | #[ArrayShape(['url' => "array|string|string[]", 'file' => "array|string|string[]"])] |
| 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 | $file = basename($_SERVER['REQUEST_URI']); |
| 68 | 68 | return [ |
| 69 | 69 | 'url'=>str_replace($file, 'receiver.php', $base_url), |
@@ -16,23 +16,23 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | class getUpdates extends receiver { |
| 18 | 18 | #[NoReturn] |
| 19 | - public static function init () { |
|
| 19 | + public static function init() { |
|
| 20 | 20 | $last_update_id = self::loadData(); |
| 21 | - while(true) { |
|
| 21 | + while (true) { |
|
| 22 | 22 | if (!lock::exist('getUpdate')) { |
| 23 | - $updates = telegram::getUpdates($last_update_id,allowed_updates: settings::$allowed_updates); |
|
| 23 | + $updates = telegram::getUpdates($last_update_id, allowed_updates: settings::$allowed_updates); |
|
| 24 | 24 | if (!telegram::$status) { |
| 25 | - logger::write("There is some problem happened , telegram response : \n".json_encode($updates),loggerTypes::ERROR); |
|
| 26 | - BPT::exit(print_r($updates,true)); |
|
| 25 | + logger::write("There is some problem happened , telegram response : \n".json_encode($updates), loggerTypes::ERROR); |
|
| 26 | + BPT::exit(print_r($updates, true)); |
|
| 27 | 27 | } |
| 28 | 28 | self::handleUpdates($updates); |
| 29 | - lock::save('getUpdate',BPT::$update->update_id+1); |
|
| 30 | - $last_update_id = BPT::$update->update_id+1; |
|
| 29 | + lock::save('getUpdate', BPT::$update->update_id + 1); |
|
| 30 | + $last_update_id = BPT::$update->update_id + 1; |
|
| 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,7 @@ |
||
| 35 | 35 | private static function loadData(): bool|int|string { |
| 36 | 36 | if (lock::exist('getUpdate')) { |
| 37 | 37 | $last_update_id = lock::read('getUpdate'); |
| 38 | - } |
|
| 39 | - else { |
|
| 38 | + } else { |
|
| 40 | 39 | self::deleteOldLocks(); |
| 41 | 40 | telegram::deleteWebhook(); |
| 42 | 41 | $last_update_id = 0; |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | /** |
| 21 | 21 | * @internal Only for BPT self usage , Don't use it in your source! |
| 22 | 22 | */ |
| 23 | - public static function init () { |
|
| 23 | + public static function init() { |
|
| 24 | 24 | if (settings::$multi) { |
| 25 | 25 | multi::init(); |
| 26 | 26 | } |
@@ -49,24 +49,24 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - protected static function setWebhook(string $url,string $secret = '') { |
|
| 52 | + protected static function setWebhook(string $url, string $secret = '') { |
|
| 53 | 53 | $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); |
| 54 | 54 | if (!telegram::$status) { |
| 55 | - logger::write("There is some problem happened , telegram response : \n".json_encode($res),loggerTypes::ERROR); |
|
| 56 | - BPT::exit(print_r($res,true)); |
|
| 55 | + logger::write("There is some problem happened , telegram response : \n".json_encode($res), loggerTypes::ERROR); |
|
| 56 | + BPT::exit(print_r($res, true)); |
|
| 57 | 57 | } |
| 58 | - logger::write('Webhook was set successfully',loggerTypes::INFO); |
|
| 58 | + logger::write('Webhook was set successfully', loggerTypes::INFO); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | protected static function checkURL() { |
| 62 | 62 | if (!(isset($_SERVER['SERVER_NAME']) && isset($_SERVER['REQUEST_URI']))) { |
| 63 | - logger::write('For using webhook receiver , you should open this file in your webserver(by domain)',loggerTypes::ERROR); |
|
| 63 | + logger::write('For using webhook receiver , you should open this file in your webserver(by domain)', loggerTypes::ERROR); |
|
| 64 | 64 | throw new bptException('WEBHOOK_NEED_URL'); |
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | private static function setURL(): string { |
| 69 | - return (isset(settings::$certificate) ? 'http://' : 'https://') . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME']; |
|
| 69 | + return (isset(settings::$certificate) ? 'http://' : 'https://').$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | protected static function setCertificate() { |
@@ -89,15 +89,15 @@ discard block |
||
| 89 | 89 | self::setCertificate(); |
| 90 | 90 | $url = self::setURL(); |
| 91 | 91 | $secret = !empty(settings::$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 | } |
@@ -23,15 +23,13 @@ discard block |
||
| 23 | 23 | public static function init () { |
| 24 | 24 | if (settings::$multi) { |
| 25 | 25 | multi::init(); |
| 26 | - } |
|
| 27 | - else { |
|
| 26 | + } else { |
|
| 28 | 27 | if (lock::exist('BPT-HOOK')) { |
| 29 | 28 | receiver::telegramVerify(); |
| 30 | 29 | self::checkSecret(); |
| 31 | 30 | logger::write('Update received , lets process it ;)'); |
| 32 | 31 | receiver::processUpdate(); |
| 33 | - } |
|
| 34 | - else { |
|
| 32 | + } else { |
|
| 35 | 33 | self::processSetWebhook(); |
| 36 | 34 | } |
| 37 | 35 | } |
@@ -74,8 +72,7 @@ discard block |
||
| 74 | 72 | if (is_string(settings::$certificate)) { |
| 75 | 73 | if (file_exists(realpath(settings::$certificate))) { |
| 76 | 74 | settings::$certificate = new CURLFile(settings::$certificate); |
| 77 | - } |
|
| 78 | - else { |
|
| 75 | + } else { |
|
| 79 | 76 | settings::$certificate = null; |
| 80 | 77 | } |
| 81 | 78 | } |
@@ -257,13 +257,13 @@ discard block |
||
| 257 | 257 | * @method bool|responseError unpinAllForumTopicMessages (int|string|array $chat_id, int $message_thread_id, string|null $token = null, bool|null $forgot = null, bool|null $answer = null) Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success. |
| 258 | 258 | * @method bool|responseError unpinTopicMessages (int|string|array $chat_id, int $message_thread_id, string|null $token = null, bool|null $forgot = null, bool|null $answer = null) Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success. |
| 259 | 259 | */ |
| 260 | -class BPT extends telegram{ |
|
| 260 | +class BPT extends telegram { |
|
| 261 | 261 | public static update $update; |
| 262 | 262 | |
| 263 | 263 | public static BPT $handler; |
| 264 | 264 | |
| 265 | 265 | |
| 266 | - public function __construct (array|stdClass $settings) { |
|
| 266 | + public function __construct(array | stdClass $settings) { |
|
| 267 | 267 | static::$handler = &$this; |
| 268 | 268 | settings::init($settings); |
| 269 | 269 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | #[NoReturn] |
| 276 | - public static function exit (string|null $message = null) { |
|
| 276 | + public static function exit (string | null $message = null) { |
|
| 277 | 277 | die($message ?? "<div style='width:98vw;height:98vh;display:flex;justify-content:center;align-items:center;font-size:25vw'>BPT</div>"); |
| 278 | 278 | } |
| 279 | 279 | } |
@@ -18,10 +18,10 @@ |
||
| 18 | 18 | public int $icon_color; |
| 19 | 19 | |
| 20 | 20 | /** Optional. Unique identifier of the custom emoji shown as the topic icon */ |
| 21 | - public null|string $icon_custom_emoji_id = null; |
|
| 21 | + public null | string $icon_custom_emoji_id = null; |
|
| 22 | 22 | |
| 23 | 23 | |
| 24 | - public function __construct(stdClass|null $object = null) { |
|
| 24 | + public function __construct(stdClass | null $object = null) { |
|
| 25 | 25 | if ($object != null) { |
| 26 | 26 | parent::__construct($object, self::subs); |
| 27 | 27 | } |
@@ -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(realpath(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(realpath(settings::$name."$name.lock")); |
| 62 | 62 | } |
| 63 | 63 | |