@@ -32,7 +32,7 @@ |
||
32 | 32 | public bool $selective; |
33 | 33 | |
34 | 34 | |
35 | - public function __construct(stdClass|null $object = null) { |
|
35 | + public function __construct(stdClass | null $object = null) { |
|
36 | 36 | if ($object != null) { |
37 | 37 | parent::__construct($object, self::subs); |
38 | 38 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the |
53 | 53 | * thumbnail was uploaded using multipart/form-data under <file_attach_name>. |
54 | 54 | */ |
55 | - public CURLFile|string $thumb; |
|
55 | + public CURLFile | string $thumb; |
|
56 | 56 | |
57 | 57 | /** `video` and `animation` only. width */ |
58 | 58 | public int $width; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public bool $disable_content_type_detection; |
80 | 80 | |
81 | 81 | |
82 | - public function __construct(stdClass|null $object = null) { |
|
82 | + public function __construct(stdClass | null $object = null) { |
|
83 | 83 | if ($object != null) { |
84 | 84 | parent::__construct($object, self::subs); |
85 | 85 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | public string $custom_emoji_id; |
50 | 50 | |
51 | 51 | |
52 | - public function __construct(stdClass|null $object = null) { |
|
52 | + public function __construct(stdClass | null $object = null) { |
|
53 | 53 | if ($object != null) { |
54 | 54 | parent::__construct($object, self::subs); |
55 | 55 | } |
@@ -67,7 +67,7 @@ |
||
67 | 67 | public bool $can_manage_topics; |
68 | 68 | |
69 | 69 | |
70 | - public function __construct(stdClass|null $object = null) { |
|
70 | + public function __construct(stdClass | null $object = null) { |
|
71 | 71 | if ($object != null) { |
72 | 72 | parent::__construct($object, self::subs); |
73 | 73 | } |
@@ -67,7 +67,7 @@ |
||
67 | 67 | public bool $can_manage_topics; |
68 | 68 | |
69 | 69 | |
70 | - public function __construct(stdClass|null $object = null) { |
|
70 | + public function __construct(stdClass | null $object = null) { |
|
71 | 71 | if ($object != null) { |
72 | 72 | parent::__construct($object, self::subs); |
73 | 73 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | public static int $log_size = 10; |
27 | 27 | |
28 | - public static string|CURLFile|null $certificate = null; |
|
28 | + public static string | CURLFile | null $certificate = null; |
|
29 | 29 | |
30 | 30 | public static bool $handler = true; |
31 | 31 | |
@@ -59,12 +59,12 @@ discard block |
||
59 | 59 | |
60 | 60 | public static array $allowed_updates = ['message', 'edited_channel_post', 'callback_query', 'inline_query']; |
61 | 61 | |
62 | - public static array|null $db = ['type' => 'json']; |
|
62 | + public static array | null $db = ['type' => 'json']; |
|
63 | 63 | |
64 | 64 | /** |
65 | 65 | * @internal Only for BPT self usage , Don't use it in your source! |
66 | 66 | */ |
67 | - public static function init (array|stdClass $settings): void { |
|
67 | + public static function init(array | stdClass $settings): void { |
|
68 | 68 | $settings = (array) $settings; |
69 | 69 | foreach ($settings as $setting => $value) { |
70 | 70 | try { |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | if (!is_dir('bots_files')) { |
73 | 73 | mkdir('bots_files'); |
74 | 74 | } |
75 | - if (!is_dir('bots_files/' . $value)) { |
|
76 | - mkdir('bots_files/' . $value); |
|
75 | + if (!is_dir('bots_files/'.$value)) { |
|
76 | + mkdir('bots_files/'.$value); |
|
77 | 77 | } |
78 | - $value = 'bots_files/' . $value . '/'; |
|
78 | + $value = 'bots_files/'.$value.'/'; |
|
79 | 79 | } |
80 | 80 | self::$$setting = $value; |
81 | 81 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | /** |
109 | 109 | * @internal Only for BPT self usage , Don't use it in your source! |
110 | 110 | */ |
111 | - public static function done (): void { |
|
111 | + public static function done(): void { |
|
112 | 112 | if (self::$logger) { |
113 | 113 | $estimated = round((microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']) * 1000, 2); |
114 | 114 | $status_message = match (true) { |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
126 | - private static function security (): void { |
|
126 | + private static function security(): void { |
|
127 | 127 | if (self::$security) { |
128 | 128 | ini_set('magic_quotes_gpc', 'off'); |
129 | 129 | ini_set('sql.safe_mode', 'on'); |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | - private static function secureFolder (): void { |
|
141 | + private static function secureFolder(): void { |
|
142 | 142 | if (self::$secure_folder) { |
143 | 143 | $address = explode('/', $_SERVER['REQUEST_URI']); |
144 | 144 | unset($address[count($address) - 1]); |
145 | - $address = implode('/', $address) . '/BPT.php'; |
|
145 | + $address = implode('/', $address).'/BPT.php'; |
|
146 | 146 | $text = "ErrorDocument 404 $address\nErrorDocument 403 $address\n Options -Indexes\n Order Deny,Allow\nDeny from all\nAllow from 127.0.0.1\n<Files *.php>\n Order Allow,Deny\n Allow from all\n</Files>"; |
147 | 147 | if (!file_exists('.htaccess') || filesize('.htaccess') != strlen($text)) { |
148 | 148 | file_put_contents('.htaccess', $text); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
153 | - private static function getUpdates (): void { |
|
153 | + private static function getUpdates(): void { |
|
154 | 154 | if (!self::$handler) { |
155 | 155 | logger::write('You can\'t use getUpdates receiver when handler is off , use webhook or use handler', loggerTypes::ERROR); |
156 | 156 | throw new bptException('GETUPDATE_NEED_HANDLER'); |
@@ -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 | } |
@@ -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 | } |
@@ -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']) |