@@ -25,50 +25,50 @@ |
||
| 25 | 25 | * Optional. Message with the callback button that originated the query. Note that message content and message |
| 26 | 26 | * date will not be available if the message is too old |
| 27 | 27 | */ |
| 28 | - public null|message $message = null; |
|
| 28 | + public null | message $message = null; |
|
| 29 | 29 | |
| 30 | 30 | /** Optional. Identifier of the message sent via the bot in inline mode, that originated the query. */ |
| 31 | - public null|string $inline_message_id = null; |
|
| 31 | + public null | string $inline_message_id = null; |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. |
| 35 | 35 | * Useful for high scores in games. |
| 36 | 36 | */ |
| 37 | - public null|string $chat_instance = null; |
|
| 37 | + public null | string $chat_instance = null; |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * Optional. Data associated with the callback button. Be aware that the message originated the query can contain |
| 41 | 41 | * no callback buttons with this data. |
| 42 | 42 | */ |
| 43 | - public null|string $data = null; |
|
| 43 | + public null | string $data = null; |
|
| 44 | 44 | |
| 45 | 45 | /** Optional. Short name of a Game to be returned, serves as the unique identifier for the game */ |
| 46 | - public null|string $game_short_name = null; |
|
| 46 | + public null | string $game_short_name = null; |
|
| 47 | 47 | |
| 48 | 48 | |
| 49 | - public function __construct(stdClass|null $object = null) { |
|
| 49 | + public function __construct(stdClass | null $object = null) { |
|
| 50 | 50 | if ($object != null) { |
| 51 | 51 | parent::__construct($object, self::subs); |
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function answer (string|null $text = null, bool|null $show_alert = null, string|null $url = null, int|null $cache_time = null): responseError|bool { |
|
| 55 | + public function answer(string | null $text = null, bool | null $show_alert = null, string | null $url = null, int | null $cache_time = null): responseError | bool { |
|
| 56 | 56 | return telegram::answerCallbackQuery($this->id, $text, $show_alert, $url, $cache_time); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - public function editText (string $text): message|responseError|bool { |
|
| 59 | + public function editText(string $text): message | responseError | bool { |
|
| 60 | 60 | return telegram::editMessageText($text); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - public function editCaption (string $text = ''): message|responseError|bool { |
|
| 63 | + public function editCaption(string $text = ''): message | responseError | bool { |
|
| 64 | 64 | return telegram::editMessageCaption(caption: $text); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - public function editKeyboard (inlineKeyboardMarkup|stdClass|array $reply_markup = null): message|responseError|bool { |
|
| 67 | + public function editKeyboard(inlineKeyboardMarkup | stdClass | array $reply_markup = null): message | responseError | bool { |
|
| 68 | 68 | return telegram::editMessageReplyMarkup(reply_markup: $reply_markup); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - public function editMedia (inputMedia|array|stdClass $media): message|responseError|bool { |
|
| 71 | + public function editMedia(inputMedia | array | stdClass $media): message | responseError | bool { |
|
| 72 | 72 | return telegram::editMessageMedia($media); |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | * telegram class , Adding normal method call to request class and a simple name for being easy to call |
| 7 | 7 | */ |
| 8 | 8 | class telegram extends request { |
| 9 | - public function __call (string $name, array $arguments) { |
|
| 9 | + public function __call(string $name, array $arguments) { |
|
| 10 | 10 | return request::$name(...$arguments); |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 | \ No newline at end of file |
@@ -18,64 +18,64 @@ discard block |
||
| 18 | 18 | public user $user; |
| 19 | 19 | |
| 20 | 20 | /** `creator` and `administrator` only. True, if the user's presence in the chat is hidden */ |
| 21 | - public null|bool $is_anonymous = null; |
|
| 21 | + public null | bool $is_anonymous = null; |
|
| 22 | 22 | |
| 23 | 23 | /** `creator` and `administrator` only. Custom title for this user */ |
| 24 | - public null|string $custom_title = null; |
|
| 24 | + public null | string $custom_title = null; |
|
| 25 | 25 | |
| 26 | 26 | /** `administrator` only. True, if the bot is allowed to edit administrator privileges of that user */ |
| 27 | - public null|bool $can_be_edited = null; |
|
| 27 | + public null | bool $can_be_edited = null; |
|
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * `administrator` only. True, if the administrator can access the chat event log, chat statistics, message statistics in |
| 31 | 31 | * channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other |
| 32 | 32 | * administrator privilege |
| 33 | 33 | */ |
| 34 | - public null|bool $can_manage_chat = null; |
|
| 34 | + public null | bool $can_manage_chat = null; |
|
| 35 | 35 | |
| 36 | 36 | /** `administrator` only. True, if the administrator can delete messages of other users */ |
| 37 | - public null|bool $can_delete_messages = null; |
|
| 37 | + public null | bool $can_delete_messages = null; |
|
| 38 | 38 | |
| 39 | 39 | /** `administrator` only. True, if the administrator can manage video chats */ |
| 40 | - public null|bool $can_manage_video_chats = null; |
|
| 40 | + public null | bool $can_manage_video_chats = null; |
|
| 41 | 41 | |
| 42 | 42 | /** `administrator` only. True, if the administrator can restrict, ban or unban chat members */ |
| 43 | - public null|bool $can_restrict_members = null; |
|
| 43 | + public null | bool $can_restrict_members = null; |
|
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * `administrator` only. if the administrator can add new administrators with a subset of their own privileges or demote |
| 47 | 47 | * administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by |
| 48 | 48 | * the user) |
| 49 | 49 | */ |
| 50 | - public null|bool $can_promote_members = null; |
|
| 50 | + public null | bool $can_promote_members = null; |
|
| 51 | 51 | |
| 52 | 52 | /** `administrator` and `restricted` only. True, if the user is allowed to change the chat title, photo and other settings */ |
| 53 | - public null|bool $can_change_info = null; |
|
| 53 | + public null | bool $can_change_info = null; |
|
| 54 | 54 | |
| 55 | 55 | /** `administrator` and `restricted` only. True, if the user is allowed to invite new users to the chat */ |
| 56 | - public null|bool $can_invite_users = null; |
|
| 56 | + public null | bool $can_invite_users = null; |
|
| 57 | 57 | |
| 58 | 58 | /** `administrator` only. Optional. True, if the administrator can post in the channel; channels only */ |
| 59 | - public null|bool $can_post_messages = null; |
|
| 59 | + public null | bool $can_post_messages = null; |
|
| 60 | 60 | |
| 61 | 61 | /** `administrator` only. Optional. True, if the administrator can edit messages of other users and can pin messages; channels only */ |
| 62 | - public null|bool $can_edit_messages = null; |
|
| 62 | + public null | bool $can_edit_messages = null; |
|
| 63 | 63 | |
| 64 | 64 | /** `administrator` and `restricted` only. Optional. True, if the user is allowed to pin messages; groups and supergroups only */ |
| 65 | - public null|bool $can_pin_messages = null; |
|
| 65 | + public null | bool $can_pin_messages = null; |
|
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * `administrator` : Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only |
| 69 | 69 | * |
| 70 | 70 | * `restricted` : True, if the user is allowed to create forum topics |
| 71 | 71 | */ |
| 72 | - public null|bool $can_manage_topics = null; |
|
| 72 | + public null | bool $can_manage_topics = null; |
|
| 73 | 73 | |
| 74 | 74 | /** `restricted` only. True, if the user is a member of the chat at the moment of the request */ |
| 75 | - public null|bool $is_member = null; |
|
| 75 | + public null | bool $is_member = null; |
|
| 76 | 76 | |
| 77 | 77 | /** `restricted` only. True, if the user is allowed to send text messages, contacts, locations and venues */ |
| 78 | - public null|bool $can_send_messages = null; |
|
| 78 | + public null | bool $can_send_messages = null; |
|
| 79 | 79 | |
| 80 | 80 | /** `restricted` only. Optional. True, if the user is allowed to send audios */ |
| 81 | 81 | public bool $can_send_audios; |
@@ -96,16 +96,16 @@ discard block |
||
| 96 | 96 | public bool $can_send_voice_notes; |
| 97 | 97 | |
| 98 | 98 | /** `restricted` only. True, if the user is allowed to send polls */ |
| 99 | - public null|bool $can_send_polls = null; |
|
| 99 | + public null | bool $can_send_polls = null; |
|
| 100 | 100 | |
| 101 | 101 | /** `restricted` only. True, if the user is allowed to send animations, games, stickers and use inline bots */ |
| 102 | - public null|bool $can_send_other_messages = null; |
|
| 102 | + public null | bool $can_send_other_messages = null; |
|
| 103 | 103 | |
| 104 | 104 | /** `restricted` only. True, if the user is allowed to add web page previews to their messages */ |
| 105 | - public null|bool $can_add_web_page_previews = null; |
|
| 105 | + public null | bool $can_add_web_page_previews = null; |
|
| 106 | 106 | |
| 107 | 107 | /** `kicked` and `restricted` only. Date when restrictions will be lifted for this user; unix time. If 0, then the user is restricted forever */ |
| 108 | - public null|int $until_date = null; |
|
| 108 | + public null | int $until_date = null; |
|
| 109 | 109 | |
| 110 | 110 | |
| 111 | 111 | public function __construct(stdClass $object) { |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | public int $user_id; |
| 22 | 22 | |
| 23 | 23 | |
| 24 | - public function __construct(stdClass|null $object = null) { |
|
| 24 | + public function __construct(stdClass | null $object = null) { |
|
| 25 | 25 | if ($object != null) { |
| 26 | 26 | parent::__construct($object, self::subs); |
| 27 | 27 | } |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | public int $chat_id; |
| 19 | 19 | |
| 20 | 20 | |
| 21 | - public function __construct(stdClass|null $object = null) { |
|
| 21 | + public function __construct(stdClass | null $object = null) { |
|
| 22 | 22 | if ($object != null) { |
| 23 | 23 | parent::__construct($object, self::subs); |
| 24 | 24 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | public bool $user_is_premium; |
| 29 | 29 | |
| 30 | 30 | |
| 31 | - public function __construct(stdClass|null $object = null) { |
|
| 31 | + public function __construct(stdClass | null $object = null) { |
|
| 32 | 32 | if ($object != null) { |
| 33 | 33 | parent::__construct($object, self::subs); |
| 34 | 34 | } |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | public bool $bot_is_member; |
| 57 | 57 | |
| 58 | 58 | |
| 59 | - public function __construct(stdClass|null $object = null) { |
|
| 59 | + public function __construct(stdClass | null $object = null) { |
|
| 60 | 60 | if ($object != null) { |
| 61 | 61 | parent::__construct($object, self::subs); |
| 62 | 62 | } |
@@ -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 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @return bool |
| 81 | 81 | */ |
| 82 | - public static function deleteIfExist (string|array $names): bool { |
|
| 82 | + public static function deleteIfExist(string | array $names): bool { |
|
| 83 | 83 | if (is_string($names)) { |
| 84 | 84 | $names = [$names]; |
| 85 | 85 | } |
@@ -16,31 +16,31 @@ |
||
| 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 | 21 | lock::set('getUpdateHook'); |
| 22 | - while(true) { |
|
| 22 | + while (true) { |
|
| 23 | 23 | if (!lock::exist('getUpdateHook')) { |
| 24 | 24 | break; |
| 25 | 25 | } |
| 26 | - $updates = telegram::getUpdates($last_update_id,allowed_updates: settings::$allowed_updates); |
|
| 26 | + $updates = telegram::getUpdates($last_update_id, allowed_updates: settings::$allowed_updates); |
|
| 27 | 27 | if (!telegram::$status) { |
| 28 | - logger::write("There is some problem happened , telegram response : \n".json_encode($updates),loggerTypes::ERROR); |
|
| 29 | - BPT::exit(print_r($updates,true)); |
|
| 28 | + logger::write("There is some problem happened , telegram response : \n".json_encode($updates), loggerTypes::ERROR); |
|
| 29 | + BPT::exit(print_r($updates, true)); |
|
| 30 | 30 | } |
| 31 | 31 | self::handleUpdates($updates); |
| 32 | - $last_update_id = BPT::$update->update_id+1; |
|
| 33 | - lock::save('getUpdate',$last_update_id); |
|
| 32 | + $last_update_id = BPT::$update->update_id + 1; |
|
| 33 | + lock::save('getUpdate', $last_update_id); |
|
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - private static function loadData(): bool|int|string { |
|
| 37 | + private static function loadData(): bool | int | string { |
|
| 38 | 38 | if (lock::exist('getUpdate')) { |
| 39 | 39 | return lock::read('getUpdate'); |
| 40 | 40 | } |
| 41 | 41 | self::deleteOldLocks(); |
| 42 | 42 | telegram::deleteWebhook(); |
| 43 | - lock::save('getUpdate',0); |
|
| 43 | + lock::save('getUpdate', 0); |
|
| 44 | 44 | return 0; |
| 45 | 45 | } |
| 46 | 46 | |