From 20fd005fcf0e17698fa73f9e0b62457de7580a7d Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 18 Jan 2024 22:19:41 +0100 Subject: [PATCH] Update layer 172 --- README.md | 2 ++ composer.json | 2 +- psalm.xml | 5 ++++- schemas | 2 +- src/MTProto.php | 2 +- src/Namespace/Account.php | 6 +++--- src/Namespace/Contacts.php | 2 +- src/Namespace/Messages.php | 11 +++++++++++ src/Namespace/Users.php | 11 +++++++++++ src/Settings/TLSchema.php | 4 ++-- ...TL_telegram_v171.tl => TL_telegram_v172.tl} | 18 +++++++++++------- tools/phar.php | 17 ++++++++--------- 12 files changed, 56 insertions(+), 26 deletions(-) rename src/{TL_telegram_v171.tl => TL_telegram_v172.tl} (99%) diff --git a/README.md b/README.md index 36084110c..c09980c03 100644 --- a/README.md +++ b/README.md @@ -964,6 +964,7 @@ Want to add your own open-source project to this list? [Click here!](https://doc * help.getPeerProfileColors * messages.deleteSavedHistory * messages.getDefaultTagReactions + * messages.getOutboxReadDate * messages.getPinnedSavedDialogs * messages.getSavedDialogs * messages.getSavedHistory @@ -1010,6 +1011,7 @@ Want to add your own open-source project to this list? [Click here!](https://doc * stories.toggleAllStoriesHidden * stories.togglePeerStoriesHidden * stories.togglePinned + * users.getIsPremiumRequiredToContact * [Contributing](https://docs.madelineproto.xyz/docs/CONTRIB.html) - You can contribute in various ways. * [Translation](https://docs.madelineproto.xyz/docs/CONTRIB.html#translation) * [Contribution guide](https://docs.madelineproto.xyz/docs/CONTRIB.html#contribution-guide) diff --git a/composer.json b/composer.json index feffc16de..dbc16312c 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ }, "minimum-stability": "beta", "require": { - "php-64bit": ">=8.2.4", + "php-64bit": ">=8.1", "danog/primemodule": "^1", "symfony/polyfill-mbstring": "*", "ext-mbstring": "*", diff --git a/psalm.xml b/psalm.xml index ee9a55fd8..cfcf11318 100644 --- a/psalm.xml +++ b/psalm.xml @@ -8,8 +8,9 @@ ignoreInternalFunctionNullReturn="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" - xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" + xsi:schemaLocation="https://getpsalm.org/schema/config vendor-bin/check/vendor/vimeo/psalm/config.xsd" errorBaseline="psalm-baseline.xml" + autoloader="vendor/autoload.php" > @@ -20,6 +21,8 @@ + + diff --git a/schemas b/schemas index 5a74e08f4..4f3d0c94f 160000 --- a/schemas +++ b/schemas @@ -1 +1 @@ -Subproject commit 5a74e08f4ee184ff928498bbe3e35f754ab55b98 +Subproject commit 4f3d0c94f2958dd4f84021063b767deb1501bef0 diff --git a/src/MTProto.php b/src/MTProto.php index 533adaf94..4ca1d468a 100644 --- a/src/MTProto.php +++ b/src/MTProto.php @@ -126,7 +126,7 @@ final class MTProto implements TLCallback, LoggerGetter, SettingsGetter * @internal * @var int */ - public const V = 182; + public const V = 183; /** * Bad message error codes. * diff --git a/src/Namespace/Account.php b/src/Namespace/Account.php index dbbb63982..f211d5a1a 100644 --- a/src/Namespace/Account.php +++ b/src/Namespace/Account.php @@ -734,18 +734,18 @@ interface Account * @param ?int $floodWaitLimit Can be used to specify a custom flood wait limit: if a FLOOD_WAIT_ rate limiting error is received with a waiting period bigger than this integer, an RPCErrorException will be thrown; otherwise, MadelineProto will simply wait for the specified amount of time. Defaults to the value specified in the settings: https://docs.madelineproto.xyz/PHP/danog/MadelineProto/Settings/RPC.html#setfloodtimeout-int-floodtimeout-self * @param ?string $queueId If specified, ensures strict server-side execution order of concurrent calls with the same queue ID. * @param ?\Amp\Cancellation $cancellation Cancellation - * @return array{_: 'globalPrivacySettings', archive_and_mute_new_noncontact_peers: bool, keep_archived_unmuted: bool, keep_archived_folders: bool} @see https://docs.madelineproto.xyz/API_docs/types/GlobalPrivacySettings.html + * @return array{_: 'globalPrivacySettings', archive_and_mute_new_noncontact_peers: bool, keep_archived_unmuted: bool, keep_archived_folders: bool, hide_read_marks: bool, new_noncontact_peers_require_premium: bool} @see https://docs.madelineproto.xyz/API_docs/types/GlobalPrivacySettings.html */ public function getGlobalPrivacySettings(?int $floodWaitLimit = null, ?string $queueId = null, ?\Amp\Cancellation $cancellation = null): array; /** * Set global privacy settings. * - * @param array{_: 'globalPrivacySettings', archive_and_mute_new_noncontact_peers?: bool, keep_archived_unmuted?: bool, keep_archived_folders?: bool} $settings Global privacy settings @see https://docs.madelineproto.xyz/API_docs/types/GlobalPrivacySettings.html + * @param array{_: 'globalPrivacySettings', archive_and_mute_new_noncontact_peers?: bool, keep_archived_unmuted?: bool, keep_archived_folders?: bool, hide_read_marks?: bool, new_noncontact_peers_require_premium?: bool} $settings Global privacy settings @see https://docs.madelineproto.xyz/API_docs/types/GlobalPrivacySettings.html * @param ?int $floodWaitLimit Can be used to specify a custom flood wait limit: if a FLOOD_WAIT_ rate limiting error is received with a waiting period bigger than this integer, an RPCErrorException will be thrown; otherwise, MadelineProto will simply wait for the specified amount of time. Defaults to the value specified in the settings: https://docs.madelineproto.xyz/PHP/danog/MadelineProto/Settings/RPC.html#setfloodtimeout-int-floodtimeout-self * @param ?string $queueId If specified, ensures strict server-side execution order of concurrent calls with the same queue ID. * @param ?\Amp\Cancellation $cancellation Cancellation - * @return array{_: 'globalPrivacySettings', archive_and_mute_new_noncontact_peers: bool, keep_archived_unmuted: bool, keep_archived_folders: bool} @see https://docs.madelineproto.xyz/API_docs/types/GlobalPrivacySettings.html + * @return array{_: 'globalPrivacySettings', archive_and_mute_new_noncontact_peers: bool, keep_archived_unmuted: bool, keep_archived_folders: bool, hide_read_marks: bool, new_noncontact_peers_require_premium: bool} @see https://docs.madelineproto.xyz/API_docs/types/GlobalPrivacySettings.html */ public function setGlobalPrivacySettings(array $settings, ?int $floodWaitLimit = null, ?string $queueId = null, ?\Amp\Cancellation $cancellation = null): array; diff --git a/src/Namespace/Contacts.php b/src/Namespace/Contacts.php index 02238766a..f426e9b33 100644 --- a/src/Namespace/Contacts.php +++ b/src/Namespace/Contacts.php @@ -26,7 +26,7 @@ interface Contacts * @param ?int $floodWaitLimit Can be used to specify a custom flood wait limit: if a FLOOD_WAIT_ rate limiting error is received with a waiting period bigger than this integer, an RPCErrorException will be thrown; otherwise, MadelineProto will simply wait for the specified amount of time. Defaults to the value specified in the settings: https://docs.madelineproto.xyz/PHP/danog/MadelineProto/Settings/RPC.html#setfloodtimeout-int-floodtimeout-self * @param ?string $queueId If specified, ensures strict server-side execution order of concurrent calls with the same queue ID. * @param ?\Amp\Cancellation $cancellation Cancellation - * @return list Array of @see https://docs.madelineproto.xyz/API_docs/types/ContactStatus.html + * @return list Array of @see https://docs.madelineproto.xyz/API_docs/types/ContactStatus.html */ public function getStatuses(?int $floodWaitLimit = null, ?string $queueId = null, ?\Amp\Cancellation $cancellation = null): array; diff --git a/src/Namespace/Messages.php b/src/Namespace/Messages.php index a0ca04001..f0358fc00 100644 --- a/src/Namespace/Messages.php +++ b/src/Namespace/Messages.php @@ -2496,4 +2496,15 @@ interface Messages * @return array{_: 'messages.reactionsNotModified'}|array{_: 'messages.reactions', hash: list, reactions: list} @see https://docs.madelineproto.xyz/API_docs/types/messages.Reactions.html */ public function getDefaultTagReactions(array $hash = [], ?int $floodWaitLimit = null, ?string $queueId = null, ?\Amp\Cancellation $cancellation = null): array; + + /** + * + * + * @param array|int|string $peer @see https://docs.madelineproto.xyz/API_docs/types/InputPeer.html + * @param ?int $floodWaitLimit Can be used to specify a custom flood wait limit: if a FLOOD_WAIT_ rate limiting error is received with a waiting period bigger than this integer, an RPCErrorException will be thrown; otherwise, MadelineProto will simply wait for the specified amount of time. Defaults to the value specified in the settings: https://docs.madelineproto.xyz/PHP/danog/MadelineProto/Settings/RPC.html#setfloodtimeout-int-floodtimeout-self + * @param ?string $queueId If specified, ensures strict server-side execution order of concurrent calls with the same queue ID. + * @param ?\Amp\Cancellation $cancellation Cancellation + * @return array{_: 'outboxReadDate', date: int} @see https://docs.madelineproto.xyz/API_docs/types/OutboxReadDate.html + */ + public function getOutboxReadDate(array|int|string|null $peer = null, int|null $msg_id = 0, ?int $floodWaitLimit = null, ?string $queueId = null, ?\Amp\Cancellation $cancellation = null): array; } diff --git a/src/Namespace/Users.php b/src/Namespace/Users.php index 2990501a2..a6878e05a 100644 --- a/src/Namespace/Users.php +++ b/src/Namespace/Users.php @@ -21,4 +21,15 @@ interface Users * @param ?\Amp\Cancellation $cancellation Cancellation */ public function setSecureValueErrors(array|int|string|null $id = null, array $errors = [], ?int $floodWaitLimit = null, ?string $queueId = null, ?\Amp\Cancellation $cancellation = null): bool; + + /** + * + * + * @param list|array $id Array of @see https://docs.madelineproto.xyz/API_docs/types/InputUser.html + * @param ?int $floodWaitLimit Can be used to specify a custom flood wait limit: if a FLOOD_WAIT_ rate limiting error is received with a waiting period bigger than this integer, an RPCErrorException will be thrown; otherwise, MadelineProto will simply wait for the specified amount of time. Defaults to the value specified in the settings: https://docs.madelineproto.xyz/PHP/danog/MadelineProto/Settings/RPC.html#setfloodtimeout-int-floodtimeout-self + * @param ?string $queueId If specified, ensures strict server-side execution order of concurrent calls with the same queue ID. + * @param ?\Amp\Cancellation $cancellation Cancellation + * @return list + */ + public function getIsPremiumRequiredToContact(array $id = [], ?int $floodWaitLimit = null, ?string $queueId = null, ?\Amp\Cancellation $cancellation = null): array; } diff --git a/src/Settings/TLSchema.php b/src/Settings/TLSchema.php index 04b2ed5fa..1fe17cb3c 100644 --- a/src/Settings/TLSchema.php +++ b/src/Settings/TLSchema.php @@ -27,11 +27,11 @@ final class TLSchema extends SettingsAbstract /** * TL layer version. */ - protected int $layer = 171; + protected int $layer = 172; /** * API schema path. */ - protected string $APISchema = __DIR__ . '/../TL_telegram_v171.tl'; + protected string $APISchema = __DIR__ . '/../TL_telegram_v172.tl'; /** * MTProto schema path. */ diff --git a/src/TL_telegram_v171.tl b/src/TL_telegram_v172.tl similarity index 99% rename from src/TL_telegram_v171.tl rename to src/TL_telegram_v172.tl index fee427f9f..5fac44c06 100644 --- a/src/TL_telegram_v171.tl +++ b/src/TL_telegram_v172.tl @@ -82,7 +82,7 @@ storage.fileMp4#b3cea0e4 = storage.FileType; storage.fileWebp#1081464c = storage.FileType; userEmpty#d3bc4b7a id:long = User; -user#215c4438 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector stories_max_id:flags2.5?int color:flags2.8?PeerColor profile_color:flags2.9?PeerColor = User; +user#215c4438 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true contact_require_premium:flags2.10?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector stories_max_id:flags2.5?int color:flags2.8?PeerColor profile_color:flags2.9?PeerColor = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; userProfilePhoto#82d1f706 flags:# has_video:flags.0?true personal:flags.2?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = UserProfilePhoto; @@ -90,9 +90,9 @@ userProfilePhoto#82d1f706 flags:# has_video:flags.0?true personal:flags.2?true p userStatusEmpty#9d05049 = UserStatus; userStatusOnline#edb93949 expires:int = UserStatus; userStatusOffline#8c703f was_online:int = UserStatus; -userStatusRecently#e26f42f1 = UserStatus; -userStatusLastWeek#7bf09fc = UserStatus; -userStatusLastMonth#77ebc742 = UserStatus; +userStatusRecently#7b197dc8 flags:# by_me:flags.0?true = UserStatus; +userStatusLastWeek#541a1d1a flags:# by_me:flags.0?true = UserStatus; +userStatusLastMonth#65899777 flags:# by_me:flags.0?true = UserStatus; chatEmpty#29562865 id:long = Chat; chat#41cbf256 flags:# creator:flags.0?true left:flags.2?true deactivated:flags.5?true call_active:flags.23?true call_not_empty:flags.24?true noforwards:flags.25?true id:long title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel admin_rights:flags.14?ChatAdminRights default_banned_rights:flags.18?ChatBannedRights = Chat; @@ -226,7 +226,7 @@ inputReportReasonFake#f5ddd6e7 = ReportReason; inputReportReasonIllegalDrugs#a8eb2be = ReportReason; inputReportReasonPersonalDetails#9ec7863d = ReportReason; -userFull#b9b12c6c flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories = UserFull; +userFull#b9b12c6c flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper stories:flags.25?PeerStories = UserFull; contact#145ade0b user_id:long mutual:Bool = Contact; @@ -1259,7 +1259,7 @@ statsGroupTopInviter#535f779d user_id:long invitations:int = StatsGroupTopInvite stats.megagroupStats#ef7ff916 period:StatsDateRangeDays members:StatsAbsValueAndPrev messages:StatsAbsValueAndPrev viewers:StatsAbsValueAndPrev posters:StatsAbsValueAndPrev growth_graph:StatsGraph members_graph:StatsGraph new_members_by_source_graph:StatsGraph languages_graph:StatsGraph messages_graph:StatsGraph actions_graph:StatsGraph top_hours_graph:StatsGraph weekdays_graph:StatsGraph top_posters:Vector top_admins:Vector top_inviters:Vector users:Vector = stats.MegagroupStats; -globalPrivacySettings#734c4ccb flags:# archive_and_mute_new_noncontact_peers:flags.0?true keep_archived_unmuted:flags.1?true keep_archived_folders:flags.2?true = GlobalPrivacySettings; +globalPrivacySettings#734c4ccb flags:# archive_and_mute_new_noncontact_peers:flags.0?true keep_archived_unmuted:flags.1?true keep_archived_folders:flags.2?true hide_read_marks:flags.3?true new_noncontact_peers_require_premium:flags.4?true = GlobalPrivacySettings; help.countryCode#4203c5ef flags:# country_code:string prefixes:flags.0?Vector patterns:flags.1?Vector = help.CountryCode; @@ -1649,6 +1649,8 @@ savedReactionTag#cb6ff828 flags:# reaction:Reaction title:flags.0?string count:i messages.savedReactionTagsNotModified#889b59ef = messages.SavedReactionTags; messages.savedReactionTags#3259950a tags:Vector hash:long = messages.SavedReactionTags; +outboxReadDate#3bb842ac date:int = OutboxReadDate; + ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; @@ -1778,6 +1780,7 @@ account.getChannelRestrictedStatusEmojis#35a9e0d5 hash:long = EmojiList; users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#b60f5918 id:InputUser = users.UserFull; users.setSecureValueErrors#90c894b5 id:InputUser errors:Vector = Bool; +users.getIsPremiumRequiredToContact#a622aa10 id:Vector = Vector; contacts.getContactIDs#7adc669d hash:long = Vector; contacts.getStatuses#c4a353ee = Vector; @@ -2002,6 +2005,7 @@ messages.reorderPinnedSavedDialogs#8b716587 flags:# force:flags.0?true order:Vec messages.getSavedReactionTags#761ddacf hash:long = messages.SavedReactionTags; messages.updateSavedReactionTag#60297dec flags:# reaction:Reaction title:flags.0?string = Bool; messages.getDefaultTagReactions#bdf93428 hash:long = messages.Reactions; +messages.getOutboxReadDate#8c4bfe5d peer:InputPeer msg_id:int = OutboxReadDate; updates.getState#edd4882a = updates.State; updates.getDifference#19c2f763 flags:# pts:int pts_limit:flags.1?int pts_total_limit:flags.0?int date:int qts:int qts_limit:flags.2?int = updates.Difference; @@ -2244,4 +2248,4 @@ premium.applyBoost#6b7da746 flags:# slots:flags.0?Vector peer:InputPeer = p premium.getBoostsStatus#42f1f61 peer:InputPeer = premium.BoostsStatus; premium.getUserBoosts#39854d1f peer:InputPeer user_id:InputUser = premium.BoostsList; -// LAYER 171 +// LAYER 172 diff --git a/tools/phar.php b/tools/phar.php index 33f8aa72a..217e2b436 100644 --- a/tools/phar.php +++ b/tools/phar.php @@ -2,6 +2,14 @@ namespace danog\MadelineProto; +if ((PHP_MAJOR_VERSION === 8 && PHP_MINOR_VERSION < 1) || PHP_MAJOR_VERSION < 8) { + die('MadelineProto requires at least PHP 8.2, PHP 8.3+ is recommended.'.PHP_EOL); +} + +if (PHP_INT_SIZE < 8) { + die('A 64-bit build of PHP is required to run MadelineProto, PHP 8.2+ is required, 8.3+ is recommended.'.PHP_EOL); +} + if (\defined('MADELINE_PHP')) { throw new \Exception('Please do not include madeline.php twice, use require_once \'madeline.php\';!'); } @@ -40,12 +48,6 @@ class Installer */ public function __construct() { - if ((PHP_MAJOR_VERSION === 8 && PHP_MINOR_VERSION < 2) || PHP_MAJOR_VERSION <= 7) { - die('MadelineProto requires at least PHP 8.2.'.PHP_EOL); - } - if (PHP_INT_SIZE < 8) { - die('A 64-bit build of PHP is required to run MadelineProto, PHP 8.2+ is required.'.PHP_EOL); - } $backtrace = debug_backtrace(0); if (\count($backtrace) === 1) { if (isset($GLOBALS['argv']) && !empty($GLOBALS['argv'])) { @@ -159,9 +161,6 @@ class Installer private static function load(?string $release): mixed { if ($release === null) { - if ((PHP_MAJOR_VERSION === 8 && PHP_MINOR_VERSION < 2) || PHP_MAJOR_VERSION <= 7) { - throw new \Exception('MadelineProto requires at least PHP 8.2.'); - } throw new \Exception('Could not download MadelineProto, please check your internet connection and PHP configuration!'); } $phar = "madeline-$release.phar";