From 30a982b0ac16d1f1f637d0675b46eef6e4421412 Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Fri, 25 Jul 2025 17:01:58 +0200
Subject: [PATCH] API Layer 210: user's Stars Rating, StarGift collections
management & more characteristics...
(that might not be the most recent layer. check https://patreon.com/wizou for the latest layers)
---
README.md | 2 +-
src/TL.Schema.cs | 63 +++++++++++++++++--
src/TL.SchemaFuncs.cs | 122 ++++++++++++++++++++++++++++++++++---
src/TL.Table.cs | 13 ++--
src/WTelegramClient.csproj | 4 +-
5 files changed, 185 insertions(+), 19 deletions(-)
diff --git a/README.md b/README.md
index 4da3f32..a89d3b9 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-[](https://corefork.telegram.org/methods)
+[](https://corefork.telegram.org/methods)
[](https://www.nuget.org/packages/WTelegramClient/)
[](https://www.nuget.org/packages/WTelegramClient/absoluteLatest)
[](https://buymeacoffee.com/wizou)
diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs
index 281d067..c887407 100644
--- a/src/TL.Schema.cs
+++ b/src/TL.Schema.cs
@@ -898,7 +898,7 @@ namespace TL
has_color = 0x100,
/// Field has a value
has_profile_color = 0x200,
- /// If set, we can only write to this user if they have already sent some messages to us, if we are subscribed to Telegram Premium, or if they're a mutual contact (.mutual_contact).
All the secondary conditions listed above must be checked separately to verify whether we can still write to the user, even if this flag is set (i.e. a mutual contact will have this flag set even if we can still write to them, and so on...); to avoid doing these extra checks if we haven't yet cached all the required information (for example while displaying the chat list in the sharing UI) the Users_GetIsPremiumRequiredToContact method may be invoked instead, passing the list of users currently visible in the UI, returning a list of booleans that directly specify whether we can or cannot write to each user; alternatively, the .contact_require_premium flag contains the same (fully checked, i.e. it's not just a copy of this flag) info returned by Users_GetIsPremiumRequiredToContact.
To set this flag for ourselves invoke Account_SetGlobalPrivacySettings, setting the settings.new_noncontact_peers_require_premium flag.
+ /// See here for more info on this flag ».
contact_require_premium = 0x400,
/// Whether this bot can be connected to a user as specified here ».
bot_business = 0x800,
@@ -3742,7 +3742,7 @@ namespace TL
}
/// Extended user info See
- [TLDef(0x99E78045)]
+ [TLDef(0x29DE80BE)]
public sealed partial class UserFull : IObject
{
/// Extra bits of information, use flags.HasFlag(...) to test for those
@@ -3808,6 +3808,7 @@ namespace TL
[IfFlag(44)] public BotVerification bot_verification;
[IfFlag(46)] public long send_paid_messages_stars;
[IfFlag(47)] public DisallowedGiftsSettings disallowed_gifts;
+ [IfFlag(49)] public StarsRating stars_rating;
[Flags] public enum Flags : uint
{
@@ -3900,6 +3901,8 @@ namespace TL
/// Field has a value
has_disallowed_gifts = 0x8000,
display_gifts_button = 0x10000,
+ /// Field has a value
+ has_stars_rating = 0x20000,
}
}
@@ -14719,6 +14722,7 @@ namespace TL
{
/// Extra bits of information, use flags.HasFlag(...) to test for those
public Flags flags;
+ /// If configured, specifies the number of stars users must pay us to send us a message, see here » for more info on paid messages.
[IfFlag(5)] public long noncontact_peers_paid_stars;
[IfFlag(6)] public DisallowedGiftsSettings disallowed_gifts;
@@ -14732,7 +14736,7 @@ namespace TL
keep_archived_folders = 0x4,
/// If this flag is set, the key will also apply to the ability to use Messages_GetOutboxReadDate on messages sent to us.
Meaning, users that cannot see our exact last online date due to the current value of the key will receive a 403 USER_PRIVACY_RESTRICTED error when invoking Messages_GetOutboxReadDate to fetch the exact read date of a message they sent to us.
The .read_dates_private flag will be set for users that have this flag enabled.
hide_read_marks = 0x8,
- /// If set, only users that have a premium account, are in our contact list, or already have a private chat with us can write to us; a 403 PRIVACY_PREMIUM_REQUIRED error will be emitted otherwise.
The .contact_require_premium flag will be set for users that have this flag enabled.
To check whether we can write to a user with this flag enabled, if we haven't yet cached all the required information (for example we don't have the or history of all users while displaying the chat list in the sharing UI) the Users_GetIsPremiumRequiredToContact method may be invoked, passing the list of users currently visible in the UI, returning a list of booleans that directly specify whether we can or cannot write to each user.
This option may be enabled by both non-Premium and Premium users only if the new_noncontact_peers_require_premium_without_ownpremium client configuration flag » is equal to true, otherwise it may be enabled only by Premium users and non-Premium users will receive a PREMIUM_ACCOUNT_REQUIRED error when trying to enable this flag.
+ /// See here for more info on this flag ».
new_noncontact_peers_require_premium = 0x10,
/// Field has a value
has_noncontact_peers_paid_stars = 0x20,
@@ -20094,7 +20098,7 @@ namespace TL
public virtual Peer ReleasedBy => default;
}
/// Represents a star gift, see here » for more info. See
- [TLDef(0x7F853C12)]
+ [TLDef(0x00BCFF5B)]
public sealed partial class StarGift : StarGiftBase
{
/// Extra bits of information, use flags.HasFlag(...) to test for those
@@ -20120,6 +20124,8 @@ namespace TL
[IfFlag(4)] public long resell_min_stars;
[IfFlag(5)] public string title;
[IfFlag(6)] public Peer released_by;
+ [IfFlag(8)] public int per_user_total;
+ [IfFlag(8)] public int per_user_remains;
[Flags] public enum Flags : uint
{
@@ -20137,6 +20143,8 @@ namespace TL
has_title = 0x20,
/// Field has a value
has_released_by = 0x40,
+ require_premium = 0x80,
+ limited_per_user = 0x100,
}
/// Identifier of the gift
@@ -20180,6 +20188,7 @@ namespace TL
has_resell_stars = 0x10,
/// Field has a value
has_released_by = 0x20,
+ require_premium = 0x40,
}
public override long ID => id;
@@ -20571,7 +20580,7 @@ namespace TL
}
/// See
- [TLDef(0xDFDA0499)]
+ [TLDef(0x1EA646DF)]
public sealed partial class SavedStarGift : IObject
{
/// Extra bits of information, use flags.HasFlag(...) to test for those
@@ -20588,6 +20597,7 @@ namespace TL
[IfFlag(8)] public long transfer_stars;
[IfFlag(13)] public DateTime can_transfer_at;
[IfFlag(14)] public DateTime can_resell_at;
+ [IfFlag(15)] public int[] collection_id;
[Flags] public enum Flags : uint
{
@@ -20616,6 +20626,8 @@ namespace TL
has_can_transfer_at = 0x2000,
/// Field has a value
has_can_resell_at = 0x4000,
+ /// Field has a value
+ has_collection_id = 0x8000,
}
}
@@ -20905,4 +20917,45 @@ namespace TL
has_price = 0x8,
}
}
+
+ /// See
+ [TLDef(0x1B0E4F07)]
+ public sealed partial class StarsRating : IObject
+ {
+ public Flags flags;
+ public int level;
+ public long current_level_stars;
+ public long stars;
+ [IfFlag(0)] public long next_level_stars;
+
+ [Flags] public enum Flags : uint
+ {
+ has_next_level_stars = 0x1,
+ }
+ }
+
+ /// See
+ [TLDef(0x9D6B13B0)]
+ public sealed partial class StarGiftCollection : IObject
+ {
+ public Flags flags;
+ public int collection_id;
+ public string title;
+ [IfFlag(0)] public DocumentBase icon;
+ public int gifts_count;
+ public long hash;
+
+ [Flags] public enum Flags : uint
+ {
+ has_icon = 0x1,
+ }
+ }
+
+ /// See
+ /// a value means payments.starGiftCollectionsNotModified
+ [TLDef(0x8A2932F3)]
+ public sealed partial class Payments_StarGiftCollections : IObject
+ {
+ public StarGiftCollection[] collections;
+ }
}
diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs
index 6c1c3b5..a066365 100644
--- a/src/TL.SchemaFuncs.cs
+++ b/src/TL.SchemaFuncs.cs
@@ -1433,7 +1433,9 @@ namespace TL
hash = hash,
});
- /// See [bots: ✓]
+ /// Get the number of stars we have received from the specified user thanks to paid messages »; the received amount will be equal to the sent amount multiplied by stars_paid_message_commission_permille divided by 1000. See [bots: ✓]
+ /// If set, can contain the ID of a monoforum (channel direct messages) to obtain the number of stars the user has spent to send us direct messages via the channel.
+ /// The user that paid to send us messages.
public static Task Account_GetPaidMessagesRevenue(this Client client, InputUserBase user_id, InputPeer parent_peer = null)
=> client.Invoke(new Account_GetPaidMessagesRevenue
{
@@ -1442,7 +1444,11 @@ namespace TL
user_id = user_id,
});
- /// See [bots: ✓]
+ /// Allow a user to send us messages without paying if paid messages » are enabled. See [bots: ✓]
+ /// If set and require_payment is not set, refunds the amounts the user has already paid us to send us messages (directly or via a monoforum).
+ /// Allow or disallow a user to send us messages without paying.
+ /// If set, applies the setting within the monoforum aka direct messages » (pass the ID of the monoforum, not the ID of the associated channel).
+ /// The user to exempt or unexempt.
public static Task Account_ToggleNoPaidMessagesException(this Client client, InputUserBase user_id, InputPeer parent_peer = null, bool refund_charged = false, bool require_payment = false)
=> client.Invoke(new Account_ToggleNoPaidMessagesException
{
@@ -4659,7 +4665,7 @@ namespace TL
/// Upload a custom profile picture for a contact, or suggest a new profile picture to a contact. See Possible codes: 400 (details)
/// If set, will send a service message to user_id, suggesting them to use the specified profile picture; otherwise, will set a personal profile picture for the user (only visible to the current user).
- /// If set, removes a previously set personal profile picture (does not affect suggested profile pictures, to remove them simply deleted the service message with Messages_DeleteMessages).
+ /// If set, removes a previously set personal profile picture (does not affect suggested profile pictures, to remove them simply delete the service message with Messages_DeleteMessages).
/// The contact
/// Profile photo
/// Animated profile picture video
@@ -5648,7 +5654,10 @@ namespace TL
limit = limit,
});
- /// See [bots: ✓]
+ /// Enable or disable paid messages » in this supergroup or monoforum. See [bots: ✓]
+ /// Only usable for channels, enables or disables the associated monoforum aka direct messages.
+ /// Pass the supergroup ID for supergroups and the ID of the channel to modify the setting in the associated monoforum.
+ /// Specifies the required amount of Telegram Stars users must pay to send messages to the supergroup or monoforum.
public static Task Channels_UpdatePaidMessagesPrice(this Client client, InputChannelBase channel, long send_paid_messages_stars, bool broadcast_messages_allowed = false)
=> client.Invoke(new Channels_UpdatePaidMessagesPrice
{
@@ -6409,11 +6418,12 @@ namespace TL
/// See [bots: ✓]
/// Maximum number of results to return, see pagination
- public static Task Payments_GetSavedStarGifts(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, bool exclude_unsaved = false, bool exclude_saved = false, bool exclude_unlimited = false, bool exclude_limited = false, bool exclude_unique = false, bool sort_by_value = false)
+ public static Task Payments_GetSavedStarGifts(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, int? collection_id = null, bool exclude_unsaved = false, bool exclude_saved = false, bool exclude_unlimited = false, bool exclude_limited = false, bool exclude_unique = false, bool sort_by_value = false)
=> client.Invoke(new Payments_GetSavedStarGifts
{
- flags = (Payments_GetSavedStarGifts.Flags)((exclude_unsaved ? 0x1 : 0) | (exclude_saved ? 0x2 : 0) | (exclude_unlimited ? 0x4 : 0) | (exclude_limited ? 0x8 : 0) | (exclude_unique ? 0x10 : 0) | (sort_by_value ? 0x20 : 0)),
+ flags = (Payments_GetSavedStarGifts.Flags)((collection_id != null ? 0x40 : 0) | (exclude_unsaved ? 0x1 : 0) | (exclude_saved ? 0x2 : 0) | (exclude_unlimited ? 0x4 : 0) | (exclude_limited ? 0x8 : 0) | (exclude_unique ? 0x10 : 0) | (sort_by_value ? 0x20 : 0)),
peer = peer,
+ collection_id = collection_id ?? default,
offset = offset,
limit = limit,
});
@@ -6477,6 +6487,53 @@ namespace TL
resell_stars = resell_stars,
});
+ /// See
+ public static Task Payments_CreateStarGiftCollection(this Client client, InputPeer peer, string title, params InputSavedStarGift[] stargift)
+ => client.Invoke(new Payments_CreateStarGiftCollection
+ {
+ peer = peer,
+ title = title,
+ stargift = stargift,
+ });
+
+ /// See
+ public static Task Payments_UpdateStarGiftCollection(this Client client, InputPeer peer, int collection_id, string title = null, InputSavedStarGift[] delete_stargift = null, InputSavedStarGift[] add_stargift = null, InputSavedStarGift[] order = null)
+ => client.Invoke(new Payments_UpdateStarGiftCollection
+ {
+ flags = (Payments_UpdateStarGiftCollection.Flags)((title != null ? 0x1 : 0) | (delete_stargift != null ? 0x2 : 0) | (add_stargift != null ? 0x4 : 0) | (order != null ? 0x8 : 0)),
+ peer = peer,
+ collection_id = collection_id,
+ title = title,
+ delete_stargift = delete_stargift,
+ add_stargift = add_stargift,
+ order = order,
+ });
+
+ /// See
+ public static Task Payments_ReorderStarGiftCollections(this Client client, InputPeer peer, params int[] order)
+ => client.Invoke(new Payments_ReorderStarGiftCollections
+ {
+ peer = peer,
+ order = order,
+ });
+
+ /// See
+ public static Task Payments_DeleteStarGiftCollection(this Client client, InputPeer peer, int collection_id)
+ => client.Invoke(new Payments_DeleteStarGiftCollection
+ {
+ peer = peer,
+ collection_id = collection_id,
+ });
+
+ /// See
+ /// a null value means payments.starGiftCollectionsNotModified
+ public static Task Payments_GetStarGiftCollections(this Client client, InputPeer peer, long hash = default)
+ => client.Invoke(new Payments_GetStarGiftCollections
+ {
+ peer = peer,
+ hash = hash,
+ });
+
/// Create a stickerset. See [bots: ✓] Possible codes: 400 (details)
/// Whether this is a mask stickerset
/// Whether this is a custom emoji stickerset.
@@ -13077,11 +13134,12 @@ namespace TL.Methods
public string slug;
}
- [TLDef(0x23830DE9)]
+ [TLDef(0xA319E569)]
public sealed partial class Payments_GetSavedStarGifts : IMethod
{
public Flags flags;
public InputPeer peer;
+ [IfFlag(6)] public int collection_id;
public string offset;
public int limit;
@@ -13093,6 +13151,7 @@ namespace TL.Methods
exclude_limited = 0x8,
exclude_unique = 0x10,
sort_by_value = 0x20,
+ has_collection_id = 0x40,
}
}
@@ -13160,6 +13219,55 @@ namespace TL.Methods
public long resell_stars;
}
+ [TLDef(0x1F4A0E87)]
+ public sealed partial class Payments_CreateStarGiftCollection : IMethod
+ {
+ public InputPeer peer;
+ public string title;
+ public InputSavedStarGift[] stargift;
+ }
+
+ [TLDef(0x4FDDBEE7)]
+ public sealed partial class Payments_UpdateStarGiftCollection : IMethod
+ {
+ public Flags flags;
+ public InputPeer peer;
+ public int collection_id;
+ [IfFlag(0)] public string title;
+ [IfFlag(1)] public InputSavedStarGift[] delete_stargift;
+ [IfFlag(2)] public InputSavedStarGift[] add_stargift;
+ [IfFlag(3)] public InputSavedStarGift[] order;
+
+ [Flags] public enum Flags : uint
+ {
+ has_title = 0x1,
+ has_delete_stargift = 0x2,
+ has_add_stargift = 0x4,
+ has_order = 0x8,
+ }
+ }
+
+ [TLDef(0xC32AF4CC)]
+ public sealed partial class Payments_ReorderStarGiftCollections : IMethod
+ {
+ public InputPeer peer;
+ public int[] order;
+ }
+
+ [TLDef(0xAD5648E8)]
+ public sealed partial class Payments_DeleteStarGiftCollection : IMethod
+ {
+ public InputPeer peer;
+ public int collection_id;
+ }
+
+ [TLDef(0x981B91DD)]
+ public sealed partial class Payments_GetStarGiftCollections : IMethod
+ {
+ public InputPeer peer;
+ public long hash;
+ }
+
[TLDef(0x9021AB67)]
public sealed partial class Stickers_CreateStickerSet : IMethod
{
diff --git a/src/TL.Table.cs b/src/TL.Table.cs
index cf405eb..6745b43 100644
--- a/src/TL.Table.cs
+++ b/src/TL.Table.cs
@@ -6,7 +6,7 @@ namespace TL
{
public static partial class Layer
{
- public const int Version = 209; // fetched 14/07/2025 20:10:02
+ public const int Version = 210; // fetched 25/07/2025 14:54:33
internal const int SecretChats = 144;
internal const int MTProto2 = 73;
internal const uint VectorCtor = 0x1CB5C415;
@@ -254,7 +254,7 @@ namespace TL
[0xF47741F7] = typeof(PeerSettings),
[0xA437C3ED] = typeof(WallPaper),
[0xE0804116] = typeof(WallPaperNoFile),
- [0x99E78045] = typeof(UserFull),
+ [0x29DE80BE] = typeof(UserFull),
[0x145ADE0B] = typeof(Contact),
[0xC13E3C50] = typeof(ImportedContact),
[0x16D9703B] = typeof(ContactStatus),
@@ -1361,7 +1361,7 @@ namespace TL
[0x4BA3A95A] = typeof(MessageReactor),
[0x94CE852A] = typeof(StarsGiveawayOption),
[0x54236209] = typeof(StarsGiveawayWinnersOption),
- [0x7F853C12] = typeof(StarGift),
+ [0x00BCFF5B] = typeof(StarGift),
[0xF63778AE] = typeof(StarGiftUnique),
[0xA388A368] = null,//Payments_StarGiftsNotModified
[0x2ED82995] = typeof(Payments_StarGifts),
@@ -1391,7 +1391,7 @@ namespace TL
[0x315A4974] = typeof(Users_UsersSlice),
[0xCAA2F60B] = typeof(Payments_UniqueStarGift),
[0xB53E8B21] = typeof(Messages_WebPagePreview),
- [0xDFDA0499] = typeof(SavedStarGift),
+ [0x1EA646DF] = typeof(SavedStarGift),
[0x95F389B1] = typeof(Payments_SavedStarGifts),
[0x69279795] = typeof(InputSavedStarGiftUser),
[0xF101AA7F] = typeof(InputSavedStarGiftChat),
@@ -1420,6 +1420,10 @@ namespace TL
[0x49B92A26] = typeof(TodoList),
[0x4CC120B7] = typeof(TodoCompletion),
[0x0E8E37E5] = typeof(SuggestedPost),
+ [0x1B0E4F07] = typeof(StarsRating),
+ [0x9D6B13B0] = typeof(StarGiftCollection),
+ [0xA0BA4F17] = null,//Payments_StarGiftCollectionsNotModified
+ [0x8A2932F3] = typeof(Payments_StarGiftCollections),
// from TL.Secret:
[0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument),
[0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote),
@@ -1553,6 +1557,7 @@ namespace TL
[typeof(PaidReactionPrivacy)] = 0x206AD49E, //paidReactionPrivacyDefault
[typeof(RequirementToContact)] = 0x050A9839, //requirementToContactEmpty
[typeof(Contacts_SponsoredPeers)] = 0xEA32B4B1, //contacts.sponsoredPeersEmpty
+ [typeof(Payments_StarGiftCollections)] = 0xA0BA4F17, //payments.starGiftCollectionsNotModified
[typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty
};
}
diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj
index 8ab7179..d786b10 100644
--- a/src/WTelegramClient.csproj
+++ b/src/WTelegramClient.csproj
@@ -13,8 +13,8 @@
WTelegramClient
Wizou
0.0.0
- layer.209
- Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 209
+ layer.210
+ Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 210
Release Notes:
$(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A"))