diff --git a/README.md b/README.md index 4cb2c01..db8cbd9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-188-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-189-blueviolet)](https://corefork.telegram.org/methods) [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient?color=00508F)](https://www.nuget.org/packages/WTelegramClient/) [![NuGet prerelease](https://img.shields.io/nuget/vpre/WTelegramClient?color=C09030&label=dev+nuget)](https://www.nuget.org/packages/WTelegramClient/absoluteLatest) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](https://buymeacoffee.com/wizou) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index bd4506f..f510d62 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -757,19 +757,19 @@ namespace TL public Flags2 flags2; /// ID of the user, see here » for more info. public long id; - /// Access hash of the user, see here » for more info.
If this flag is set, when updating the local peer database, generate a virtual flag called min_access_hash, which is:
- Set to true if min is set AND
- The phone flag is not set OR
- The phone flag is set and the associated phone number string is non-empty
- Set to false otherwise.

Then, apply both access_hash and min_access_hash to the local database if:
- min_access_hash is false OR
- min_access_hash is true AND
- There is no locally cached object for this user OR
- There is no access_hash in the local cache OR
- The cached object's min_access_hash is also true
If the final merged object stored to the database has the min_access_hash field set to true, the related access_hash is only suitable to use in inputPeerPhotoFileLocation », to directly download the profile pictures of users, everywhere else a inputPeer*FromMessage constructor will have to be generated as specified here ».
Bots can also use min access hashes in some conditions, by passing 0 instead of the min access hash.
+ /// Access hash of the user, see here » for more info.
If this flag is set, when updating the local peer database, generate a virtual flag called min_access_hash, which is:
- Set to true if min is set AND
-- The phone flag is not set OR
-- The phone flag is set and the associated phone number string is non-empty
- Set to false otherwise.

Then, apply both access_hash and min_access_hash to the local database if:
- min_access_hash is false OR
- min_access_hash is true AND
-- There is no locally cached object for this user OR
-- There is no access_hash in the local cache OR
-- The cached object's min_access_hash is also true

If the final merged object stored to the database has the min_access_hash field set to true, the related access_hash is only suitable to use in inputPeerPhotoFileLocation », to directly download the profile pictures of users, everywhere else a inputPeer*FromMessage constructor will have to be generated as specified here ».
Bots can also use min access hashes in some conditions, by passing 0 instead of the min access hash.
[IfFlag(0)] public long access_hash; - /// First name.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The min flag of the locally cached user entry is set.
+ /// First name.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
-- The min flag of the locally cached user entry is set.
[IfFlag(1)] public string first_name; - /// Last name.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The min flag of the locally cached user entry is set.
+ /// Last name.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
-- The min flag of the locally cached user entry is set.
[IfFlag(2)] public string last_name; - /// Main active username.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The min flag of the locally cached user entry is set.
Changes to this flag should invalidate the local cache for this user ID if the above conditions are respected and the bot_can_edit flag is also set.
+ /// Main active username.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
-- The min flag of the locally cached user entry is set.
Changes to this flag should invalidate the local cache for this user ID if the above conditions are respected and the bot_can_edit flag is also set.
[IfFlag(3)] public string username; - /// Phone number.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The min flag of the locally cached user entry is set.
+ /// Phone number.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
-- The min flag of the locally cached user entry is set.
[IfFlag(4)] public string phone; - /// Profile picture of user.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The apply_min_photo flag is set OR
- The min flag of the locally cached user entry is set.
+ /// Profile picture of user.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
-- The apply_min_photo flag is set OR
-- The min flag of the locally cached user entry is set.
[IfFlag(5)] public UserProfilePhoto photo; - /// Online status of user.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The min flag of the locally cached user entry is set OR
- The locally cached user entry is equal to .
+ /// Online status of user.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
-- The min flag of the locally cached user entry is set OR
-- The locally cached user entry is equal to .
[IfFlag(6)] public UserStatus status; /// Version of the bot_info field in userFull, incremented every time it changes.
Changes to this flag should invalidate the local cache for this user ID, see here » for more info.
[IfFlag(14)] public int bot_info_version; @@ -781,7 +781,7 @@ namespace TL [IfFlag(22)] public string lang_code; /// Emoji status [IfFlag(30)] public EmojiStatus emoji_status; - /// Additional usernames.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The min flag of the locally cached user entry is set.
Changes to this flag (if the above conditions are respected) should invalidate the local cache for this user ID.
+ /// Additional usernames.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
-- The min flag of the locally cached user entry is set.
Changes to this flag (if the above conditions are respected) should invalidate the local cache for this user ID.
[IfFlag(32)] public Username[] usernames; /// ID of the maximum read story.
When updating the local peer database, do not apply changes to this field if the min flag of the incoming constructor is set.
[IfFlag(37)] public int stories_max_id; @@ -1980,7 +1980,6 @@ namespace TL public Flags flags; /// Attached document [IfFlag(0)] public DocumentBase document; - /// Currently only used for story videos, may contain an alternative version of the story video, explicitly encoded using H.264 (in MPEG4 transport) at a lower resolution than document. [IfFlag(5)] public DocumentBase[] alt_documents; /// Time to live of self-destructing document [IfFlag(2)] public int ttl_seconds; @@ -2784,6 +2783,23 @@ namespace TL unclaimed = 0x1, } } + /// See + [TLDef(0x9BB3EF44)] + public sealed partial class MessageActionStarGift : MessageAction + { + public Flags flags; + public StarGift gift; + [IfFlag(1)] public TextWithEntities message; + public long convert_stars; + + [Flags] public enum Flags : uint + { + name_hidden = 0x1, + has_message = 0x2, + saved = 0x4, + converted = 0x8, + } + } /// Chat info. See Derived classes: , public abstract partial class DialogBase : IObject @@ -3388,7 +3404,7 @@ namespace TL } /// Extended user info See - [TLDef(0xCC997720)] + [TLDef(0x1F58E369)] public sealed partial class UserFull : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -3449,6 +3465,7 @@ namespace TL [IfFlag(38)] public long personal_channel_id; /// ID of the latest message of the associated personal channel », that should be previewed in the profile page. [IfFlag(38)] public int personal_channel_message; + [IfFlag(40)] public int stargifts_count; [Flags] public enum Flags : uint { @@ -3528,6 +3545,8 @@ namespace TL has_personal_channel_id = 0x40, /// Whether ads were re-enabled for the current account (only accessible to the currently logged-in user), see here » for more info. sponsored_enabled = 0x80, + /// Field has a value + has_stargifts_count = 0x100, } } @@ -10520,18 +10539,8 @@ namespace TL { /// Form ID public virtual long FormId => default; - /// Bot ID - public virtual long BotId => default; - /// Form title - public virtual string Title => default; - /// Description - public virtual string Description => default; - /// Product photo - public virtual WebDocumentBase Photo => default; /// Invoice public virtual Invoice Invoice => default; - /// Users - public virtual Dictionary Users => default; } /// Payment form See [TLDef(0xA0058751)] @@ -10588,18 +10597,8 @@ namespace TL /// Form ID public override long FormId => form_id; - /// Bot ID - public override long BotId => bot_id; - /// Form title - public override string Title => title; - /// Description - public override string Description => description; - /// Product photo - public override WebDocumentBase Photo => photo; /// Invoice public override Invoice Invoice => invoice; - /// Users - public override Dictionary Users => users; } /// Represents a payment form, for payments to be using Telegram Stars, see here » for more info. See [TLDef(0x7BF6B15C)] @@ -10630,18 +10629,18 @@ namespace TL /// Form ID. public override long FormId => form_id; - /// Bot ID. - public override long BotId => bot_id; - /// Form title - public override string Title => title; - /// Description - public override string Description => description; - /// Product photo - public override WebDocumentBase Photo => photo; /// Invoice public override Invoice Invoice => invoice; - /// Info about users mentioned in the other fields. - public override Dictionary Users => users; + } + /// See + [TLDef(0xB425CFE1)] + public sealed partial class Payments_PaymentFormStarGift : Payments_PaymentFormBase + { + public long form_id; + public Invoice invoice; + + public override long FormId => form_id; + public override Invoice Invoice => invoice; } /// Validated user-provided info See @@ -15565,6 +15564,21 @@ namespace TL { public string hash; } + /// See + [TLDef(0x25D8C1D8)] + public sealed partial class InputInvoiceStarGift : InputInvoice + { + public Flags flags; + public InputUserBase user_id; + public long gift_id; + [IfFlag(1)] public TextWithEntities message; + + [Flags] public enum Flags : uint + { + hide_name = 0x1, + has_message = 0x2, + } + } /// Exported invoice deep link See [TLDef(0xAED0CBD9)] @@ -18960,7 +18974,7 @@ namespace TL } /// Represents a Telegram Stars transaction ». See - [TLDef(0xEE7522D5)] + [TLDef(0x0A9EE4C2)] public sealed partial class StarsTransaction : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -18991,6 +19005,7 @@ namespace TL [IfFlag(9)] public MessageMedia[] extended_media; [IfFlag(12)] public int subscription_period; [IfFlag(13)] public int giveaway_post_id; + [IfFlag(14)] public StarGift stargift; [Flags] public enum Flags : uint { @@ -19021,6 +19036,8 @@ namespace TL has_subscription_period = 0x1000, /// Field has a value has_giveaway_post_id = 0x2000, + /// Field has a value + has_stargift = 0x4000, } } @@ -19331,4 +19348,103 @@ namespace TL default_ = 0x1, } } + + /// See + [TLDef(0xAEA174EE)] + public sealed partial class StarGift : IObject + { + public Flags flags; + public long id; + public DocumentBase sticker; + public long stars; + [IfFlag(0)] public int availability_remains; + [IfFlag(0)] public int availability_total; + public long convert_stars; + + [Flags] public enum Flags : uint + { + limited = 0x1, + } + } + + /// See + /// a value means payments.starGiftsNotModified + [TLDef(0x901689EA)] + public sealed partial class Payments_StarGifts : IObject + { + public int hash; + public StarGift[] gifts; + } + + /// See + [TLDef(0xEEA49A6E)] + public sealed partial class UserStarGift : IObject + { + public Flags flags; + [IfFlag(1)] public long from_id; + public DateTime date; + public StarGift gift; + [IfFlag(2)] public TextWithEntities message; + [IfFlag(3)] public int msg_id; + [IfFlag(4)] public long convert_stars; + + [Flags] public enum Flags : uint + { + name_hidden = 0x1, + has_from_id = 0x2, + has_message = 0x4, + has_msg_id = 0x8, + has_convert_stars = 0x10, + unsaved = 0x20, + } + } + + /// See + [TLDef(0x6B65B517)] + public sealed partial class Payments_UserStarGifts : IObject + { + public Flags flags; + public int count; + public UserStarGift[] gifts; + [IfFlag(0)] public string next_offset; + public Dictionary users; + + [Flags] public enum Flags : uint + { + has_next_offset = 0x1, + } + } + + /// See + [TLDef(0x7903E3D9)] + public sealed partial class MessageReportOption : IObject + { + public string text; + public byte[] option; + } + + /// See + public abstract partial class ReportResult : IObject { } + /// See + [TLDef(0xF0E4E0B6)] + public sealed partial class ReportResultChooseOption : ReportResult + { + public string title; + public MessageReportOption[] options; + } + /// See + [TLDef(0x6F09AC31)] + public sealed partial class ReportResultAddComment : ReportResult + { + public Flags flags; + public byte[] option; + + [Flags] public enum Flags : uint + { + optional = 0x1, + } + } + /// See + [TLDef(0x8DB33C4B)] + public sealed partial class ReportResultReported : ReportResult { } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 9939bdb..2ed88ca 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1959,14 +1959,13 @@ namespace TL /// Report a message in a chat for violation of telegram's Terms of Service See Possible codes: 400 (details) /// Peer /// IDs of messages to report - /// Why are these messages being reported /// Comment for report moderation - public static Task Messages_Report(this Client client, InputPeer peer, int[] id, ReportReason reason, string message) + public static Task Messages_Report(this Client client, InputPeer peer, int[] id, byte[] option, string message) => client.Invoke(new Messages_Report { peer = peer, id = id, - reason = reason, + option = option, message = message, }); @@ -5899,7 +5898,6 @@ namespace TL public static Task Payments_SendStarsForm(this Client client, long form_id, InputInvoice invoice) => client.Invoke(new Payments_SendStarsForm { - flags = 0, form_id = form_id, invoice = invoice, }); @@ -5996,6 +5994,40 @@ namespace TL { }); + /// See + /// a null value means payments.starGiftsNotModified + public static Task Payments_GetStarGifts(this Client client, int hash = default) + => client.Invoke(new Payments_GetStarGifts + { + hash = hash, + }); + + /// See + public static Task Payments_GetUserStarGifts(this Client client, InputUserBase user_id, string offset, int limit = int.MaxValue) + => client.Invoke(new Payments_GetUserStarGifts + { + user_id = user_id, + offset = offset, + limit = limit, + }); + + /// See + public static Task Payments_SaveStarGift(this Client client, InputUserBase user_id, int msg_id, bool unsave = false) + => client.Invoke(new Payments_SaveStarGift + { + flags = (Payments_SaveStarGift.Flags)(unsave ? 0x1 : 0), + user_id = user_id, + msg_id = msg_id, + }); + + /// See + public static Task Payments_ConvertStarGift(this Client client, InputUserBase user_id, int msg_id) + => client.Invoke(new Payments_ConvertStarGift + { + user_id = user_id, + msg_id = msg_id, + }); + /// Create a stickerset. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is a custom emoji stickerset. @@ -6960,14 +6992,13 @@ namespace TL /// Report a story. See Possible codes: 400 (details) /// The peer that uploaded the story. /// IDs of the stories to report. - /// Why are these storeis being reported. /// Comment for report moderation - public static Task Stories_Report(this Client client, InputPeer peer, int[] id, ReportReason reason, string message) + public static Task Stories_Report(this Client client, InputPeer peer, int[] id, byte[] option, string message) => client.Invoke(new Stories_Report { peer = peer, id = id, - reason = reason, + option = option, message = message, }); @@ -8769,12 +8800,12 @@ namespace TL.Methods public InputPeer peer; } - [TLDef(0x8953AB4E)] - public sealed partial class Messages_Report : IMethod + [TLDef(0xFC78AF9B)] + public sealed partial class Messages_Report : IMethod { public InputPeer peer; public int[] id; - public ReportReason reason; + public byte[] option; public string message; } @@ -12012,16 +12043,11 @@ namespace TL.Methods } } - [TLDef(0x02BB731D)] + [TLDef(0x7998C914)] public sealed partial class Payments_SendStarsForm : IMethod { - public Flags flags; public long form_id; public InputInvoice invoice; - - [Flags] public enum Flags : uint - { - } } [TLDef(0x25AE8F4A)] @@ -12113,6 +12139,40 @@ namespace TL.Methods [TLDef(0xBD1EFD3E)] public sealed partial class Payments_GetStarsGiveawayOptions : IMethod { } + [TLDef(0xC4563590)] + public sealed partial class Payments_GetStarGifts : IMethod + { + public int hash; + } + + [TLDef(0x5E72C7E1)] + public sealed partial class Payments_GetUserStarGifts : IMethod + { + public InputUserBase user_id; + public string offset; + public int limit; + } + + [TLDef(0x87ACF08E)] + public sealed partial class Payments_SaveStarGift : IMethod + { + public Flags flags; + public InputUserBase user_id; + public int msg_id; + + [Flags] public enum Flags : uint + { + unsave = 0x1, + } + } + + [TLDef(0x0421E027)] + public sealed partial class Payments_ConvertStarGift : IMethod + { + public InputUserBase user_id; + public int msg_id; + } + [TLDef(0x9021AB67)] public sealed partial class Stickers_CreateStickerSet : IMethod { @@ -12904,12 +12964,12 @@ namespace TL.Methods public int id; } - [TLDef(0x1923FA8C)] - public sealed partial class Stories_Report : IMethod + [TLDef(0x19D8EB45)] + public sealed partial class Stories_Report : IMethod { public InputPeer peer; public int[] id; - public ReportReason reason; + public byte[] option; public string message; } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 61ac1cc..a6bd52c 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 = 188; // fetched 19/09/2024 11:16:22 + public const int Version = 189; // fetched 07/10/2024 12:32:56 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -213,6 +213,7 @@ namespace TL [0x41B3E202] = typeof(MessageActionPaymentRefunded), [0x45D5B021] = typeof(MessageActionGiftStars), [0xB00C47A2] = typeof(MessageActionPrizeStars), + [0x9BB3EF44] = typeof(MessageActionStarGift), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -240,7 +241,7 @@ namespace TL [0xACD66C5E] = typeof(PeerSettings), [0xA437C3ED] = typeof(WallPaper), [0xE0804116] = typeof(WallPaperNoFile), - [0xCC997720] = typeof(UserFull), + [0x1F58E369] = typeof(UserFull), [0x145ADE0B] = typeof(Contact), [0xC13E3C50] = typeof(ImportedContact), [0x16D9703B] = typeof(ContactStatus), @@ -758,6 +759,7 @@ namespace TL [0x21E753BC] = typeof(Upload_WebFile), [0xA0058751] = typeof(Payments_PaymentForm), [0x7BF6B15C] = typeof(Payments_PaymentFormStars), + [0xB425CFE1] = typeof(Payments_PaymentFormStarGift), [0xD1451883] = typeof(Payments_ValidatedRequestedInfo), [0x4E5F810D] = typeof(Payments_PaymentResult), [0xD8411139] = typeof(Payments_PaymentVerificationNeeded), @@ -1090,6 +1092,7 @@ namespace TL [0x98986C0D] = typeof(InputInvoicePremiumGiftCode), [0x65F00CE3] = typeof(InputInvoiceStars), [0x34E793F1] = typeof(InputInvoiceChatInviteSubscription), + [0x25D8C1D8] = typeof(InputInvoiceStarGift), [0xAED0CBD9] = typeof(Payments_ExportedInvoice), [0xCFB9D957] = typeof(Messages_TranscribedAudio), [0x5334759C] = typeof(Help_PremiumPromo), @@ -1305,7 +1308,7 @@ namespace TL [0xD80DA15D] = typeof(StarsTransactionPeer), [0x60682812] = typeof(StarsTransactionPeerAds), [0x0BD915C0] = typeof(StarsTopupOption), - [0xEE7522D5] = typeof(StarsTransaction), + [0x0A9EE4C2] = typeof(StarsTransaction), [0xBBFA316C] = typeof(Payments_StarsStatus), [0xE87ACBC0] = typeof(FoundStory), [0xE2DE7737] = typeof(Stories_FoundStories), @@ -1324,6 +1327,15 @@ namespace TL [0x4BA3A95A] = typeof(MessageReactor), [0x94CE852A] = typeof(StarsGiveawayOption), [0x54236209] = typeof(StarsGiveawayWinnersOption), + [0xAEA174EE] = typeof(StarGift), + [0xA388A368] = null,//Payments_StarGiftsNotModified + [0x901689EA] = typeof(Payments_StarGifts), + [0xEEA49A6E] = typeof(UserStarGift), + [0x6B65B517] = typeof(Payments_UserStarGifts), + [0x7903E3D9] = typeof(MessageReportOption), + [0xF0E4E0B6] = typeof(ReportResultChooseOption), + [0x6F09AC31] = typeof(ReportResultAddComment), + [0x8DB33C4B] = typeof(ReportResultReported), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), @@ -1452,6 +1464,7 @@ namespace TL [typeof(Help_TimezonesList)] = 0x970708CC, //help.timezonesListNotModified [typeof(Messages_QuickReplies)] = 0x5F91EB5B, //messages.quickRepliesNotModified [typeof(Messages_AvailableEffects)] = 0xD1ED9A5B, //messages.availableEffectsNotModified + [typeof(Payments_StarGifts)] = 0xA388A368, //payments.starGiftsNotModified [typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty }; } diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index c8fd8b3..b9d0dea 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,7 +13,7 @@ WTelegramClient 0.0.0 Wizou - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 188 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 189 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A"))