From 6fb59286bde7fc8641c93f31ea01bf32c87db2fd Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 1 May 2025 12:17:06 +0200 Subject: [PATCH 01/54] API Layer 202: E2E group calls https://core.telegram.org/api/end-to-end/group-calls --- README.md | 2 +- src/TL.Schema.cs | 117 ++++++++++++--------- src/TL.SchemaFuncs.cs | 210 ++++++++++++++++++++++++++++--------- src/TL.Table.cs | 20 ++-- src/WTelegramClient.csproj | 2 +- 5 files changed, 242 insertions(+), 109 deletions(-) diff --git a/README.md b/README.md index 32a183d..d2aadf3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-201-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-202-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 424006f..58a7de8 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -692,7 +692,7 @@ namespace TL /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Livestream info - public InputGroupCall call; + public InputGroupCallBase call; /// Timestamp in milliseconds public long time_ms; /// Specifies the duration of the video segment to fetch in milliseconds, by bitshifting 1000 to the right scale times: duration_ms := 1000 >> scale @@ -1262,7 +1262,7 @@ namespace TL /// Peer folder ID, for more info click here public virtual int Folder => default; /// Group call information - public virtual InputGroupCall Call => default; + public virtual InputGroupCallBase Call => default; /// Time-To-Live of messages sent by the current user to this chat public virtual int TtlPeriod => default; /// When using Phone_GetGroupCallJoinAs to get a list of peers that can be used to join a group call, this field indicates the peer that should be selected by default. @@ -1303,7 +1303,7 @@ namespace TL /// Peer folder ID, for more info click here [IfFlag(11)] public int folder_id; /// Group call information - [IfFlag(12)] public InputGroupCall call; + [IfFlag(12)] public InputGroupCallBase call; /// Time-To-Live of messages sent by the current user to this chat [IfFlag(14)] public int ttl_period; /// When using Phone_GetGroupCallJoinAs to get a list of peers that can be used to join a group call, this field indicates the peer that should be selected by default. @@ -1370,7 +1370,7 @@ namespace TL /// Peer folder ID, for more info click here public override int Folder => folder_id; /// Group call information - public override InputGroupCall Call => call; + public override InputGroupCallBase Call => call; /// Time-To-Live of messages sent by the current user to this chat public override int TtlPeriod => ttl_period; /// When using Phone_GetGroupCallJoinAs to get a list of peers that can be used to join a group call, this field indicates the peer that should be selected by default. @@ -1447,7 +1447,7 @@ namespace TL /// Latest PTS for this channel public int pts; /// Livestream or group call information - [IfFlag(21)] public InputGroupCall call; + [IfFlag(21)] public InputGroupCallBase call; /// Time-To-Live of messages in this channel or supergroup [IfFlag(24)] public int ttl_period; /// A list of suggested actions for the supergroup admin, see here for more info ». @@ -1606,7 +1606,7 @@ namespace TL /// Peer folder ID, for more info click here public override int Folder => folder_id; /// Livestream or group call information - public override InputGroupCall Call => call; + public override InputGroupCallBase Call => call; /// Time-To-Live of messages in this channel or supergroup public override int TtlPeriod => ttl_period; /// When using Phone_GetGroupCallJoinAs to get a list of peers that can be used to join a group call, this field indicates the peer that should be selected by default. @@ -2548,7 +2548,7 @@ namespace TL /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Group call - public InputGroupCall call; + public InputGroupCallBase call; /// Group call duration [IfFlag(0)] public int duration; @@ -2563,7 +2563,7 @@ namespace TL public sealed partial class MessageActionInviteToGroupCall : MessageAction { /// The group call - public InputGroupCall call; + public InputGroupCallBase call; /// The invited users public long[] users; } @@ -2589,7 +2589,7 @@ namespace TL public sealed partial class MessageActionGroupCallScheduled : MessageAction { /// The group call - public InputGroupCall call; + public InputGroupCallBase call; /// When is this group call scheduled to start public DateTime schedule_date; } @@ -2959,6 +2959,24 @@ namespace TL { public long stars; } + /// See + [TLDef(0x2FFE2F7A)] + public sealed partial class MessageActionConferenceCall : MessageAction + { + public Flags flags; + public long call_id; + [IfFlag(2)] public int duration; + [IfFlag(3)] public Peer[] other_participants; + + [Flags] public enum Flags : uint + { + missed = 0x1, + active = 0x2, + has_duration = 0x4, + has_other_participants = 0x8, + video = 0x10, + } + } /// Chat info. See Derived classes: , public abstract partial class DialogBase : IObject @@ -5124,7 +5142,7 @@ namespace TL public sealed partial class UpdateGroupCallParticipants : Update { /// Group call - public InputGroupCall call; + public InputGroupCallBase call; /// New participant list public GroupCallParticipant[] participants; /// Version @@ -5818,6 +5836,15 @@ namespace TL { public Auth_SentCodeBase sent_code; } + /// See + [TLDef(0xA477288F)] + public sealed partial class UpdateGroupCallChainBlocks : Update + { + public InputGroupCallBase call; + public int sub_chain_id; + public byte[][] blocks; + public int next_offset; + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -10529,11 +10556,11 @@ namespace TL /// The phone call was discarded because the user is busy in another call See [TLDef(0xFAF7E8C9)] public sealed partial class PhoneCallDiscardReasonBusy : PhoneCallDiscardReason { } - /// See - [TLDef(0xAFE2B839)] - public sealed partial class PhoneCallDiscardReasonAllowGroupCall : PhoneCallDiscardReason + /// See + [TLDef(0x9FBBF1F7)] + public sealed partial class PhoneCallDiscardReasonMigrateConferenceCall : PhoneCallDiscardReason { - public byte[] encrypted_key; + public string slug; } /// Represents a json-encoded object See @@ -11232,7 +11259,6 @@ namespace TL public virtual long ParticipantId => default; /// Phone call protocol info public virtual PhoneCallProtocol Protocol => default; - public virtual InputGroupCall ConferenceCall => default; } /// Empty constructor See [TLDef(0x5366C915)] @@ -11245,7 +11271,7 @@ namespace TL public override long ID => id; } /// Incoming phone call See - [TLDef(0xEED42858)] + [TLDef(0xC5226F17)] public sealed partial class PhoneCallWaiting : PhoneCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -11264,7 +11290,6 @@ namespace TL public PhoneCallProtocol protocol; /// When was the phone call received [IfFlag(0)] public DateTime receive_date; - [IfFlag(8)] public InputGroupCall conference_call; [Flags] public enum Flags : uint { @@ -11272,8 +11297,6 @@ namespace TL has_receive_date = 0x1, /// Is this a video call video = 0x40, - /// Field has a value - has_conference_call = 0x100, } /// Call ID @@ -11288,10 +11311,9 @@ namespace TL public override long ParticipantId => participant_id; /// Phone call protocol info public override PhoneCallProtocol Protocol => protocol; - public override InputGroupCall ConferenceCall => conference_call; } /// Requested phone call See - [TLDef(0x45361C63)] + [TLDef(0x14B0ED0C)] public sealed partial class PhoneCallRequested : PhoneCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -11310,14 +11332,11 @@ namespace TL public byte[] g_a_hash; /// Call protocol info to be passed to libtgvoip public PhoneCallProtocol protocol; - [IfFlag(8)] public InputGroupCall conference_call; [Flags] public enum Flags : uint { /// Whether this is a video call video = 0x40, - /// Field has a value - has_conference_call = 0x100, } /// Phone call ID @@ -11332,10 +11351,9 @@ namespace TL public override long ParticipantId => participant_id; /// Call protocol info to be passed to libtgvoip public override PhoneCallProtocol Protocol => protocol; - public override InputGroupCall ConferenceCall => conference_call; } /// An accepted phone call See - [TLDef(0x22FD7181)] + [TLDef(0x3660C311)] public sealed partial class PhoneCallAccepted : PhoneCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -11354,14 +11372,11 @@ namespace TL public byte[] g_b; /// Protocol to use for phone call public PhoneCallProtocol protocol; - [IfFlag(8)] public InputGroupCall conference_call; [Flags] public enum Flags : uint { /// Whether this is a video call video = 0x40, - /// Field has a value - has_conference_call = 0x100, } /// ID of accepted phone call @@ -11376,10 +11391,9 @@ namespace TL public override long ParticipantId => participant_id; /// Protocol to use for phone call public override PhoneCallProtocol Protocol => protocol; - public override InputGroupCall ConferenceCall => conference_call; } /// Phone call See - [TLDef(0x3BA5940C)] + [TLDef(0x30535AF5)] public sealed partial class PhoneCall : PhoneCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -11406,7 +11420,6 @@ namespace TL public DateTime start_date; /// Custom JSON-encoded call parameters to be passed to tgcalls. [IfFlag(7)] public DataJSON custom_parameters; - [IfFlag(8)] public InputGroupCall conference_call; [Flags] public enum Flags : uint { @@ -11416,8 +11429,7 @@ namespace TL video = 0x40, /// Field has a value has_custom_parameters = 0x80, - /// Field has a value - has_conference_call = 0x100, + conference_supported = 0x100, } /// Call ID @@ -11432,10 +11444,9 @@ namespace TL public override long ParticipantId => participant_id; /// Call protocol info to be passed to libtgvoip public override PhoneCallProtocol Protocol => protocol; - public override InputGroupCall ConferenceCall => conference_call; } /// Indicates a discarded phone call See - [TLDef(0xF9D25503)] + [TLDef(0x50CA4DE1)] public sealed partial class PhoneCallDiscarded : PhoneCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -11446,7 +11457,6 @@ namespace TL [IfFlag(0)] public PhoneCallDiscardReason reason; /// Duration of the phone call in seconds [IfFlag(1)] public int duration; - [IfFlag(8)] public InputGroupCall conference_call; [Flags] public enum Flags : uint { @@ -11460,13 +11470,10 @@ namespace TL need_debug = 0x8, /// Whether the call was a video call video = 0x40, - /// Field has a value - has_conference_call = 0x100, } /// Call ID public override long ID => id; - public override InputGroupCall ConferenceCall => conference_call; } /// Phone call connection See Derived classes: , @@ -11904,14 +11911,14 @@ namespace TL public sealed partial class ChannelAdminLogEventActionStartGroupCall : ChannelAdminLogEventAction { /// Group call - public InputGroupCall call; + public InputGroupCallBase call; } /// A group call was terminated See [TLDef(0xDB9F9140)] public sealed partial class ChannelAdminLogEventActionDiscardGroupCall : ChannelAdminLogEventAction { /// The group call that was terminated - public InputGroupCall call; + public InputGroupCallBase call; } /// A group call participant was muted See [TLDef(0xF92424D2)] @@ -14809,7 +14816,7 @@ namespace TL public override long AccessHash => access_hash; } /// Info about a group call or livestream See - [TLDef(0xCDF8D3E3)] + [TLDef(0x553B0BA1)] public sealed partial class GroupCall : GroupCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -14834,7 +14841,7 @@ namespace TL public int unmuted_video_limit; /// Version public int version; - [IfFlag(14)] public long conference_from_call; + [IfFlag(16)] public string invite_link; [Flags] public enum Flags : uint { @@ -14864,8 +14871,10 @@ namespace TL rtmp_stream = 0x1000, /// Whether the listeners list is hidden and cannot be fetched using Phone_GetGroupParticipants. The phone.groupParticipants.count and groupCall.participants_count counters will still include listeners. listeners_hidden = 0x2000, - /// Field has a value - has_conference_from_call = 0x4000, + conference = 0x4000, + creator = 0x8000, + /// Field has a value + has_invite_link = 0x10000, } /// Group call ID @@ -14874,15 +14883,29 @@ namespace TL public override long AccessHash => access_hash; } + /// Indicates a group call See Derived classes: + public abstract partial class InputGroupCallBase : IObject { } /// Points to a specific group call See [TLDef(0xD8AA840F)] - public sealed partial class InputGroupCall : IObject + public sealed partial class InputGroupCall : InputGroupCallBase { /// Group call ID public long id; /// REQUIRED FIELD. See how to obtain it
Group call access hash
public long access_hash; } + ///
See + [TLDef(0xFE06823F)] + public sealed partial class InputGroupCallSlug : InputGroupCallBase + { + public string slug; + } + /// See + [TLDef(0x8C10603F)] + public sealed partial class InputGroupCallInviteMessage : InputGroupCallBase + { + public int msg_id; + } /// Info about a group call participant See [TLDef(0xEBA636FE)] diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index aa0b3db..9a50d76 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -6509,12 +6509,11 @@ namespace TL /// Random ID to avoid resending the same object /// Parameter for E2E encryption key exchange » /// Phone call settings - public static Task Phone_RequestCall(this Client client, InputUserBase user_id, int random_id, byte[] g_a_hash, PhoneCallProtocol protocol, InputGroupCall conference_call = null, bool video = false) + public static Task Phone_RequestCall(this Client client, InputUserBase user_id, int random_id, byte[] g_a_hash, PhoneCallProtocol protocol, bool video = false) => client.Invoke(new Phone_RequestCall { - flags = (Phone_RequestCall.Flags)((conference_call != null ? 0x2 : 0) | (video ? 0x1 : 0)), + flags = (Phone_RequestCall.Flags)(video ? 0x1 : 0), user_id = user_id, - conference_call = conference_call, random_id = random_id, g_a_hash = g_a_hash, protocol = protocol, @@ -6627,21 +6626,22 @@ namespace TL /// Join the group call, presenting yourself as the specified user/channel /// The invitation hash from the invite link », if provided allows speaking in a livestream or muted group chat. /// WebRTC parameters - public static Task Phone_JoinGroupCall(this Client client, InputGroupCall call, InputPeer join_as, DataJSON params_, string invite_hash = null, long? key_fingerprint = null, bool muted = false, bool video_stopped = false) + public static Task Phone_JoinGroupCall(this Client client, InputGroupCallBase call, InputPeer join_as, DataJSON params_, string invite_hash = null, Int256? public_key = null, byte[] block = null, bool muted = false, bool video_stopped = false) => client.Invoke(new Phone_JoinGroupCall { - flags = (Phone_JoinGroupCall.Flags)((invite_hash != null ? 0x2 : 0) | (key_fingerprint != null ? 0x8 : 0) | (muted ? 0x1 : 0) | (video_stopped ? 0x4 : 0)), + flags = (Phone_JoinGroupCall.Flags)((invite_hash != null ? 0x2 : 0) | (public_key != null ? 0x8 : 0) | (block != null ? 0x8 : 0) | (muted ? 0x1 : 0) | (video_stopped ? 0x4 : 0)), call = call, join_as = join_as, invite_hash = invite_hash, - key_fingerprint = key_fingerprint ?? default, + public_key = public_key ?? default, + block = block, params_ = params_, }); /// Leave a group call See Possible codes: 400 (details) /// The group call /// Your source ID - public static Task Phone_LeaveGroupCall(this Client client, InputGroupCall call, int source) + public static Task Phone_LeaveGroupCall(this Client client, InputGroupCallBase call, int source) => client.Invoke(new Phone_LeaveGroupCall { call = call, @@ -6651,7 +6651,7 @@ namespace TL /// Invite a set of users to a group call. See Possible codes: 400,403 (details) /// The group call /// The users to invite. - public static Task Phone_InviteToGroupCall(this Client client, InputGroupCall call, params InputUserBase[] users) + public static Task Phone_InviteToGroupCall(this Client client, InputGroupCallBase call, params InputUserBase[] users) => client.Invoke(new Phone_InviteToGroupCall { call = call, @@ -6660,7 +6660,7 @@ namespace TL /// Terminate a group call See Possible codes: 400,403 (details) /// The group call to terminate - public static Task Phone_DiscardGroupCall(this Client client, InputGroupCall call) + public static Task Phone_DiscardGroupCall(this Client client, InputGroupCallBase call) => client.Invoke(new Phone_DiscardGroupCall { call = call, @@ -6670,7 +6670,7 @@ namespace TL /// Invalidate existing invite links /// Group call /// Whether all users will that join this group call are muted by default upon joining the group call - public static Task Phone_ToggleGroupCallSettings(this Client client, InputGroupCall call, bool? join_muted = default, bool reset_invite_hash = false) + public static Task Phone_ToggleGroupCallSettings(this Client client, InputGroupCallBase call, bool? join_muted = default, bool reset_invite_hash = false) => client.Invoke(new Phone_ToggleGroupCallSettings { flags = (Phone_ToggleGroupCallSettings.Flags)((join_muted != default ? 0x1 : 0) | (reset_invite_hash ? 0x2 : 0)), @@ -6681,7 +6681,7 @@ namespace TL /// Get info about a group call See Possible codes: 400,403 (details) /// The group call /// Maximum number of results to return, see pagination - public static Task Phone_GetGroupCall(this Client client, InputGroupCall call, int limit = int.MaxValue) + public static Task Phone_GetGroupCall(this Client client, InputGroupCallBase call, int limit = int.MaxValue) => client.Invoke(new Phone_GetGroupCall { call = call, @@ -6694,7 +6694,7 @@ namespace TL /// If specified, will fetch group participant info about the specified WebRTC source IDs /// Offset for results, taken from the next_offset field of , initially an empty string.
Note: if no more results are available, the method call will return an empty next_offset; thus, avoid providing the next_offset returned in if it is empty, to avoid an infinite loop. /// Maximum number of results to return, see pagination - public static Task Phone_GetGroupParticipants(this Client client, InputGroupCall call, InputPeer[] ids, int[] sources, string offset, int limit = int.MaxValue) + public static Task Phone_GetGroupParticipants(this Client client, InputGroupCallBase call, InputPeer[] ids, int[] sources, string offset, int limit = int.MaxValue) => client.Invoke(new Phone_GetGroupParticipants { call = call, @@ -6707,7 +6707,7 @@ namespace TL /// Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs.
Returns an intersection of the source IDs specified in sources, and the source IDs currently being forwarded by the SFU. See Possible codes: 400 (details)
/// Group call /// Source IDs - public static Task Phone_CheckGroupCall(this Client client, InputGroupCall call, params int[] sources) + public static Task Phone_CheckGroupCall(this Client client, InputGroupCallBase call, params int[] sources) => client.Invoke(new Phone_CheckGroupCall { call = call, @@ -6720,7 +6720,7 @@ namespace TL /// The group call or livestream /// Recording title /// If video stream recording is enabled, whether to record in portrait or landscape mode - public static Task Phone_ToggleGroupCallRecord(this Client client, InputGroupCall call, string title = null, bool? video_portrait = default, bool start = false, bool video = false) + public static Task Phone_ToggleGroupCallRecord(this Client client, InputGroupCallBase call, string title = null, bool? video_portrait = default, bool start = false, bool video = false) => client.Invoke(new Phone_ToggleGroupCallRecord { flags = (Phone_ToggleGroupCallRecord.Flags)((title != null ? 0x2 : 0) | (video_portrait != default ? 0x4 : 0) | (start ? 0x1 : 0) | (video ? 0x4 : 0)), @@ -6738,7 +6738,7 @@ namespace TL /// Start or stop the video stream /// Pause or resume the video stream /// Pause or resume the screen sharing stream - public static Task Phone_EditGroupCallParticipant(this Client client, InputGroupCall call, InputPeer participant, bool? muted = default, int? volume = null, bool? raise_hand = default, bool? video_stopped = default, bool? video_paused = default, bool? presentation_paused = default) + public static Task Phone_EditGroupCallParticipant(this Client client, InputGroupCallBase call, InputPeer participant, bool? muted = default, int? volume = null, bool? raise_hand = default, bool? video_stopped = default, bool? video_paused = default, bool? presentation_paused = default) => client.Invoke(new Phone_EditGroupCallParticipant { flags = (Phone_EditGroupCallParticipant.Flags)((muted != default ? 0x1 : 0) | (volume != null ? 0x2 : 0) | (raise_hand != default ? 0x4 : 0) | (video_stopped != default ? 0x8 : 0) | (video_paused != default ? 0x10 : 0) | (presentation_paused != default ? 0x20 : 0)), @@ -6755,7 +6755,7 @@ namespace TL /// Edit the title of a group call or livestream See Possible codes: 400,403 (details) /// Group call /// New title - public static Task Phone_EditGroupCallTitle(this Client client, InputGroupCall call, string title) + public static Task Phone_EditGroupCallTitle(this Client client, InputGroupCallBase call, string title) => client.Invoke(new Phone_EditGroupCallTitle { call = call, @@ -6773,7 +6773,7 @@ namespace TL /// Get an invite link for a group call or livestream See Possible codes: 400,403 (details) /// For livestreams or muted group chats, if set, users that join using this link will be able to speak without explicitly requesting permission by (for example by raising their hand). /// The group call - public static Task Phone_ExportGroupCallInvite(this Client client, InputGroupCall call, bool can_self_unmute = false) + public static Task Phone_ExportGroupCallInvite(this Client client, InputGroupCallBase call, bool can_self_unmute = false) => client.Invoke(new Phone_ExportGroupCallInvite { flags = (Phone_ExportGroupCallInvite.Flags)(can_self_unmute ? 0x1 : 0), @@ -6783,7 +6783,7 @@ namespace TL /// Subscribe or unsubscribe to a scheduled group call See Possible codes: 400,403 (details) /// Scheduled group call /// Enable or disable subscription - public static Task Phone_ToggleGroupCallStartSubscription(this Client client, InputGroupCall call, bool subscribed) + public static Task Phone_ToggleGroupCallStartSubscription(this Client client, InputGroupCallBase call, bool subscribed) => client.Invoke(new Phone_ToggleGroupCallStartSubscription { call = call, @@ -6792,7 +6792,7 @@ namespace TL /// Start a scheduled group call. See Possible codes: 400,403 (details) /// The scheduled group call - public static Task Phone_StartScheduledGroupCall(this Client client, InputGroupCall call) + public static Task Phone_StartScheduledGroupCall(this Client client, InputGroupCallBase call) => client.Invoke(new Phone_StartScheduledGroupCall { call = call, @@ -6811,7 +6811,7 @@ namespace TL /// Start screen sharing in a call See Possible codes: 400,403 (details) /// The group call /// WebRTC parameters - public static Task Phone_JoinGroupCallPresentation(this Client client, InputGroupCall call, DataJSON params_) + public static Task Phone_JoinGroupCallPresentation(this Client client, InputGroupCallBase call, DataJSON params_) => client.Invoke(new Phone_JoinGroupCallPresentation { call = call, @@ -6820,7 +6820,7 @@ namespace TL /// Stop screen sharing in a group call See Possible codes: 400 (details) /// The group call - public static Task Phone_LeaveGroupCallPresentation(this Client client, InputGroupCall call) + public static Task Phone_LeaveGroupCallPresentation(this Client client, InputGroupCallBase call) => client.Invoke(new Phone_LeaveGroupCallPresentation { call = call, @@ -6828,7 +6828,7 @@ namespace TL /// Get info about RTMP streams in a group call or livestream.
This method should be invoked to the same group/channel-related DC used for downloading livestream chunks.
As usual, the media DC is preferred, if available. See Possible codes: 400 (details)
/// Group call or livestream - public static Task Phone_GetGroupCallStreamChannels(this Client client, InputGroupCall call) + public static Task Phone_GetGroupCallStreamChannels(this Client client, InputGroupCallBase call) => client.Invoke(new Phone_GetGroupCallStreamChannels { call = call, @@ -6855,11 +6855,58 @@ namespace TL }); /// See - public static Task Phone_CreateConferenceCall(this Client client, InputPhoneCall peer, long key_fingerprint) + public static Task Phone_CreateConferenceCall(this Client client, int random_id, Int256? public_key = null, byte[] block = null, DataJSON params_ = null, bool muted = false, bool video_stopped = false, bool join = false) => client.Invoke(new Phone_CreateConferenceCall { - peer = peer, - key_fingerprint = key_fingerprint, + flags = (Phone_CreateConferenceCall.Flags)((public_key != null ? 0x8 : 0) | (block != null ? 0x8 : 0) | (params_ != null ? 0x8 : 0) | (muted ? 0x1 : 0) | (video_stopped ? 0x4 : 0) | (join ? 0x8 : 0)), + random_id = random_id, + public_key = public_key ?? default, + block = block, + params_ = params_, + }); + + /// See + public static Task Phone_DeleteConferenceCallParticipants(this Client client, InputGroupCallBase call, long[] ids, byte[] block, bool only_left = false, bool kick = false) + => client.Invoke(new Phone_DeleteConferenceCallParticipants + { + flags = (Phone_DeleteConferenceCallParticipants.Flags)((only_left ? 0x1 : 0) | (kick ? 0x2 : 0)), + call = call, + ids = ids, + block = block, + }); + + /// See + public static Task Phone_SendConferenceCallBroadcast(this Client client, InputGroupCallBase call, byte[] block) + => client.Invoke(new Phone_SendConferenceCallBroadcast + { + call = call, + block = block, + }); + + /// See + public static Task Phone_InviteConferenceCallParticipant(this Client client, InputGroupCallBase call, InputUserBase user_id, bool video = false) + => client.Invoke(new Phone_InviteConferenceCallParticipant + { + flags = (Phone_InviteConferenceCallParticipant.Flags)(video ? 0x1 : 0), + call = call, + user_id = user_id, + }); + + /// See + public static Task Phone_DeclineConferenceCallInvite(this Client client, int msg_id) + => client.Invoke(new Phone_DeclineConferenceCallInvite + { + msg_id = msg_id, + }); + + /// See + public static Task Phone_GetGroupCallChainBlocks(this Client client, InputGroupCallBase call, int sub_chain_id, int offset = default, int limit = int.MaxValue) + => client.Invoke(new Phone_GetGroupCallChainBlocks + { + call = call, + sub_chain_id = sub_chain_id, + offset = offset, + limit = limit, }); /// Get localization pack strings See Possible codes: 400 (details) @@ -12964,12 +13011,11 @@ namespace TL.Methods [TLDef(0x55451FA9)] public sealed partial class Phone_GetCallConfig : IMethod { } - [TLDef(0xA6C4600C)] + [TLDef(0x42FF96ED)] public sealed partial class Phone_RequestCall : IMethod { public Flags flags; public InputUserBase user_id; - [IfFlag(1)] public InputGroupCall conference_call; public int random_id; public byte[] g_a_hash; public PhoneCallProtocol protocol; @@ -12977,7 +13023,6 @@ namespace TL.Methods [Flags] public enum Flags : uint { video = 0x1, - has_conference_call = 0x2, } } @@ -13064,14 +13109,15 @@ namespace TL.Methods } } - [TLDef(0xD61E1DF3)] + [TLDef(0x8FB53057)] public sealed partial class Phone_JoinGroupCall : IMethod { public Flags flags; - public InputGroupCall call; + public InputGroupCallBase call; public InputPeer join_as; [IfFlag(1)] public string invite_hash; - [IfFlag(3)] public long key_fingerprint; + [IfFlag(3)] public Int256 public_key; + [IfFlag(3)] public byte[] block; public DataJSON params_; [Flags] public enum Flags : uint @@ -13079,35 +13125,35 @@ namespace TL.Methods muted = 0x1, has_invite_hash = 0x2, video_stopped = 0x4, - has_key_fingerprint = 0x8, + has_public_key = 0x8, } } [TLDef(0x500377F9)] public sealed partial class Phone_LeaveGroupCall : IMethod { - public InputGroupCall call; + public InputGroupCallBase call; public int source; } [TLDef(0x7B393160)] public sealed partial class Phone_InviteToGroupCall : IMethod { - public InputGroupCall call; + public InputGroupCallBase call; public InputUserBase[] users; } [TLDef(0x7A777135)] public sealed partial class Phone_DiscardGroupCall : IMethod { - public InputGroupCall call; + public InputGroupCallBase call; } [TLDef(0x74BBB43D)] public sealed partial class Phone_ToggleGroupCallSettings : IMethod { public Flags flags; - public InputGroupCall call; + public InputGroupCallBase call; [IfFlag(0)] public bool join_muted; [Flags] public enum Flags : uint @@ -13120,14 +13166,14 @@ namespace TL.Methods [TLDef(0x041845DB)] public sealed partial class Phone_GetGroupCall : IMethod { - public InputGroupCall call; + public InputGroupCallBase call; public int limit; } [TLDef(0xC558D8AB)] public sealed partial class Phone_GetGroupParticipants : IMethod { - public InputGroupCall call; + public InputGroupCallBase call; public InputPeer[] ids; public int[] sources; public string offset; @@ -13137,7 +13183,7 @@ namespace TL.Methods [TLDef(0xB59CF977)] public sealed partial class Phone_CheckGroupCall : IMethod { - public InputGroupCall call; + public InputGroupCallBase call; public int[] sources; } @@ -13145,7 +13191,7 @@ namespace TL.Methods public sealed partial class Phone_ToggleGroupCallRecord : IMethod { public Flags flags; - public InputGroupCall call; + public InputGroupCallBase call; [IfFlag(1)] public string title; [IfFlag(2)] public bool video_portrait; @@ -13161,7 +13207,7 @@ namespace TL.Methods public sealed partial class Phone_EditGroupCallParticipant : IMethod { public Flags flags; - public InputGroupCall call; + public InputGroupCallBase call; public InputPeer participant; [IfFlag(0)] public bool muted; [IfFlag(1)] public int volume; @@ -13184,7 +13230,7 @@ namespace TL.Methods [TLDef(0x1CA6AC0A)] public sealed partial class Phone_EditGroupCallTitle : IMethod { - public InputGroupCall call; + public InputGroupCallBase call; public string title; } @@ -13198,7 +13244,7 @@ namespace TL.Methods public sealed partial class Phone_ExportGroupCallInvite : IMethod { public Flags flags; - public InputGroupCall call; + public InputGroupCallBase call; [Flags] public enum Flags : uint { @@ -13209,14 +13255,14 @@ namespace TL.Methods [TLDef(0x219C34E6)] public sealed partial class Phone_ToggleGroupCallStartSubscription : IMethod { - public InputGroupCall call; + public InputGroupCallBase call; public bool subscribed; } [TLDef(0x5680E342)] public sealed partial class Phone_StartScheduledGroupCall : IMethod { - public InputGroupCall call; + public InputGroupCallBase call; } [TLDef(0x575E1F8C)] @@ -13229,20 +13275,20 @@ namespace TL.Methods [TLDef(0xCBEA6BC4)] public sealed partial class Phone_JoinGroupCallPresentation : IMethod { - public InputGroupCall call; + public InputGroupCallBase call; public DataJSON params_; } [TLDef(0x1C50D144)] public sealed partial class Phone_LeaveGroupCallPresentation : IMethod { - public InputGroupCall call; + public InputGroupCallBase call; } [TLDef(0x1AB21940)] public sealed partial class Phone_GetGroupCallStreamChannels : IMethod { - public InputGroupCall call; + public InputGroupCallBase call; } [TLDef(0xDEB3ABBF)] @@ -13259,11 +13305,71 @@ namespace TL.Methods public InputFileBase file; } - [TLDef(0xDFC909AB)] - public sealed partial class Phone_CreateConferenceCall : IMethod + [TLDef(0x7D0444BB)] + public sealed partial class Phone_CreateConferenceCall : IMethod { - public InputPhoneCall peer; - public long key_fingerprint; + public Flags flags; + public int random_id; + [IfFlag(3)] public Int256 public_key; + [IfFlag(3)] public byte[] block; + [IfFlag(3)] public DataJSON params_; + + [Flags] public enum Flags : uint + { + muted = 0x1, + video_stopped = 0x4, + join = 0x8, + } + } + + [TLDef(0x8CA60525)] + public sealed partial class Phone_DeleteConferenceCallParticipants : IMethod + { + public Flags flags; + public InputGroupCallBase call; + public long[] ids; + public byte[] block; + + [Flags] public enum Flags : uint + { + only_left = 0x1, + kick = 0x2, + } + } + + [TLDef(0xC6701900)] + public sealed partial class Phone_SendConferenceCallBroadcast : IMethod + { + public InputGroupCallBase call; + public byte[] block; + } + + [TLDef(0xBCF22685)] + public sealed partial class Phone_InviteConferenceCallParticipant : IMethod + { + public Flags flags; + public InputGroupCallBase call; + public InputUserBase user_id; + + [Flags] public enum Flags : uint + { + video = 0x1, + } + } + + [TLDef(0x3C479971)] + public sealed partial class Phone_DeclineConferenceCallInvite : IMethod + { + public int msg_id; + } + + [TLDef(0xEE9F88A6)] + public sealed partial class Phone_GetGroupCallChainBlocks : IMethod + { + public InputGroupCallBase call; + public int sub_chain_id; + public int offset; + public int limit; } [TLDef(0xF2F2330A)] diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 36011aa..892f37e 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 = 201; // fetched 20/04/2025 01:20:15 + public const int Version = 202; // fetched 01/05/2025 10:01:40 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -217,6 +217,7 @@ namespace TL [0xACDFCB81] = typeof(MessageActionStarGiftUnique), [0xAC1F1FCD] = typeof(MessageActionPaidMessagesRefunded), [0xBCD71419] = typeof(MessageActionPaidMessagesPrice), + [0x2FFE2F7A] = typeof(MessageActionConferenceCall), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -424,6 +425,7 @@ namespace TL [0x283BD312] = typeof(UpdateBotPurchasedPaidMedia), [0x8B725FCE] = typeof(UpdatePaidReactionPrivacy), [0x504AA18F] = typeof(UpdateSentPhoneCode), + [0xA477288F] = typeof(UpdateGroupCallChainBlocks), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -756,7 +758,7 @@ namespace TL [0xE095C1A0] = typeof(PhoneCallDiscardReasonDisconnect), [0x57ADC690] = typeof(PhoneCallDiscardReasonHangup), [0xFAF7E8C9] = typeof(PhoneCallDiscardReasonBusy), - [0xAFE2B839] = typeof(PhoneCallDiscardReasonAllowGroupCall), + [0x9FBBF1F7] = typeof(PhoneCallDiscardReasonMigrateConferenceCall), [0x7D748D04] = typeof(DataJSON), [0xCB296BF8] = typeof(LabeledPrice), [0x049EE584] = typeof(Invoice), @@ -789,11 +791,11 @@ namespace TL [0x32DA9E9C] = typeof(InputStickerSetItem), [0x1E36FDED] = typeof(InputPhoneCall), [0x5366C915] = typeof(PhoneCallEmpty), - [0xEED42858] = typeof(PhoneCallWaiting), - [0x45361C63] = typeof(PhoneCallRequested), - [0x22FD7181] = typeof(PhoneCallAccepted), - [0x3BA5940C] = typeof(PhoneCall), - [0xF9D25503] = typeof(PhoneCallDiscarded), + [0xC5226F17] = typeof(PhoneCallWaiting), + [0x14B0ED0C] = typeof(PhoneCallRequested), + [0x3660C311] = typeof(PhoneCallAccepted), + [0x30535AF5] = typeof(PhoneCall), + [0x50CA4DE1] = typeof(PhoneCallDiscarded), [0x9CC123C7] = typeof(PhoneConnection), [0x635FE375] = typeof(PhoneConnectionWebrtc), [0xFC878FC8] = typeof(PhoneCallProtocol), @@ -1031,8 +1033,10 @@ namespace TL [0xE8FD8014] = typeof(PeerBlocked), [0x7FE91C14] = typeof(Stats_MessageStats), [0x7780BCB4] = typeof(GroupCallDiscarded), - [0xCDF8D3E3] = typeof(GroupCall), + [0x553B0BA1] = typeof(GroupCall), [0xD8AA840F] = typeof(InputGroupCall), + [0xFE06823F] = typeof(InputGroupCallSlug), + [0x8C10603F] = typeof(InputGroupCallInviteMessage), [0xEBA636FE] = typeof(GroupCallParticipant), [0x9E727AAD] = typeof(Phone_GroupCall), [0xF47751B6] = typeof(Phone_GroupParticipants), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 1debd31..a19c731 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: 201 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 202 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From 8836f8372b6a76d747e34867e1e7218c715cb50e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 14 May 2025 18:18:20 +0200 Subject: [PATCH 02/54] API Layer 203: Stargift resale, auto-translation... --- README.md | 2 +- src/TL.Schema.cs | 143 ++++++++++++++++++++++++++++++++++--- src/TL.SchemaFuncs.cs | 67 ++++++++++++++++- src/TL.Table.cs | 24 +++++-- src/WTelegramClient.csproj | 2 +- 5 files changed, 215 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index d2aadf3..557ce41 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-202-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-203-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 58a7de8..c05334e 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1204,6 +1204,7 @@ namespace TL has_bot_verification_icon = 0x2000, /// Field has a value has_send_paid_messages_stars = 0x4000, + autotranslation = 0x8000, } /// ID of the channel, see here » for more info @@ -2923,7 +2924,7 @@ namespace TL } } /// See - [TLDef(0xACDFCB81)] + [TLDef(0x2E3AE60E)] public sealed partial class MessageActionStarGiftUnique : MessageAction { public Flags flags; @@ -2933,6 +2934,9 @@ namespace TL [IfFlag(6)] public Peer from_id; [IfFlag(7)] public Peer peer; [IfFlag(7)] public long saved_id; + [IfFlag(8)] public long resale_stars; + [IfFlag(9)] public int can_transfer_at; + [IfFlag(10)] public int can_resell_at; [Flags] public enum Flags : uint { @@ -2944,6 +2948,9 @@ namespace TL refunded = 0x20, has_from_id = 0x40, has_peer = 0x80, + has_resale_stars = 0x100, + has_can_transfer_at = 0x200, + has_can_resell_at = 0x400, } } /// See @@ -12137,6 +12144,12 @@ namespace TL /// The subscriber that extended the subscription. public ChannelParticipantBase new_participant; } + /// See + [TLDef(0xC517F77E)] + public sealed partial class ChannelAdminLogEventActionToggleAutotranslation : ChannelAdminLogEventAction + { + public bool new_value; + } /// Admin log event See [TLDef(0x1FAD68CD)] @@ -14367,7 +14380,7 @@ namespace TL public DateTime expires; } /// MTProxy/Public Service Announcement information See - [TLDef(0x8C39793F)] + [TLDef(0x08A4D87A)] public sealed partial class Help_PromoData : Help_PromoDataBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -14375,15 +14388,18 @@ namespace TL /// Expiry of PSA/MTProxy info public DateTime expires; /// MTProxy/PSA peer - public Peer peer; - /// Chat info - public Dictionary chats; - /// User info - public Dictionary users; + [IfFlag(3)] public Peer peer; /// PSA type [IfFlag(1)] public string psa_type; /// PSA message [IfFlag(2)] public string psa_message; + public string[] pending_suggestions; + public string[] dismissed_suggestions; + [IfFlag(4)] public PendingSuggestion custom_pending_suggestion; + /// Chat info + public Dictionary chats; + /// User info + public Dictionary users; [Flags] public enum Flags : uint { @@ -14393,6 +14409,10 @@ namespace TL has_psa_type = 0x2, /// Field has a value has_psa_message = 0x4, + /// Field has a value + has_peer = 0x8, + /// Field has a value + has_custom_pending_suggestion = 0x10, } /// returns a or for the result public IPeerInfo UserOrChat => peer?.UserOrChat(users, chats); @@ -15976,6 +15996,13 @@ namespace TL public InputUserBase bot; public long stars; } + /// See + [TLDef(0x63CBC38C)] + public sealed partial class InputInvoiceStarGiftResale : InputInvoice + { + public string slug; + public InputPeer to_id; + } /// Exported invoice deep link See [TLDef(0xAED0CBD9)] @@ -19541,6 +19568,7 @@ namespace TL /// Field has a value has_premium_gift_months = 0x100000, business_transfer = 0x200000, + stargift_resale = 0x400000, } } @@ -19909,9 +19937,10 @@ namespace TL public virtual long ID => default; /// For limited-supply gifts: the total number of gifts that was available in the initial supply. public virtual int AvailabilityTotal => default; + public virtual string Title => default; } /// Represents a star gift, see here » for more info. See - [TLDef(0x02CC73C8)] + [TLDef(0xC62ACA28)] public sealed partial class StarGift : StarGiftBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -19926,6 +19955,7 @@ namespace TL [IfFlag(0)] public int availability_remains; /// For limited-supply gifts: the total number of gifts that was available in the initial supply. [IfFlag(0)] public int availability_total; + [IfFlag(4)] public long availability_resale; /// The receiver of this gift may convert it to this many Telegram Stars, instead of displaying it on their profile page.
convert_stars will be equal to stars only if the gift was bought using recently bought Telegram Stars, otherwise it will be less than stars.
public long convert_stars; /// For sold out gifts only: when was the gift first bought. @@ -19933,6 +19963,8 @@ namespace TL /// For sold out gifts only: when was the gift last bought. [IfFlag(1)] public DateTime last_sale_date; [IfFlag(3)] public long upgrade_stars; + [IfFlag(4)] public long resell_min_stars; + [IfFlag(5)] public string title; [Flags] public enum Flags : uint { @@ -19944,15 +19976,20 @@ namespace TL birthday = 0x4, /// Field has a value has_upgrade_stars = 0x8, + /// Fields and have a value + has_availability_resale = 0x10, + /// Field has a value + has_title = 0x20, } /// Identifier of the gift public override long ID => id; /// For limited-supply gifts: the total number of gifts that was available in the initial supply. public override int AvailabilityTotal => availability_total; + public override string Title => title; } ///
See - [TLDef(0x5C62D151)] + [TLDef(0x6411DB89)] public sealed partial class StarGiftUnique : StarGiftBase { public Flags flags; @@ -19967,6 +20004,7 @@ namespace TL public int availability_issued; public int availability_total; [IfFlag(3)] public string gift_address; + [IfFlag(4)] public long resell_stars; [Flags] public enum Flags : uint { @@ -19974,10 +20012,12 @@ namespace TL has_owner_name = 0x2, has_owner_address = 0x4, has_gift_address = 0x8, + has_resell_stars = 0x10, } public override long ID => id; public override int AvailabilityTotal => availability_total; + public override string Title => title; } /// Available gifts ». See @@ -20272,10 +20312,11 @@ namespace TL public int rarity_permille; } /// See - [TLDef(0x94271762)] + [TLDef(0xD93D859C)] public sealed partial class StarGiftAttributeBackdrop : StarGiftAttribute { public string name; + public int backdrop_id; public int center_color; public int edge_color; public int pattern_color; @@ -20336,7 +20377,7 @@ namespace TL } /// See - [TLDef(0x6056DBA5)] + [TLDef(0xDFDA0499)] public sealed partial class SavedStarGift : IObject { public Flags flags; @@ -20350,6 +20391,8 @@ namespace TL [IfFlag(6)] public long upgrade_stars; [IfFlag(7)] public int can_export_at; [IfFlag(8)] public long transfer_stars; + [IfFlag(13)] public int can_transfer_at; + [IfFlag(14)] public int can_resell_at; [Flags] public enum Flags : uint { @@ -20366,6 +20409,8 @@ namespace TL can_upgrade = 0x400, has_saved_id = 0x800, pinned_to_top = 0x1000, + has_can_transfer_at = 0x2000, + has_can_resell_at = 0x4000, } } @@ -20405,6 +20450,12 @@ namespace TL public InputPeer peer; public long saved_id; } + /// See + [TLDef(0x2085C238)] + public sealed partial class InputSavedStarGiftSlug : InputSavedStarGift + { + public string slug; + } /// See [TLDef(0x84AA3A9C)] @@ -20514,4 +20565,74 @@ namespace TL /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } + + /// See + public abstract partial class StarGiftAttributeId : IObject { } + /// See + [TLDef(0x48AAAE3C)] + public sealed partial class StarGiftAttributeIdModel : StarGiftAttributeId + { + public long document_id; + } + /// See + [TLDef(0x4A162433)] + public sealed partial class StarGiftAttributeIdPattern : StarGiftAttributeId + { + public long document_id; + } + /// See + [TLDef(0x1F01C757)] + public sealed partial class StarGiftAttributeIdBackdrop : StarGiftAttributeId + { + public int backdrop_id; + } + + /// See + [TLDef(0x2EB1B658)] + public sealed partial class StarGiftAttributeCounter : IObject + { + public StarGiftAttributeId attribute; + public int count; + } + + /// See + [TLDef(0x947A12DF)] + public sealed partial class Payments_ResaleStarGifts : IObject, IPeerResolver + { + public Flags flags; + public int count; + public StarGiftBase[] gifts; + [IfFlag(0)] public string next_offset; + [IfFlag(1)] public StarGiftAttribute[] attributes; + [IfFlag(1)] public long attributes_hash; + public Dictionary chats; + [IfFlag(2)] public StarGiftAttributeCounter[] counters; + public Dictionary users; + + [Flags] public enum Flags : uint + { + has_next_offset = 0x1, + has_attributes = 0x2, + has_counters = 0x4, + } + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); + } + + /// See + [TLDef(0xC387C04E)] + public sealed partial class Stories_CanSendStoryCount : IObject + { + public int count_remains; + } + + /// See + [TLDef(0xE7E82E12)] + public sealed partial class PendingSuggestion : IObject + { + public string suggestion; + public TextWithEntities title; + public TextWithEntities description; + public string url; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 9a50d76..e872cc4 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -5587,6 +5587,14 @@ namespace TL send_paid_messages_stars = send_paid_messages_stars, }); + /// See + public static Task Channels_ToggleAutotranslation(this Client client, InputChannelBase channel, bool enabled) + => client.Invoke(new Channels_ToggleAutotranslation + { + channel = channel, + enabled = enabled, + }); + /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) /// The method name /// JSON-serialized method parameters @@ -6367,6 +6375,26 @@ namespace TL purpose = purpose, }); + /// See + public static Task Payments_GetResaleStarGifts(this Client client, long gift_id, string offset, int limit = int.MaxValue, long? attributes_hash = null, StarGiftAttributeId[] attributes = null, bool sort_by_price = false, bool sort_by_num = false) + => client.Invoke(new Payments_GetResaleStarGifts + { + flags = (Payments_GetResaleStarGifts.Flags)((attributes_hash != null ? 0x1 : 0) | (attributes != null ? 0x8 : 0) | (sort_by_price ? 0x2 : 0) | (sort_by_num ? 0x4 : 0)), + attributes_hash = attributes_hash ?? default, + gift_id = gift_id, + attributes = attributes, + offset = offset, + limit = limit, + }); + + /// See + public static Task Payments_UpdateStarGiftPrice(this Client client, InputSavedStarGift stargift, long resell_stars) + => client.Invoke(new Payments_UpdateStarGiftPrice + { + stargift = stargift, + resell_stars = resell_stars, + }); + /// Create a stickerset. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is a custom emoji stickerset. @@ -7193,7 +7221,7 @@ namespace TL /// Check whether we can post stories as the specified peer. See Possible codes: 400 (details) /// The peer from which we wish to post stories. - public static Task Stories_CanSendStory(this Client client, InputPeer peer) + public static Task Stories_CanSendStory(this Client client, InputPeer peer) => client.Invoke(new Stories_CanSendStory { peer = peer, @@ -12224,6 +12252,13 @@ namespace TL.Methods public long send_paid_messages_stars; } + [TLDef(0x167FC0A1)] + public sealed partial class Channels_ToggleAutotranslation : IMethod + { + public InputChannelBase channel; + public bool enabled; + } + [TLDef(0xAA2769ED)] public sealed partial class Bots_SendCustomRequest : IMethod { @@ -12903,6 +12938,32 @@ namespace TL.Methods public InputStorePaymentPurpose purpose; } + [TLDef(0x7A5FA236)] + public sealed partial class Payments_GetResaleStarGifts : IMethod + { + public Flags flags; + [IfFlag(0)] public long attributes_hash; + public long gift_id; + [IfFlag(3)] public StarGiftAttributeId[] attributes; + public string offset; + public int limit; + + [Flags] public enum Flags : uint + { + has_attributes_hash = 0x1, + sort_by_price = 0x2, + sort_by_num = 0x4, + has_attributes = 0x8, + } + } + + [TLDef(0x3BAEA4E1)] + public sealed partial class Payments_UpdateStarGiftPrice : IMethod + { + public InputSavedStarGift stargift; + public long resell_stars; + } + [TLDef(0x9021AB67)] public sealed partial class Stickers_CreateStickerSet : IMethod { @@ -13604,8 +13665,8 @@ namespace TL.Methods public InputPeer[] peers; } - [TLDef(0xC7DFDFDD)] - public sealed partial class Stories_CanSendStory : IMethod + [TLDef(0x30EB63F0)] + public sealed partial class Stories_CanSendStory : IMethod { public InputPeer peer; } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 892f37e..8e52198 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 = 202; // fetched 01/05/2025 10:01:40 + public const int Version = 203; // fetched 14/05/2025 16:07:47 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -214,7 +214,7 @@ namespace TL [0x45D5B021] = typeof(MessageActionGiftStars), [0xB00C47A2] = typeof(MessageActionPrizeStars), [0x4717E8A4] = typeof(MessageActionStarGift), - [0xACDFCB81] = typeof(MessageActionStarGiftUnique), + [0x2E3AE60E] = typeof(MessageActionStarGiftUnique), [0xAC1F1FCD] = typeof(MessageActionPaidMessagesRefunded), [0xBCD71419] = typeof(MessageActionPaidMessagesPrice), [0x2FFE2F7A] = typeof(MessageActionConferenceCall), @@ -859,6 +859,7 @@ namespace TL [0x46D840AB] = typeof(ChannelAdminLogEventActionChangeEmojiStickerSet), [0x60A79C79] = typeof(ChannelAdminLogEventActionToggleSignatureProfiles), [0x64642DB3] = typeof(ChannelAdminLogEventActionParticipantSubExtend), + [0xC517F77E] = typeof(ChannelAdminLogEventActionToggleAutotranslation), [0x1FAD68CD] = typeof(ChannelAdminLogEvent), [0xED8AF74D] = typeof(Channels_AdminLogResults), [0xEA107AE4] = typeof(ChannelAdminLogEventsFilter), @@ -1011,7 +1012,7 @@ namespace TL [0x8EA464B6] = typeof(StatsGraph), [0x396CA5FC] = typeof(Stats_BroadcastStats), [0x98F6AC75] = typeof(Help_PromoDataEmpty), - [0x8C39793F] = typeof(Help_PromoData), + [0x08A4D87A] = typeof(Help_PromoData), [0xDE33B094] = typeof(VideoSize), [0xF85C413C] = typeof(VideoSizeEmojiMarkup), [0x0DA082FE] = typeof(VideoSizeStickerMarkup), @@ -1116,6 +1117,7 @@ namespace TL [0x4A5F5BD9] = typeof(InputInvoiceStarGiftTransfer), [0xDABAB2EF] = typeof(InputInvoicePremiumGiftStars), [0xF4997E42] = typeof(InputInvoiceBusinessBotTransferStars), + [0x63CBC38C] = typeof(InputInvoiceStarGiftResale), [0xAED0CBD9] = typeof(Payments_ExportedInvoice), [0xCFB9D957] = typeof(Messages_TranscribedAudio), [0x5334759C] = typeof(Help_PremiumPromo), @@ -1353,8 +1355,8 @@ namespace TL [0x4BA3A95A] = typeof(MessageReactor), [0x94CE852A] = typeof(StarsGiveawayOption), [0x54236209] = typeof(StarsGiveawayWinnersOption), - [0x02CC73C8] = typeof(StarGift), - [0x5C62D151] = typeof(StarGiftUnique), + [0xC62ACA28] = typeof(StarGift), + [0x6411DB89] = typeof(StarGiftUnique), [0xA388A368] = null,//Payments_StarGiftsNotModified [0x901689EA] = typeof(Payments_StarGifts), [0x7903E3D9] = typeof(MessageReportOption), @@ -1375,17 +1377,18 @@ namespace TL [0xF93CD45C] = typeof(BotVerification), [0x39D99013] = typeof(StarGiftAttributeModel), [0x13ACFF19] = typeof(StarGiftAttributePattern), - [0x94271762] = typeof(StarGiftAttributeBackdrop), + [0xD93D859C] = typeof(StarGiftAttributeBackdrop), [0xE0BFF26C] = typeof(StarGiftAttributeOriginalDetails), [0x167BD90B] = typeof(Payments_StarGiftUpgradePreview), [0x62D706B8] = typeof(Users_Users), [0x315A4974] = typeof(Users_UsersSlice), [0xCAA2F60B] = typeof(Payments_UniqueStarGift), [0xB53E8B21] = typeof(Messages_WebPagePreview), - [0x6056DBA5] = typeof(SavedStarGift), + [0xDFDA0499] = typeof(SavedStarGift), [0x95F389B1] = typeof(Payments_SavedStarGifts), [0x69279795] = typeof(InputSavedStarGiftUser), [0xF101AA7F] = typeof(InputSavedStarGiftChat), + [0x2085C238] = typeof(InputSavedStarGiftSlug), [0x84AA3A9C] = typeof(Payments_StarGiftWithdrawalUrl), [0x206AD49E] = null,//PaidReactionPrivacyDefault [0x1F0C1AD9] = typeof(PaidReactionPrivacyAnonymous), @@ -1399,6 +1402,13 @@ namespace TL [0xC69708D3] = typeof(SponsoredPeer), [0xEA32B4B1] = null,//Contacts_SponsoredPeersEmpty [0xEB032884] = typeof(Contacts_SponsoredPeers), + [0x48AAAE3C] = typeof(StarGiftAttributeIdModel), + [0x4A162433] = typeof(StarGiftAttributeIdPattern), + [0x1F01C757] = typeof(StarGiftAttributeIdBackdrop), + [0x2EB1B658] = typeof(StarGiftAttributeCounter), + [0x947A12DF] = typeof(Payments_ResaleStarGifts), + [0xC387C04E] = typeof(Stories_CanSendStoryCount), + [0xE7E82E12] = typeof(PendingSuggestion), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index a19c731..2a71dd9 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: 202 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 203 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From 5358471574404a4103c386a9c5bc18c4fec25fcc Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 2 Jun 2025 02:41:06 +0200 Subject: [PATCH 03/54] Fix fields serialization order on KeyboardButtonSimpleWebView --- generator/MTProtoGenerator.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/generator/MTProtoGenerator.cs b/generator/MTProtoGenerator.cs index 5cc7719..4fd169d 100644 --- a/generator/MTProtoGenerator.cs +++ b/generator/MTProtoGenerator.cs @@ -54,7 +54,6 @@ public class MTProtoGenerator : IIncrementalGenerator var tldef = symbol.GetAttributes().FirstOrDefault(a => a.AttributeClass == tlDefAttribute); if (tldef == null) continue; var id = (uint)tldef.ConstructorArguments[0].Value; - var inheritBefore = (bool?)tldef.NamedArguments.FirstOrDefault(k => k.Key == "inheritBefore").Value.Value ?? false; StringBuilder writeTl = new(), readTL = new(); var ns = symbol.BaseType.ContainingNamespace.ToString(); var name = symbol.BaseType.Name; @@ -105,8 +104,12 @@ public class MTProtoGenerator : IIncrementalGenerator .AppendLine($"\t\t\twriter.Write(0x{id:X8});"); var members = symbol.GetMembers().ToList(); for (var parent = symbol.BaseType; parent != object_; parent = parent.BaseType) + { + var inheritBefore = (bool?)tldef.NamedArguments.FirstOrDefault(k => k.Key == "inheritBefore").Value.Value ?? false; if (inheritBefore) members.InsertRange(0, parent.GetMembers()); else members.AddRange(parent.GetMembers()); + tldef = parent.GetAttributes().FirstOrDefault(a => a.AttributeClass == tlDefAttribute); + } foreach (var member in members.OfType()) { if (member.DeclaredAccessibility != Accessibility.Public || member.IsStatic) continue; From d49d620eddc35aff6570879c5e9f0984f669cc4c Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 24 Jun 2025 19:01:52 +0200 Subject: [PATCH 04/54] Fixed possible concurrency issue on msgId/seqno, that could freeze protocol or cause BadMsgNotification (during downloads for example) Thanks goes to @Deeps00009 --- src/Client.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 74e0b7a..222c6f6 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1430,8 +1430,11 @@ namespace WTelegram int seqno; long msgId = DateTime.UtcNow.Ticks + _dcSession.serverTicksOffset - 621355968000000000L; msgId = msgId * 428 + (msgId >> 24) * 25110956; // approximately unixtime*2^32 and divisible by 4 - if (msgId <= _dcSession.lastSentMsgId) msgId = _dcSession.lastSentMsgId += 4; else _dcSession.lastSentMsgId = msgId; - seqno = isContent ? _dcSession.seqno++ * 2 + 1 : _dcSession.seqno * 2; + lock (_session) + { + if (msgId <= _dcSession.lastSentMsgId) msgId = _dcSession.lastSentMsgId += 4; else _dcSession.lastSentMsgId = msgId; + seqno = isContent ? _dcSession.seqno++ * 2 + 1 : _dcSession.seqno * 2; + } return (msgId, seqno); } From 04e043222e7ab7f888727f77c9d6f7bb21c0b314 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 24 Jun 2025 19:11:14 +0200 Subject: [PATCH 05/54] ParallelTransfers property can configure how many parallel download/upload of file chunks can occur at the same time. Default is 2 (optimal for non-premium accounts), was 10 in previous versions. --- src/Client.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 222c6f6..fa8f430 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -59,6 +59,18 @@ namespace WTelegram public long UserId => _session.UserId; /// Info about the current logged-in user. This is only filled after a successful (re)login, not updated later public User User { get; private set; } + /// Number of parallel transfers operations (uploads/downloads) allowed at the same time. + /// Don't use this property while transfers are ongoing! + public int ParallelTransfers + { + get => _parallelTransfers.CurrentCount; + set + { + int delta = value - _parallelTransfers.CurrentCount; + for (; delta < 0; delta++) _parallelTransfers.Wait(); + if (delta > 0) _parallelTransfers.Release(delta); + } + } private Func _config; private readonly Session _session; @@ -83,7 +95,7 @@ namespace WTelegram private int _reactorReconnects = 0; private const string ConnectionShutDown = "Could not read payload length : Connection shut down"; private const long Ticks5Secs = 5 * TimeSpan.TicksPerSecond; - private readonly SemaphoreSlim _parallelTransfers = new(10); // max parallel part uploads/downloads + private readonly SemaphoreSlim _parallelTransfers = new(2); // max parallel part uploads/downloads private readonly SHA256 _sha256 = SHA256.Create(); private readonly SHA256 _sha256Recv = SHA256.Create(); #if OBFUSCATION @@ -209,7 +221,7 @@ namespace WTelegram if (_tcpClient != null) throw new InvalidOperationException("Cannot switch to HTTP after TCP connection"); _httpClient = httpClient ?? new(); _httpWait = defaultHttpWait; - while (_parallelTransfers.CurrentCount > 1) _parallelTransfers.Wait(); + ParallelTransfers = 1; } /// Disconnect from Telegram (shouldn't be needed in normal usage) From 3ff1200068394c71e5891ed653d1c249d0d241cf Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 26 Jun 2025 22:02:26 +0200 Subject: [PATCH 06/54] Use signed DcId values (improved logs) --- src/Client.cs | 27 +++++++++++++-------------- src/Session.cs | 2 +- src/TL.cs | 4 ++-- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index fa8f430..40354de 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -325,7 +325,7 @@ namespace WTelegram try { Auth_ExportedAuthorization exported = null; - if (_session.UserId != 0 && IsMainDC && altSession.UserId != _session.UserId && altSession.DcID != _dcSession.DcID) + if (_session.UserId != 0 && IsMainDC && altSession.UserId != _session.UserId && Math.Abs(altSession.DcID) != Math.Abs(_dcSession.DcID)) exported = await this.Auth_ExportAuthorization(Math.Abs(dcId)); await altSession.Client.ConnectAsync(); if (exported != null) @@ -345,16 +345,16 @@ namespace WTelegram return altSession.Client; } - private async Task Reactor(Stream stream, CancellationTokenSource cts) + private async Task Reactor(Stream stream, CancellationToken ct) { const int MinBufferSize = 1024; var data = new byte[MinBufferSize]; - while (!cts.IsCancellationRequested) + while (!ct.IsCancellationRequested) { IObject obj = null; try { - if (await stream.FullReadAsync(data, 4, cts.Token) != 4) + if (await stream.FullReadAsync(data, 4, ct) != 4) throw new WTException(ConnectionShutDown); #if OBFUSCATION _recvCtr.EncryptDecrypt(data, 4); @@ -366,7 +366,7 @@ namespace WTelegram data = new byte[payloadLen]; else if (Math.Max(payloadLen, MinBufferSize) < data.Length / 4) data = new byte[Math.Max(payloadLen, MinBufferSize)]; - if (await stream.FullReadAsync(data, payloadLen, cts.Token) != payloadLen) + if (await stream.FullReadAsync(data, payloadLen, ct) != payloadLen) throw new WTException("Could not read frame data : Connection shut down"); #if OBFUSCATION _recvCtr.EncryptDecrypt(data, payloadLen); @@ -375,14 +375,14 @@ namespace WTelegram } catch (Exception ex) // an exception in RecvAsync is always fatal { - if (cts.IsCancellationRequested) return; + if (ct.IsCancellationRequested) return; bool disconnectedAltDC = !IsMainDC && ex is WTException { Message: ConnectionShutDown } or IOException { InnerException: SocketException }; if (disconnectedAltDC) Helpers.Log(3, $"{_dcSession.DcID}>Alt DC disconnected: {ex.Message}"); else Helpers.Log(5, $"{_dcSession.DcID}>An exception occured in the reactor: {ex}"); var oldSemaphore = _sendSemaphore; - await oldSemaphore.WaitAsync(cts.Token); // prevent any sending while we reconnect + await oldSemaphore.WaitAsync(ct); // prevent any sending while we reconnect var reactorError = new ReactorError { Exception = ex }; try { @@ -599,13 +599,13 @@ namespace WTelegram var ctorNb = reader.ReadUInt32(); if (ctorNb == Layer.RpcResultCtor) { - Helpers.Log(1, $" → {"RpcResult",-38} {MsgIdToStamp(msg.msg_id):u}"); + Helpers.Log(1, $" → {"RpcResult",-38} {MsgIdToStamp(msg.msg_id):u}"); msg.body = ReadRpcResult(reader); } else { var obj = msg.body = reader.ReadTLObject(ctorNb); - Helpers.Log(1, $" → {obj.GetType().Name,-38} {MsgIdToStamp(msg.msg_id):u} {((msg.seq_no & 1) != 0 ? "" : "(svc)")} {((msg.msg_id & 2) == 0 ? "" : "NAR")}"); + Helpers.Log(1, $" → {obj.GetType().Name,-38} {MsgIdToStamp(msg.msg_id):u} {((msg.seq_no & 1) != 0 ? "" : "(svc)")} {((msg.msg_id & 2) == 0 ? "" : "NAR")}"); } } catch (Exception ex) @@ -676,9 +676,9 @@ namespace WTelegram var typeName = result?.GetType().Name; if (MsgIdToStamp(msgId) >= _session.SessionStart) - Helpers.Log(4, $" → {typeName,-37} for unknown msgId #{(short)msgId.GetHashCode():X4}"); + Helpers.Log(4, $" → {typeName,-37} for unknown msgId #{(short)msgId.GetHashCode():X4}"); else - Helpers.Log(1, $" → {typeName,-37} for past msgId #{(short)msgId.GetHashCode():X4}"); + Helpers.Log(1, $" → {typeName,-37} for past msgId #{(short)msgId.GetHashCode():X4}"); } return new RpcResult { req_msg_id = msgId, result = result }; } @@ -889,8 +889,7 @@ namespace WTelegram if (MTProxyUrl != null) { #if OBFUSCATION - if (TLConfig?.test_mode == true) dcId += 10000; - if (_dcSession.DataCenter?.flags.HasFlag(DcOption.Flags.media_only) == true) dcId = -dcId; + if (TLConfig?.test_mode == true) dcId += dcId < 0 ? -10000 : 10000; var parms = HttpUtility.ParseQueryString(MTProxyUrl[MTProxyUrl.IndexOf('?')..]); var server = parms["server"]; int port = int.Parse(parms["port"]); @@ -988,7 +987,7 @@ namespace WTelegram #endif await _networkStream.WriteAsync(preamble, 0, preamble.Length, _cts.Token); - _reactorTask = Reactor(_networkStream, _cts); + _reactorTask = Reactor(_networkStream, _cts.Token); } _sendSemaphore.Release(); diff --git a/src/Session.cs b/src/Session.cs index c12d65a..321c319 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -36,7 +36,7 @@ namespace WTelegram internal long lastSentMsgId; internal bool withoutUpdates; internal Client Client; - internal int DcID => DataCenter?.id ?? 0; + internal int DcID => DataCenter == null ? 0 : DataCenter.flags.HasFlag(TL.DcOption.Flags.media_only) ? -DataCenter.id : DataCenter.id; internal IPEndPoint EndPoint => DataCenter == null ? null : new(IPAddress.Parse(DataCenter.ip_address), DataCenter.port); internal void Renew() { Helpers.Log(3, $"Renewing session on DC {DcID}..."); id = Helpers.RandomLong(); seqno = 0; lastSentMsgId = 0; } public void DisableUpdates(bool disable = true) { if (withoutUpdates != disable) { withoutUpdates = disable; Renew(); } } diff --git a/src/TL.cs b/src/TL.cs index 741bab4..67342ea 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -201,9 +201,9 @@ namespace TL var patchPos = writer.BaseStream.Position; writer.Write(0); // patched below if ((msg.seq_no & 1) != 0) - WTelegram.Helpers.Log(1, $" → {msg.body.GetType().Name.TrimEnd('_'),-38} #{(short)msg.msg_id.GetHashCode():X4}"); + WTelegram.Helpers.Log(1, $" → {msg.body.GetType().Name.TrimEnd('_'),-38} #{(short)msg.msg_id.GetHashCode():X4}"); else - WTelegram.Helpers.Log(1, $" → {msg.body.GetType().Name.TrimEnd('_'),-38}"); + WTelegram.Helpers.Log(1, $" → {msg.body.GetType().Name.TrimEnd('_'),-38}"); writer.WriteTLObject(msg.body); writer.BaseStream.Position = patchPos; writer.Write((int)(writer.BaseStream.Length - patchPos - 4)); // patch bytes field From 25990a8477e6e222c832ed3bfb52a6b8154fb8e8 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 29 Jun 2025 16:01:05 +0200 Subject: [PATCH 07/54] Fix Salts management --- src/Client.cs | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 40354de..f834bd2 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -140,6 +140,7 @@ namespace WTelegram TcpHandler = cloneOf.TcpHandler; MTProxyUrl = cloneOf.MTProxyUrl; PingInterval = cloneOf.PingInterval; + MaxAutoReconnects = cloneOf.MaxAutoReconnects; TLConfig = cloneOf.TLConfig; _dcSession = dcSession; } @@ -561,7 +562,7 @@ namespace WTelegram { var keys = _dcSession.Salts.Keys; if (keys[^1] == DateTime.MaxValue) return; // GetFutureSalts ongoing - var now = DateTime.UtcNow.AddTicks(_dcSession.serverTicksOffset); + var now = DateTime.UtcNow.AddTicks(_dcSession.serverTicksOffset - TimeSpan.TicksPerMinute); bool removed = false; for (; keys.Count > 1 && keys[1] < now; _dcSession.OldSalt = _dcSession.Salt, _dcSession.Salt = _dcSession.Salts.Values[0], removed = true) _dcSession.Salts.RemoveAt(0); @@ -742,10 +743,7 @@ namespace WTelegram case MsgsAck msgsAck: break; // we don't do anything with these, for now case BadMsgNotification badMsgNotification: - await _sendSemaphore.WaitAsync(); - bool retryLast = badMsgNotification.bad_msg_id == _dcSession.lastSentMsgId; - var lastSentMsg = _lastSentMsg; - _sendSemaphore.Release(); + bool retryRpcs = true; var logLevel = badMsgNotification.error_code == 48 ? 2 : 4; Helpers.Log(logLevel, $"BadMsgNotification {badMsgNotification.error_code} for msg #{(short)badMsgNotification.bad_msg_id.GetHashCode():X4}"); switch (badMsgNotification.error_code) @@ -760,7 +758,7 @@ namespace WTelegram case 32: // msg_seqno too low (the server has already received a message with a lower msg_id but with either a higher or an equal and odd seqno) case 33: // msg_seqno too high (similarly, there is a message with a higher msg_id but with either a lower or an equal and odd seqno) if (_dcSession.seqno <= 1) - retryLast = false; + retryRpcs = false; else { await ResetAsync(false, false); @@ -775,25 +773,19 @@ namespace WTelegram CheckSalt(); break; default: - retryLast = false; + retryRpcs = false; break; } - if (retryLast) + if (retryRpcs) { - Rpc prevRequest; lock (_pendingRpcs) - _pendingRpcs.TryGetValue(badMsgNotification.bad_msg_id, out prevRequest); - await SendAsync(lastSentMsg, lastSentMsg is not MsgContainer, prevRequest); - lock (_pendingRpcs) - _pendingRpcs.Remove(badMsgNotification.bad_msg_id); - } - else if (PullPendingRequest(badMsgNotification.bad_msg_id) is Rpc rpc) - { - if (_bareRpc?.msgId == badMsgNotification.bad_msg_id) _bareRpc = null; - rpc.tcs.SetException(new WTException($"BadMsgNotification {badMsgNotification.error_code}")); - } - else + { + foreach (var rpc in _pendingRpcs.Values) + rpc.tcs.TrySetResult(new RpcError { error_code = -503, error_message = $"BadMsgNotification {badMsgNotification.error_code}" }); + _pendingRpcs.Clear(); + } RaiseUpdates(badMsgNotification); + } break; default: RaiseUpdates(obj); From fa90e236e704eec061f2942fb613413417d5d506 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 29 Jun 2025 16:42:27 +0200 Subject: [PATCH 08/54] Helpers to download animated photos (DownloadFileAsync + photo.LargestVideoSize) --- src/Client.Helpers.cs | 12 ++++++++++++ src/TL.Xtended.cs | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index eefcd36..a26210d 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -334,6 +334,18 @@ namespace WTelegram return await DownloadFileAsync(fileLocation, outputStream, photo.dc_id, photoSize.FileSize, progress); } + /// Download an animated photo from Telegram into the outputStream + /// The photo to download + /// Stream to write the file content to. This method does not close/dispose the stream + /// A specific size/version of the animated photo. Use photo.LargestVideoSize to download the largest version of the animated photo + /// (optional) Callback for tracking the progression of the transfer + /// The file type of the photo + public async Task DownloadFileAsync(Photo photo, Stream outputStream, VideoSize videoSize, ProgressCallback progress = null) + { + var fileLocation = photo.ToFileLocation(videoSize); + return await DownloadFileAsync(fileLocation, outputStream, photo.dc_id, videoSize.size, progress); + } + /// Download a document from Telegram into the outputStream /// The document to download /// Stream to write the file content to. This method does not close/dispose the stream diff --git a/src/TL.Xtended.cs b/src/TL.Xtended.cs index 30a2c39..630a370 100644 --- a/src/TL.Xtended.cs +++ b/src/TL.Xtended.cs @@ -348,8 +348,9 @@ namespace TL protected override InputPhoto ToInputPhoto() => new() { id = id, access_hash = access_hash, file_reference = file_reference }; public InputPhotoFileLocation ToFileLocation() => ToFileLocation(LargestPhotoSize); public InputPhotoFileLocation ToFileLocation(PhotoSizeBase photoSize) => new() { id = id, access_hash = access_hash, file_reference = file_reference, thumb_size = photoSize.Type }; - public InputDocumentFileLocation ToFileLocation(VideoSize videoSize) => new() { id = id, access_hash = access_hash, file_reference = file_reference, thumb_size = videoSize.type }; + public InputPhotoFileLocation ToFileLocation(VideoSize videoSize) => new() { id = id, access_hash = access_hash, file_reference = file_reference, thumb_size = videoSize.type }; public PhotoSizeBase LargestPhotoSize => sizes.Aggregate((agg, next) => (long)next.Width * next.Height > (long)agg.Width * agg.Height ? next : agg); + public VideoSize LargestVideoSize => video_sizes?.OfType().DefaultIfEmpty().Aggregate((agg, next) => (long)next.w * next.h > (long)agg.w * agg.h ? next : agg); } partial class PhotoSizeBase From 4f7954db6153eae5ead0b547df140c9bae9579a9 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 24 Jun 2025 19:25:30 +0200 Subject: [PATCH 09/54] API Layer 204: Channel DMs (MonoForum), Forum Tabs, Saved peer/dialog stuff... (for the very latest layers, go to https://patreon.com/wizou) --- README.md | 2 +- src/TL.Schema.cs | 106 +++++++++++++++++++++--- src/TL.SchemaFuncs.cs | 164 ++++++++++++++++++++++++++++++------- src/TL.Table.cs | 20 +++-- src/WTelegramClient.csproj | 5 +- 5 files changed, 245 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 557ce41..84117c0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-203-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-204-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 c05334e..0208090 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1074,7 +1074,7 @@ namespace TL public override string Title => title; } /// Channel/supergroup info See - [TLDef(0x7482147E)] + [TLDef(0xFE685355)] public sealed partial class Channel : ChatBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1119,6 +1119,7 @@ namespace TL [IfFlag(43)] public DateTime subscription_until_date; [IfFlag(45)] public long bot_verification_icon; [IfFlag(46)] public long send_paid_messages_stars; + [IfFlag(50)] public long linked_monoforum_id; [Flags] public enum Flags : uint { @@ -1205,6 +1206,11 @@ namespace TL /// Field has a value has_send_paid_messages_stars = 0x4000, autotranslation = 0x8000, + broadcast_messages_allowed = 0x10000, + monoforum = 0x20000, + /// Field has a value + has_linked_monoforum_id = 0x40000, + forum_tabs = 0x80000, } /// ID of the channel, see here » for more info @@ -2961,10 +2967,16 @@ namespace TL public long stars; } /// See - [TLDef(0xBCD71419)] + [TLDef(0x84B88578)] public sealed partial class MessageActionPaidMessagesPrice : MessageAction { + public Flags flags; public long stars; + + [Flags] public enum Flags : uint + { + broadcast_messages_allowed = 0x1, + } } /// See [TLDef(0x2FFE2F7A)] @@ -4650,7 +4662,7 @@ namespace TL public int max_id; } /// Notifies a change of a message draft. See - [TLDef(0x1B49EC6D)] + [TLDef(0xEDFC111E)] public sealed partial class UpdateDraftMessage : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -4659,6 +4671,7 @@ namespace TL public Peer peer; /// ID of the forum topic to which the draft is associated [IfFlag(0)] public int top_msg_id; + [IfFlag(1)] public Peer saved_peer_id; /// The draft public DraftMessageBase draft; @@ -4666,6 +4679,8 @@ namespace TL { /// Field has a value has_top_msg_id = 0x1, + /// Field has a value + has_saved_peer_id = 0x2, } } /// Some featured stickers were marked as read See @@ -4812,7 +4827,7 @@ namespace TL [TLDef(0xE511996D)] public sealed partial class UpdateFavedStickers : Update { } /// The specified channel/supergroup messages were read See - [TLDef(0xEA29055D)] + [TLDef(0x25F324F7)] public sealed partial class UpdateChannelReadMessagesContents : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -4821,6 +4836,7 @@ namespace TL public long channel_id; /// Forum topic ID. [IfFlag(0)] public int top_msg_id; + [IfFlag(1)] public Peer saved_peer_id; /// IDs of messages that were read public int[] messages; @@ -4828,6 +4844,8 @@ namespace TL { /// Field has a value has_top_msg_id = 0x1, + /// Field has a value + has_saved_peer_id = 0x2, } } /// All contacts were deleted See @@ -4841,18 +4859,21 @@ namespace TL public int available_min_id; } /// The manual unread mark of a chat was changed See - [TLDef(0xE16459C3)] + [TLDef(0xB658F23E)] public sealed partial class UpdateDialogUnreadMark : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The dialog public DialogPeerBase peer; + [IfFlag(1)] public Peer saved_peer_id; [Flags] public enum Flags : uint { /// Was the chat marked or unmarked as read unread = 0x1, + /// Field has a value + has_saved_peer_id = 0x2, } } /// The results of a poll have changed See @@ -5332,7 +5353,7 @@ namespace TL public override (long, int, int) GetMBox() => (-1, qts, 1); } /// New message reactions » are available See - [TLDef(0x5E1B3CB8)] + [TLDef(0x1E297BFA)] public sealed partial class UpdateMessageReactions : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -5343,6 +5364,7 @@ namespace TL public int msg_id; /// Forum topic ID [IfFlag(0)] public int top_msg_id; + [IfFlag(1)] public Peer saved_peer_id; /// Reactions public MessageReactions reactions; @@ -5350,6 +5372,8 @@ namespace TL { /// Field has a value has_top_msg_id = 0x1, + /// Field has a value + has_saved_peer_id = 0x2, } } /// The list of installed attachment menu entries » has changed, use Messages_GetAttachMenuBots to fetch the updated list. See @@ -5852,6 +5876,22 @@ namespace TL public byte[][] blocks; public int next_offset; } + /// See + [TLDef(0x77B0E372)] + public sealed partial class UpdateReadMonoForumInbox : Update + { + public long channel_id; + public Peer saved_peer_id; + public int read_max_id; + } + /// See + [TLDef(0xA4A79376)] + public sealed partial class UpdateReadMonoForumOutbox : Update + { + public long channel_id; + public Peer saved_peer_id; + public int read_max_id; + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -17484,7 +17524,7 @@ namespace TL /// Contains info about a message or story to reply to. See Derived classes: , public abstract partial class InputReplyTo : IObject { } /// Reply to a message. See - [TLDef(0x22C0F6D5)] + [TLDef(0xB07038B0)] public sealed partial class InputReplyToMessage : InputReplyTo { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -17501,6 +17541,7 @@ namespace TL [IfFlag(3)] public MessageEntity[] quote_entities; /// Offset of the message quote_text within the original message (in UTF-16 code units). [IfFlag(4)] public int quote_offset; + [IfFlag(5)] public InputPeer monoforum_peer_id; [Flags] public enum Flags : uint { @@ -17514,6 +17555,8 @@ namespace TL has_quote_entities = 0x8, /// Field has a value has_quote_offset = 0x10, + /// Field has a value + has_monoforum_peer_id = 0x20, } } /// Reply to a story. See @@ -17525,6 +17568,12 @@ namespace TL /// ID of the story to reply to. public int story_id; } + /// See + [TLDef(0x69D66C45)] + public sealed partial class InputReplyToMonoForum : InputReplyTo + { + public InputPeer monoforum_peer_id; + } /// Represents a story deep link. See [TLDef(0x3FC9053B)] @@ -18336,9 +18385,17 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } + /// Represents a saved message dialog ». See Derived classes: + public abstract partial class SavedDialogBase : IObject + { + /// The dialog + public virtual Peer Peer => default; + /// The latest message ID + public virtual int TopMessage => default; + } /// Represents a saved dialog ». See [TLDef(0xBD87CB6C)] - public sealed partial class SavedDialog : IObject + public sealed partial class SavedDialog : SavedDialogBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -18352,13 +18409,40 @@ namespace TL /// Is the dialog pinned pinned = 0x4, } + + /// The dialog + public override Peer Peer => peer; + /// The latest message ID + public override int TopMessage => top_message; + } + /// See + [TLDef(0x64407EA7)] + public sealed partial class MonoForumDialog : SavedDialogBase + { + public Flags flags; + public Peer peer; + public int top_message; + public int read_inbox_max_id; + public int read_outbox_max_id; + public int unread_count; + public int unread_reactions_count; + [IfFlag(1)] public DraftMessageBase draft; + + [Flags] public enum Flags : uint + { + has_draft = 0x2, + unread_mark = 0x8, + } + + public override Peer Peer => peer; + public override int TopMessage => top_message; } /// Represents some saved message dialogs ». See Derived classes: , , public abstract partial class Messages_SavedDialogsBase : IObject { /// Saved message dialogs ». - public virtual SavedDialog[] Dialogs => default; + public virtual SavedDialogBase[] Dialogs => default; /// List of last messages from each saved dialog public virtual MessageBase[] Messages => default; /// Mentioned chats @@ -18371,7 +18455,7 @@ namespace TL public partial class Messages_SavedDialogs : Messages_SavedDialogsBase, IPeerResolver { /// Saved message dialogs ». - public SavedDialog[] dialogs; + public SavedDialogBase[] dialogs; /// List of last messages from each saved dialog public MessageBase[] messages; /// Mentioned chats @@ -18380,7 +18464,7 @@ namespace TL public Dictionary users; /// Saved message dialogs ». - public override SavedDialog[] Dialogs => dialogs; + public override SavedDialogBase[] Dialogs => dialogs; /// List of last messages from each saved dialog public override MessageBase[] Messages => messages; /// Mentioned chats diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index e872cc4..2cc521c 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1972,15 +1972,16 @@ namespace TL /// Scheduled message date for scheduled messages /// Forward the messages as the specified peer /// Add the messages to the specified quick reply shortcut », instead. - public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, int? video_timestamp = null, long? allow_paid_stars = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, bool allow_paid_floodskip = false) + public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, int? video_timestamp = null, long? allow_paid_stars = null, InputReplyTo reply_to = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_ForwardMessages { - flags = (Messages_ForwardMessages.Flags)((top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (video_timestamp != null ? 0x100000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), + flags = (Messages_ForwardMessages.Flags)((top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (video_timestamp != null ? 0x100000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (reply_to != null ? 0x400000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), from_peer = from_peer, id = id, random_id = random_id, to_peer = to_peer, top_msg_id = top_msg_id ?? default, + reply_to = reply_to, schedule_date = schedule_date ?? default, send_as = send_as, quick_reply_shortcut = quick_reply_shortcut, @@ -2978,17 +2979,20 @@ namespace TL /// Manually mark dialog as unread See Possible codes: 400 (details) /// Mark as unread/read /// Dialog - public static Task Messages_MarkDialogUnread(this Client client, InputDialogPeerBase peer, bool unread = false) + public static Task Messages_MarkDialogUnread(this Client client, InputDialogPeerBase peer, InputPeer parent_peer = null, bool unread = false) => client.Invoke(new Messages_MarkDialogUnread { - flags = (Messages_MarkDialogUnread.Flags)(unread ? 0x1 : 0), + flags = (Messages_MarkDialogUnread.Flags)((parent_peer != null ? 0x2 : 0) | (unread ? 0x1 : 0)), + parent_peer = parent_peer, peer = peer, }); /// Get dialogs manually marked as unread See - public static Task Messages_GetDialogUnreadMarks(this Client client) + public static Task Messages_GetDialogUnreadMarks(this Client client, InputPeer parent_peer = null) => client.Invoke(new Messages_GetDialogUnreadMarks { + flags = (Messages_GetDialogUnreadMarks.Flags)(parent_peer != null ? 0x1 : 0), + parent_peer = parent_peer, }); /// Clear all drafts. See @@ -3312,12 +3316,13 @@ namespace TL /// Unpin all pinned messages See [bots: ✓] Possible codes: 400 (details) /// Chat where to unpin /// Forum topic where to unpin - public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer, int? top_msg_id = null) + public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer, int? top_msg_id = null, InputPeer saved_peer_id = null) => client.InvokeAffected(new Messages_UnpinAllMessages { - flags = (Messages_UnpinAllMessages.Flags)(top_msg_id != null ? 0x1 : 0), + flags = (Messages_UnpinAllMessages.Flags)((top_msg_id != null ? 0x1 : 0) | (saved_peer_id != null ? 0x2 : 0)), peer = peer, top_msg_id = top_msg_id ?? default, + saved_peer_id = saved_peer_id, }, peer is InputPeerChannel ipc ? ipc.channel_id : 0); /// This method is only for basic Chat. See Terminology in the README to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Delete a chat See Possible codes: 400 (details)
@@ -3691,12 +3696,13 @@ namespace TL /// Maximum number of results to return, see pagination /// Only return reactions for messages up until this message ID /// Only return reactions for messages starting from this message ID - public static Task Messages_GetUnreadReactions(this Client client, InputPeer peer, int offset_id = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, int? top_msg_id = null) + public static Task Messages_GetUnreadReactions(this Client client, InputPeer peer, int offset_id = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, int? top_msg_id = null, InputPeer saved_peer_id = null) => client.Invoke(new Messages_GetUnreadReactions { - flags = (Messages_GetUnreadReactions.Flags)(top_msg_id != null ? 0x1 : 0), + flags = (Messages_GetUnreadReactions.Flags)((top_msg_id != null ? 0x1 : 0) | (saved_peer_id != null ? 0x2 : 0)), peer = peer, top_msg_id = top_msg_id ?? default, + saved_peer_id = saved_peer_id, offset_id = offset_id, add_offset = add_offset, limit = limit, @@ -3707,12 +3713,13 @@ namespace TL /// Mark message reactions » as read See Possible codes: 400 (details) /// Peer /// Mark as read only reactions to messages within the specified forum topic - public static Task Messages_ReadReactions(this Client client, InputPeer peer, int? top_msg_id = null) + public static Task Messages_ReadReactions(this Client client, InputPeer peer, int? top_msg_id = null, InputPeer saved_peer_id = null) => client.InvokeAffected(new Messages_ReadReactions { - flags = (Messages_ReadReactions.Flags)(top_msg_id != null ? 0x1 : 0), + flags = (Messages_ReadReactions.Flags)((top_msg_id != null ? 0x1 : 0) | (saved_peer_id != null ? 0x2 : 0)), peer = peer, top_msg_id = top_msg_id ?? default, + saved_peer_id = saved_peer_id, }, peer is InputPeerChannel ipc ? ipc.channel_id : 0); /// View and search recently sent media.
This method does not support pagination. See Possible codes: 400 (details)
@@ -4088,10 +4095,11 @@ namespace TL /// Offset peer for pagination /// Number of list elements to be returned /// Hash used for caching, for more info click here - public static Task Messages_GetSavedDialogs(this Client client, DateTime offset_date = default, int offset_id = default, InputPeer offset_peer = null, int limit = int.MaxValue, long hash = default, bool exclude_pinned = false) + public static Task Messages_GetSavedDialogs(this Client client, DateTime offset_date = default, int offset_id = default, InputPeer offset_peer = null, int limit = int.MaxValue, long hash = default, InputPeer parent_peer = null, bool exclude_pinned = false) => client.Invoke(new Messages_GetSavedDialogs { - flags = (Messages_GetSavedDialogs.Flags)(exclude_pinned ? 0x1 : 0), + flags = (Messages_GetSavedDialogs.Flags)((parent_peer != null ? 0x2 : 0) | (exclude_pinned ? 0x1 : 0)), + parent_peer = parent_peer, offset_date = offset_date, offset_id = offset_id, offset_peer = offset_peer, @@ -4108,9 +4116,11 @@ namespace TL /// If a positive value was transferred, the method will return only messages with IDs less than max_id /// If a positive value was transferred, the method will return only messages with IDs more than min_id /// Result hash - public static Task Messages_GetSavedHistory(this Client client, InputPeer peer, int offset_id = default, DateTime offset_date = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, long hash = default) + public static Task Messages_GetSavedHistory(this Client client, InputPeer peer, int offset_id = default, DateTime offset_date = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, long hash = default, InputPeer parent_peer = null) => client.Invoke(new Messages_GetSavedHistory { + flags = (Messages_GetSavedHistory.Flags)(parent_peer != null ? 0x1 : 0), + parent_peer = parent_peer, peer = peer, offset_id = offset_id, offset_date = offset_date, @@ -4126,10 +4136,11 @@ namespace TL /// Maximum ID of message to delete /// Delete all messages newer than this UNIX timestamp /// Delete all messages older than this UNIX timestamp - public static Task Messages_DeleteSavedHistory(this Client client, InputPeer peer, int max_id = default, DateTime? min_date = null, DateTime? max_date = null) + public static Task Messages_DeleteSavedHistory(this Client client, InputPeer peer, int max_id = default, InputPeer parent_peer = null, DateTime? min_date = null, DateTime? max_date = null) => client.InvokeAffected(new Messages_DeleteSavedHistory { - flags = (Messages_DeleteSavedHistory.Flags)((min_date != null ? 0x4 : 0) | (max_date != null ? 0x8 : 0)), + flags = (Messages_DeleteSavedHistory.Flags)((parent_peer != null ? 0x1 : 0) | (min_date != null ? 0x4 : 0) | (max_date != null ? 0x8 : 0)), + parent_peer = parent_peer, peer = peer, max_id = max_id, min_date = min_date ?? default, @@ -4496,6 +4507,24 @@ namespace TL id = id, }); + /// See + public static Task Messages_GetSavedDialogsByID(this Client client, InputPeer[] ids, InputPeer parent_peer = null) + => client.Invoke(new Messages_GetSavedDialogsByID + { + flags = (Messages_GetSavedDialogsByID.Flags)(parent_peer != null ? 0x2 : 0), + parent_peer = parent_peer, + ids = ids, + }); + + /// See + public static Task Messages_ReadSavedHistory(this Client client, InputPeer parent_peer, InputPeer peer, int max_id = default) + => client.Invoke(new Messages_ReadSavedHistory + { + parent_peer = parent_peer, + peer = peer, + max_id = max_id, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -5352,11 +5381,12 @@ namespace TL /// Enable or disable forum functionality in a supergroup. See Possible codes: 400 (details) /// Supergroup ID /// Enable or disable forum functionality - public static Task Channels_ToggleForum(this Client client, InputChannelBase channel, bool enabled) + public static Task Channels_ToggleForum(this Client client, InputChannelBase channel, bool enabled, bool tabs) => client.Invoke(new Channels_ToggleForum { channel = channel, enabled = enabled, + tabs = tabs, }); /// Create a forum topic; requires manage_topics rights. See [bots: ✓] Possible codes: 400,403 (details) @@ -5580,9 +5610,10 @@ namespace TL }); /// See - public static Task Channels_UpdatePaidMessagesPrice(this Client client, InputChannelBase channel, long send_paid_messages_stars) + 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 { + flags = (Channels_UpdatePaidMessagesPrice.Flags)(broadcast_messages_allowed ? 0x1 : 0), channel = channel, send_paid_messages_stars = send_paid_messages_stars, }); @@ -5595,6 +5626,14 @@ namespace TL enabled = enabled, }); + /// See + public static Task Channels_GetMessageAuthor(this Client client, InputChannelBase channel, int id) + => client.Invoke(new Channels_GetMessageAuthor + { + channel = channel, + id = id, + }); + /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) /// The method name /// JSON-serialized method parameters @@ -9238,7 +9277,7 @@ namespace TL.Methods } } - [TLDef(0xBB9FA475)] + [TLDef(0x38F0188C)] public sealed partial class Messages_ForwardMessages : IMethod { public Flags flags; @@ -9247,6 +9286,7 @@ namespace TL.Methods public long[] random_id; public InputPeer to_peer; [IfFlag(9)] public int top_msg_id; + [IfFlag(22)] public InputReplyTo reply_to; [IfFlag(10)] public DateTime schedule_date; [IfFlag(13)] public InputPeer send_as; [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; @@ -9268,6 +9308,7 @@ namespace TL.Methods allow_paid_floodskip = 0x80000, has_video_timestamp = 0x100000, has_allow_paid_stars = 0x200000, + has_reply_to = 0x400000, } } @@ -10131,20 +10172,31 @@ namespace TL.Methods [TLDef(0x1CFF7E08)] public sealed partial class Messages_GetSplitRanges : IMethod { } - [TLDef(0xC286D98F)] + [TLDef(0x8C5006F8)] public sealed partial class Messages_MarkDialogUnread : IMethod { public Flags flags; + [IfFlag(1)] public InputPeer parent_peer; public InputDialogPeerBase peer; [Flags] public enum Flags : uint { unread = 0x1, + has_parent_peer = 0x2, } } - [TLDef(0x22E24E22)] - public sealed partial class Messages_GetDialogUnreadMarks : IMethod { } + [TLDef(0x21202222)] + public sealed partial class Messages_GetDialogUnreadMarks : IMethod + { + public Flags flags; + [IfFlag(0)] public InputPeer parent_peer; + + [Flags] public enum Flags : uint + { + has_parent_peer = 0x1, + } + } [TLDef(0x7E58EE9C)] public sealed partial class Messages_ClearAllDrafts : IMethod { } @@ -10400,16 +10452,18 @@ namespace TL.Methods public int read_max_id; } - [TLDef(0xEE22B9A8)] + [TLDef(0x062DD747)] public sealed partial class Messages_UnpinAllMessages : IMethod { public Flags flags; public InputPeer peer; [IfFlag(0)] public int top_msg_id; + [IfFlag(1)] public InputPeer saved_peer_id; [Flags] public enum Flags : uint { has_top_msg_id = 0x1, + has_saved_peer_id = 0x2, } } @@ -10729,12 +10783,13 @@ namespace TL.Methods } } - [TLDef(0x3223495B)] + [TLDef(0xBD7F90AC)] public sealed partial class Messages_GetUnreadReactions : IMethod { public Flags flags; public InputPeer peer; [IfFlag(0)] public int top_msg_id; + [IfFlag(1)] public InputPeer saved_peer_id; public int offset_id; public int add_offset; public int limit; @@ -10744,19 +10799,22 @@ namespace TL.Methods [Flags] public enum Flags : uint { has_top_msg_id = 0x1, + has_saved_peer_id = 0x2, } } - [TLDef(0x54AA7F8E)] + [TLDef(0x9EC44F93)] public sealed partial class Messages_ReadReactions : IMethod { public Flags flags; public InputPeer peer; [IfFlag(0)] public int top_msg_id; + [IfFlag(1)] public InputPeer saved_peer_id; [Flags] public enum Flags : uint { has_top_msg_id = 0x1, + has_saved_peer_id = 0x2, } } @@ -11056,10 +11114,11 @@ namespace TL.Methods } } - [TLDef(0x5381D21A)] + [TLDef(0x1E91FC99)] public sealed partial class Messages_GetSavedDialogs : IMethod { public Flags flags; + [IfFlag(1)] public InputPeer parent_peer; public DateTime offset_date; public int offset_id; public InputPeer offset_peer; @@ -11069,12 +11128,15 @@ namespace TL.Methods [Flags] public enum Flags : uint { exclude_pinned = 0x1, + has_parent_peer = 0x2, } } - [TLDef(0x3D9A414D)] + [TLDef(0x998AB009)] public sealed partial class Messages_GetSavedHistory : IMethod { + public Flags flags; + [IfFlag(0)] public InputPeer parent_peer; public InputPeer peer; public int offset_id; public DateTime offset_date; @@ -11083,12 +11145,18 @@ namespace TL.Methods public int max_id; public int min_id; public long hash; + + [Flags] public enum Flags : uint + { + has_parent_peer = 0x1, + } } - [TLDef(0x6E98102B)] + [TLDef(0x4DC5085F)] public sealed partial class Messages_DeleteSavedHistory : IMethod { public Flags flags; + [IfFlag(0)] public InputPeer parent_peer; public InputPeer peer; public int max_id; [IfFlag(2)] public DateTime min_date; @@ -11096,6 +11164,7 @@ namespace TL.Methods [Flags] public enum Flags : uint { + has_parent_peer = 0x1, has_min_date = 0x4, has_max_date = 0x8, } @@ -11404,6 +11473,27 @@ namespace TL.Methods } } + [TLDef(0x6F6F9C96)] + public sealed partial class Messages_GetSavedDialogsByID : IMethod + { + public Flags flags; + [IfFlag(1)] public InputPeer parent_peer; + public InputPeer[] ids; + + [Flags] public enum Flags : uint + { + has_parent_peer = 0x2, + } + } + + [TLDef(0xBA4A3B5B)] + public sealed partial class Messages_ReadSavedHistory : IMethod + { + public InputPeer parent_peer; + public InputPeer peer; + public int max_id; + } + [TLDef(0xEDD4882A)] public sealed partial class Updates_GetState : IMethod { } @@ -12053,11 +12143,12 @@ namespace TL.Methods public InputChannelBase channel; } - [TLDef(0xA4298B29)] + [TLDef(0x3FF75734)] public sealed partial class Channels_ToggleForum : IMethod { public InputChannelBase channel; public bool enabled; + public bool tabs; } [TLDef(0xF40C0224)] @@ -12245,11 +12336,17 @@ namespace TL.Methods public int limit; } - [TLDef(0xFC84653F)] + [TLDef(0x4B12327B)] public sealed partial class Channels_UpdatePaidMessagesPrice : IMethod { + public Flags flags; public InputChannelBase channel; public long send_paid_messages_stars; + + [Flags] public enum Flags : uint + { + broadcast_messages_allowed = 0x1, + } } [TLDef(0x167FC0A1)] @@ -12259,6 +12356,13 @@ namespace TL.Methods public bool enabled; } + [TLDef(0xECE2A0E6)] + public sealed partial class Channels_GetMessageAuthor : IMethod + { + public InputChannelBase channel; + public int id; + } + [TLDef(0xAA2769ED)] public sealed partial class Bots_SendCustomRequest : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 8e52198..9cba0d9 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 = 203; // fetched 14/05/2025 16:07:47 + public const int Version = 204; // fetched 04/06/2025 15:07:47 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -136,7 +136,7 @@ namespace TL [0x29562865] = typeof(ChatEmpty), [0x41CBF256] = typeof(Chat), [0x6592A1A7] = typeof(ChatForbidden), - [0x7482147E] = typeof(Channel), + [0xFE685355] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), [0x2633421B] = typeof(ChatFull), [0x52D6806B] = typeof(ChannelFull), @@ -216,7 +216,7 @@ namespace TL [0x4717E8A4] = typeof(MessageActionStarGift), [0x2E3AE60E] = typeof(MessageActionStarGiftUnique), [0xAC1F1FCD] = typeof(MessageActionPaidMessagesRefunded), - [0xBCD71419] = typeof(MessageActionPaidMessagesPrice), + [0x84B88578] = typeof(MessageActionPaidMessagesPrice), [0x2FFE2F7A] = typeof(MessageActionConferenceCall), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), @@ -325,7 +325,7 @@ namespace TL [0xE40370A3] = typeof(UpdateEditMessage), [0x691E9052] = typeof(UpdateInlineBotCallbackQuery), [0xB75F99A9] = typeof(UpdateReadChannelOutbox), - [0x1B49EC6D] = typeof(UpdateDraftMessage), + [0xEDFC111E] = typeof(UpdateDraftMessage), [0x571D2742] = typeof(UpdateReadFeaturedStickers), [0x9A422C20] = typeof(UpdateRecentStickers), [0xA229DD06] = typeof(UpdateConfig), @@ -341,10 +341,10 @@ namespace TL [0x46560264] = typeof(UpdateLangPackTooLong), [0x56022F4D] = typeof(UpdateLangPack), [0xE511996D] = typeof(UpdateFavedStickers), - [0xEA29055D] = typeof(UpdateChannelReadMessagesContents), + [0x25F324F7] = typeof(UpdateChannelReadMessagesContents), [0x7084A7BE] = typeof(UpdateContactsReset), [0xB23FC698] = typeof(UpdateChannelAvailableMessages), - [0xE16459C3] = typeof(UpdateDialogUnreadMark), + [0xB658F23E] = typeof(UpdateDialogUnreadMark), [0xACA1657B] = typeof(UpdateMessagePoll), [0x54C01850] = typeof(UpdateChatDefaultBannedRights), [0x19360DC0] = typeof(UpdateFolderPeers), @@ -378,7 +378,7 @@ namespace TL [0x4D712F2E] = typeof(UpdateBotCommands), [0x7063C3DB] = typeof(UpdatePendingJoinRequests), [0x11DFA986] = typeof(UpdateBotChatInviteRequester), - [0x5E1B3CB8] = typeof(UpdateMessageReactions), + [0x1E297BFA] = typeof(UpdateMessageReactions), [0x17B7A20B] = typeof(UpdateAttachMenuBots), [0x1592B79D] = typeof(UpdateWebViewResultSent), [0x14B85813] = typeof(UpdateBotMenuButton), @@ -426,6 +426,8 @@ namespace TL [0x8B725FCE] = typeof(UpdatePaidReactionPrivacy), [0x504AA18F] = typeof(UpdateSentPhoneCode), [0xA477288F] = typeof(UpdateGroupCallChainBlocks), + [0x77B0E372] = typeof(UpdateReadMonoForumInbox), + [0xA4A79376] = typeof(UpdateReadMonoForumOutbox), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -1211,8 +1213,9 @@ namespace TL [0xBD74CF49] = typeof(StoryViewPublicRepost), [0x59D78FC5] = typeof(Stories_StoryViewsList), [0xDE9EED1D] = typeof(Stories_StoryViews), - [0x22C0F6D5] = typeof(InputReplyToMessage), + [0xB07038B0] = typeof(InputReplyToMessage), [0x5881323A] = typeof(InputReplyToStory), + [0x69D66C45] = typeof(InputReplyToMonoForum), [0x3FC9053B] = typeof(ExportedStoryLink), [0x712E27FD] = typeof(StoriesStealthMode), [0xCFC9E002] = typeof(MediaAreaCoordinates), @@ -1257,6 +1260,7 @@ namespace TL [0xCFCD0F13] = typeof(StoryReactionPublicRepost), [0xAA5F789C] = typeof(Stories_StoryReactionsList), [0xBD87CB6C] = typeof(SavedDialog), + [0x64407EA7] = typeof(MonoForumDialog), [0xF83AE221] = typeof(Messages_SavedDialogs), [0x44BA9DD9] = typeof(Messages_SavedDialogsSlice), [0xC01F6FE8] = typeof(Messages_SavedDialogsNotModified), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 2a71dd9..1c5aa10 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -11,9 +11,10 @@ snupkg true WTelegramClient - 0.0.0 + 0.0.0 + layer.204 Wizou - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 203 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 204 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From bdcf389ed22655dc4defd0ab452e203aa7f36952 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 8 Jul 2025 19:47:44 +0200 Subject: [PATCH 10/54] API Layer 206: ToDo lists, suggested posts, choose TON vs Stars for gifts/transactions, ... (for the very latest layers, go to https://patreon.com/wizou) --- README.md | 2 +- src/TL.Schema.cs | 356 +++++++++++++++++++++++-------------- src/TL.SchemaFuncs.cs | 264 ++++++++++++++++----------- src/TL.Table.cs | 41 +++-- src/WTelegramClient.csproj | 6 +- 5 files changed, 416 insertions(+), 253 deletions(-) diff --git a/README.md b/README.md index 84117c0..838b958 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-204-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-206-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 0208090..367010b 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -507,6 +507,12 @@ namespace TL has_payload = 0x1, } } + /// See + [TLDef(0x9FC55FDE)] + public sealed partial class InputMediaTodo : InputMedia + { + public TodoList todo; + } /// Defines a new group profile photo. See Derived classes: , /// a value means inputChatPhotoEmpty @@ -1394,7 +1400,7 @@ namespace TL public override int ReactionsLimit => reactions_limit; } /// Full info about a channel, supergroup or gigagroup. See - [TLDef(0x52D6806B)] + [TLDef(0xE07429DE)] public sealed partial class ChannelFull : ChatFullBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1485,6 +1491,7 @@ namespace TL [IfFlag(42)] public StickerSet emojiset; [IfFlag(49)] public BotVerification bot_verification; [IfFlag(50)] public int stargifts_count; + [IfFlag(53)] public long send_paid_messages_stars; [Flags] public enum Flags : uint { @@ -1594,6 +1601,8 @@ namespace TL has_stargifts_count = 0x40000, stargifts_available = 0x80000, paid_messages_available = 0x100000, + /// Field has a value + has_send_paid_messages_stars = 0x200000, } /// ID of the channel @@ -1739,6 +1748,8 @@ namespace TL public virtual Peer From => default; /// Peer ID, the chat where this message was sent public virtual Peer Peer => default; + /// Messages fetched from a saved messages dialog » will have peer= and the saved_peer_id flag set to the ID of the saved dialog.
+ public virtual Peer SavedPeer => default; /// Reply information public virtual MessageReplyHeaderBase ReplyTo => default; /// Date of the message @@ -1771,7 +1782,7 @@ namespace TL public override Peer Peer => peer_id; } /// A message See - [TLDef(0xEABCDD4D)] + [TLDef(0x9815CEC8)] public sealed partial class Message : MessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1832,6 +1843,7 @@ namespace TL [IfFlag(35)] public FactCheck factcheck; [IfFlag(37)] public DateTime report_delivery_until_date; [IfFlag(38)] public long paid_message_stars; + [IfFlag(39)] public SuggestedPost suggested_post; [Flags] public enum Flags : uint { @@ -1911,6 +1923,10 @@ namespace TL has_report_delivery_until_date = 0x20, /// Field has a value has_paid_message_stars = 0x40, + /// Field has a value + has_suggested_post = 0x80, + paid_suggested_post_stars = 0x100, + paid_suggested_post_ton = 0x200, } /// ID of the message @@ -1919,6 +1935,8 @@ namespace TL public override Peer From => from_id; /// Peer ID, the chat where this message was sent public override Peer Peer => peer_id; + /// Messages fetched from a saved messages dialog » will have peer= and the saved_peer_id flag set to the ID of the saved dialog.
+ public override Peer SavedPeer => saved_peer_id; /// Reply information public override MessageReplyHeaderBase ReplyTo => reply_to; /// Date of the message @@ -1929,7 +1947,7 @@ namespace TL public override int TtlPeriod => ttl_period; } /// Indicates a service message See - [TLDef(0xD3D28540)] + [TLDef(0x7A800E0A)] public sealed partial class MessageService : MessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1940,6 +1958,7 @@ namespace TL [IfFlag(8)] public Peer from_id; /// Sender of service message public Peer peer_id; + [IfFlag(28)] public Peer saved_peer_id; /// Reply (thread) information [IfFlag(3)] public MessageReplyHeaderBase reply_to; /// Message date @@ -1973,6 +1992,8 @@ namespace TL has_reactions = 0x100000, /// Field has a value has_ttl_period = 0x2000000, + /// Field has a value + has_saved_peer_id = 0x10000000, } /// Message ID @@ -1981,6 +2002,7 @@ namespace TL public override Peer From => from_id; /// Sender of service message public override Peer Peer => peer_id; + public override Peer SavedPeer => saved_peer_id; /// Reply (thread) information public override MessageReplyHeaderBase ReplyTo => reply_to; /// Message date @@ -2311,6 +2333,19 @@ namespace TL /// Either the paid-for media, or super low resolution media previews if the media wasn't purchased yet, see here » for more info. public MessageExtendedMediaBase[] extended_media; } + /// See + [TLDef(0x8A53B014)] + public sealed partial class MessageMediaToDo : MessageMedia + { + public Flags flags; + public TodoList todo; + [IfFlag(0)] public TodoCompletion[] completions; + + [Flags] public enum Flags : uint + { + has_completions = 0x1, + } + } /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , /// a value means messageActionEmpty @@ -2996,6 +3031,70 @@ namespace TL video = 0x10, } } + /// See + [TLDef(0xCC7C5C89)] + public sealed partial class MessageActionTodoCompletions : MessageAction + { + public int[] completed; + public int[] incompleted; + } + /// See + [TLDef(0xC7EDBC83)] + public sealed partial class MessageActionTodoAppendTasks : MessageAction + { + public TodoItem[] list; + } + /// See + [TLDef(0xEE7A1596)] + public sealed partial class MessageActionSuggestedPostApproval : MessageAction + { + public Flags flags; + [IfFlag(2)] public string reject_comment; + [IfFlag(3)] public DateTime schedule_date; + [IfFlag(4)] public StarsAmountBase price; + + [Flags] public enum Flags : uint + { + rejected = 0x1, + balance_too_low = 0x2, + has_reject_comment = 0x4, + has_schedule_date = 0x8, + has_price = 0x10, + } + } + /// See + [TLDef(0x95DDCF69)] + public sealed partial class MessageActionSuggestedPostSuccess : MessageAction + { + public StarsAmountBase price; + } + /// See + [TLDef(0x69F916F8)] + public sealed partial class MessageActionSuggestedPostRefund : MessageAction + { + public Flags flags; + + [Flags] public enum Flags : uint + { + payer_initiated = 0x1, + } + } + /// See + [TLDef(0xA8A3C699)] + public sealed partial class MessageActionGiftTon : MessageAction + { + public Flags flags; + public string currency; + public long amount; + public string crypto_currency; + public long crypto_amount; + [IfFlag(0)] public string transaction_id; + + [Flags] public enum Flags : uint + { + has_transaction_id = 0x1, + } + } /// Chat info. See Derived classes: , public abstract partial class DialogBase : IObject @@ -5787,21 +5886,12 @@ namespace TL /// The reaction. public Reaction reaction; } - /// A new channel ad revenue transaction was made, see here » for more info. See - [TLDef(0xDFD961F5)] - public sealed partial class UpdateBroadcastRevenueTransactions : Update - { - /// Channel - public Peer peer; - /// New ad revenue balance. - public BroadcastRevenueBalances balances; - } /// The current account's Telegram Stars balance » has changed. See [TLDef(0x4E80A379)] public sealed partial class UpdateStarsBalance : Update { /// New balance. - public StarsAmount balance; + public StarsAmountBase balance; } /// A callback button sent via a business connection was pressed, and the button data was sent to the bot that created the button. See [TLDef(0x1EA2FDA7)] @@ -5892,6 +5982,19 @@ namespace TL public Peer saved_peer_id; public int read_max_id; } + /// See + [TLDef(0x9F812B08)] + public sealed partial class UpdateMonoForumNoPaidException : Update + { + public Flags flags; + public long channel_id; + public Peer saved_peer_id; + + [Flags] public enum Flags : uint + { + exception = 0x1, + } + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -7872,6 +7975,9 @@ namespace TL /// Default custom emoji status stickerset for channel statuses See [TLDef(0x49748553)] public sealed partial class InputStickerSetEmojiChannelDefaultStatuses : InputStickerSet { } + /// See + [TLDef(0x1CF671A0)] + public sealed partial class InputStickerSetTonGifts : InputStickerSet { } /// Represents a stickerset (stickerpack) See [TLDef(0x2DD14EDC)] @@ -9893,7 +9999,7 @@ namespace TL } } /// Represents a message draft. See - [TLDef(0x2D65321F)] + [TLDef(0x96EAA5EB)] public sealed partial class DraftMessage : DraftMessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -9910,6 +10016,7 @@ namespace TL public DateTime date; /// A message effect that should be played as specified here ». [IfFlag(7)] public long effect; + [IfFlag(8)] public SuggestedPost suggested_post; [Flags] public enum Flags : uint { @@ -9925,6 +10032,8 @@ namespace TL invert_media = 0x40, /// Field has a value has_effect = 0x80, + /// Field has a value + has_suggested_post = 0x100, } } @@ -13444,6 +13553,7 @@ namespace TL edit_stories = 0x8000, /// If set, allows the admin to delete stories posted by the other admins of the channel. delete_stories = 0x10000, + manage_direct_messages = 0x20000, } } @@ -15354,7 +15464,7 @@ namespace TL public sealed partial class Account_ResetPasswordOk : Account_ResetPasswordResult { } /// A sponsored message. See - [TLDef(0x4D93A990)] + [TLDef(0x7DBF8673)] public sealed partial class SponsoredMessage : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -15381,6 +15491,8 @@ namespace TL [IfFlag(7)] public string sponsor_info; /// If set, contains additional information about the sponsored message to be shown along with the message. [IfFlag(8)] public string additional_info; + [IfFlag(15)] public int min_display_duration; + [IfFlag(15)] public int max_display_duration; [Flags] public enum Flags : uint { @@ -15400,18 +15512,22 @@ namespace TL has_color = 0x2000, /// Field has a value has_media = 0x4000, + /// Fields and have a value + has_min_display_duration = 0x8000, } } /// A set of sponsored messages associated to a channel See /// a value means messages.sponsoredMessagesEmpty - [TLDef(0xC9EE1D87)] + [TLDef(0xFFDA656D)] public sealed partial class Messages_SponsoredMessages : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// If set, specifies the minimum number of messages between shown sponsored messages; otherwise, only one sponsored message must be shown after all ordinary messages. [IfFlag(0)] public int posts_between; + [IfFlag(1)] public int start_delay; + [IfFlag(2)] public int between_delay; /// Sponsored messages public SponsoredMessage[] messages; /// Chats mentioned in the sponsored messages @@ -15423,6 +15539,10 @@ namespace TL { /// Field has a value has_posts_between = 0x1, + /// Field has a value + has_start_delay = 0x2, + /// Field has a value + has_between_delay = 0x4, } /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); @@ -18432,6 +18552,7 @@ namespace TL { has_draft = 0x2, unread_mark = 0x8, + nopaid_messages_exception = 0x10, } public override Peer Peer => peer; @@ -19306,90 +19427,6 @@ namespace TL [TLDef(0xAD798849)] public sealed partial class Channels_SponsoredMessageReportResultReported : Channels_SponsoredMessageReportResult { } - /// Channel revenue ad statistics, see here » for more info. See - [TLDef(0x5407E297)] - public sealed partial class Stats_BroadcastRevenueStats : IObject - { - /// Ad impressions graph - public StatsGraphBase top_hours_graph; - /// Ad revenue graph (in the smallest unit of the cryptocurrency in which revenue is calculated) - public StatsGraphBase revenue_graph; - /// Current balance, current withdrawable balance and overall revenue - public BroadcastRevenueBalances balances; - /// Current conversion rate of the cryptocurrency (not in the smallest unit) in which revenue is calculated to USD - public double usd_rate; - } - - /// Contains the URL to use to withdraw channel ad revenue. See - [TLDef(0xEC659737)] - public sealed partial class Stats_BroadcastRevenueWithdrawalUrl : IObject - { - /// A unique URL to a Fragment page where the user will be able to specify and submit the address of the TON wallet where the funds will be sent. - public string url; - } - - /// A channel ad revenue » transaction. See Derived classes: , , - public abstract partial class BroadcastRevenueTransaction : IObject { } - /// Describes earnings from sponsored messages in a channel in some time frame, see here » for more info. See - [TLDef(0x557E2CC4)] - public sealed partial class BroadcastRevenueTransactionProceeds : BroadcastRevenueTransaction - { - /// Amount in the smallest unit of the cryptocurrency. - public long amount; - /// Start unixtime for the timeframe. - public DateTime from_date; - /// End unixtime for the timeframe. - public DateTime to_date; - } - /// Describes a withdrawal of ad earnings » See - [TLDef(0x5A590978)] - public sealed partial class BroadcastRevenueTransactionWithdrawal : BroadcastRevenueTransaction - { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - /// Amount withdrawn - public long amount; - /// Withdrawal date - public DateTime date; - /// Payment provider name - public string provider; - /// If neither pending nor failed are set, the transaction was completed successfully, and this field will contain the point in time (Unix timestamp) when the withdrawal was completed successfully. - [IfFlag(1)] public DateTime transaction_date; - /// If neither pending nor failed are set, the transaction was completed successfully, and this field will contain a URL where the withdrawal transaction can be viewed. - [IfFlag(1)] public string transaction_url; - - [Flags] public enum Flags : uint - { - /// Whether the withdrawal is currently pending - pending = 0x1, - /// Fields and have a value - has_transaction_date = 0x2, - /// Whether the withdrawal has failed - failed = 0x4, - } - } - /// Describes a refund for failed withdrawal of ad earnings » See - [TLDef(0x42D30D2E)] - public sealed partial class BroadcastRevenueTransactionRefund : BroadcastRevenueTransaction - { - /// Amount refunded. - public long amount; - /// Date of refund. - public DateTime date; - /// Payment provider name. - public string provider; - } - - /// Channel ad revenue transactions ». See - [TLDef(0x87158466)] - public sealed partial class Stats_BroadcastRevenueTransactions : IObject - { - /// Total number of transactions. - public int count; - /// Transactions - public BroadcastRevenueTransaction[] transactions; - } - /// Reaction notification settings See public enum ReactionNotificationsFrom : uint { @@ -19423,26 +19460,6 @@ namespace TL } } - /// Describes channel ad revenue balances ». See - [TLDef(0xC3FF71E7)] - public sealed partial class BroadcastRevenueBalances : IObject - { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - /// Amount of not-yet-withdrawn cryptocurrency. - public long current_balance; - /// Amount of withdrawable cryptocurrency, out of the currently available balance (available_balance <= current_balance). - public long available_balance; - /// Total amount of earned cryptocurrency. - public long overall_revenue; - - [Flags] public enum Flags : uint - { - /// If set, the available balance can be withdrawn ». - withdrawal_enabled = 0x1, - } - } - /// Represents a message effect ». See [TLDef(0x93C3E27E)] public sealed partial class AvailableEffect : IObject @@ -19562,15 +19579,14 @@ namespace TL } /// Represents a Telegram Stars transaction ». See - [TLDef(0xA39FD94A)] + [TLDef(0x13659EB0)] public sealed partial class StarsTransaction : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Transaction ID. public string id; - /// Amount of Stars (negative for outgoing transactions). - public StarsAmount stars; + public StarsAmountBase amount; /// Date of the transaction (unixtime). public DateTime date; /// Source of the incoming transaction, or its recipient for outgoing transactions. @@ -19604,9 +19620,11 @@ namespace TL /// For transactions made by referred users, the peer that received the affiliate commission. [IfFlag(17)] public Peer starref_peer; /// For transactions made by referred users, the amount of Telegram Stars received by the affiliate, can be negative for refunds. - [IfFlag(17)] public StarsAmount starref_amount; + [IfFlag(17)] public StarsAmountBase starref_amount; [IfFlag(19)] public int paid_messages; [IfFlag(20)] public int premium_gift_months; + [IfFlag(23)] public DateTime ads_proceeds_from_date; + [IfFlag(23)] public DateTime ads_proceeds_to_date; [Flags] public enum Flags : uint { @@ -19653,6 +19671,8 @@ namespace TL has_premium_gift_months = 0x100000, business_transfer = 0x200000, stargift_resale = 0x400000, + /// Fields and have a value + has_ads_proceeds_from_date = 0x800000, } } @@ -19663,7 +19683,7 @@ namespace TL /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Current Telegram Star balance. - public StarsAmount balance; + public StarsAmountBase balance; /// Info about current Telegram Star subscriptions, only returned when invoking Payments_GetStarsTransactions and Payments_GetStarsSubscriptions. [IfFlag(1)] public StarsSubscription[] subscriptions; /// Offset for pagination of subscriptions: only usable and returned when invoking Payments_GetStarsSubscriptions. @@ -19765,11 +19785,11 @@ namespace TL /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Amount of not-yet-withdrawn Telegram Stars. - public StarsAmount current_balance; + public StarsAmountBase current_balance; /// Amount of withdrawable Telegram Stars. - public StarsAmount available_balance; + public StarsAmountBase available_balance; /// Total amount of earned Telegram Stars. - public StarsAmount overall_revenue; + public StarsAmountBase overall_revenue; /// Unixtime indicating when will withdrawal be available to the user. If not set, withdrawal can be started now. [IfFlag(1)] public int next_withdrawal_at; @@ -19783,15 +19803,23 @@ namespace TL } /// Star revenue statistics, see here » for more info. See - [TLDef(0xC92BB73B)] + [TLDef(0x6C207376)] public sealed partial class Payments_StarsRevenueStats : IObject { + public Flags flags; + [IfFlag(0)] public StatsGraphBase top_hours_graph; /// Star revenue graph (number of earned stars) public StatsGraphBase revenue_graph; /// Current balance, current withdrawable balance and overall earned Telegram Stars public StarsRevenueStatus status; /// Current conversion rate of Telegram Stars to USD public double usd_rate; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_top_hours_graph = 0x1, + } } /// Contains the URL to use to withdraw Telegram Star revenue. See @@ -20228,7 +20256,7 @@ namespace TL /// Point in time (Unix timestamp) when the affiliate program will be closed (optional, if not set the affiliate program isn't scheduled to be closed) [IfFlag(1)] public DateTime end_date; /// The amount of daily revenue per user in Telegram Stars of the bot that created the affiliate program.
To obtain the approximated revenue per referred user, multiply this value by commission_permille and divide by 1000.
- [IfFlag(2)] public StarsAmount daily_revenue_per_user; + [IfFlag(2)] public StarsAmountBase daily_revenue_per_user; [Flags] public enum Flags : uint { @@ -20305,14 +20333,31 @@ namespace TL } } + ///
Describes a real (i.e. possibly decimal) amount of Telegram Stars. See Derived classes: + public abstract partial class StarsAmountBase : IObject + { + /// The integer amount of Telegram Stars. + public virtual long Amount => default; + } /// Describes a real (i.e. possibly decimal) amount of Telegram Stars. See [TLDef(0xBBB6B4A3)] - public sealed partial class StarsAmount : IObject + public sealed partial class StarsAmount : StarsAmountBase { /// The integer amount of Telegram Stars. public long amount; /// The decimal amount of Telegram Stars, expressed as nanostars (i.e. 1 nanostar is equal to 1/1'000'000'000th of a Telegram Star).
This field may also be negative (the allowed range is -999999999 to 999999999).
public int nanos; + + /// The integer amount of Telegram Stars. + public override long Amount => amount; + } + ///
See + [TLDef(0x74AEE3E0)] + public sealed partial class StarsTonAmount : StarsAmountBase + { + public long amount; + + public override long Amount => amount; } /// Found stickers See Derived classes: , @@ -20719,4 +20764,53 @@ namespace TL public TextWithEntities description; public string url; } + + /// See + [TLDef(0xCBA9A52F)] + public sealed partial class TodoItem : IObject + { + public int id; + public TextWithEntities title; + } + + /// See + [TLDef(0x49B92A26)] + public sealed partial class TodoList : IObject + { + public Flags flags; + public TextWithEntities title; + public TodoItem[] list; + + [Flags] public enum Flags : uint + { + others_can_append = 0x1, + others_can_complete = 0x2, + } + } + + /// See + [TLDef(0x4CC120B7)] + public sealed partial class TodoCompletion : IObject + { + public int id; + public long completed_by; + public DateTime date; + } + + /// See + [TLDef(0x0E8E37E5)] + public sealed partial class SuggestedPost : IObject + { + public Flags flags; + [IfFlag(3)] public StarsAmountBase price; + [IfFlag(0)] public DateTime schedule_date; + + [Flags] public enum Flags : uint + { + has_schedule_date = 0x1, + accepted = 0x2, + rejected = 0x4, + has_price = 0x8, + } + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 2cc521c..0845d54 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1433,18 +1433,21 @@ namespace TL hash = hash, }); - /// See - public static Task Account_AddNoPaidMessagesException(this Client client, InputUserBase user_id, bool refund_charged = false) - => client.Invoke(new Account_AddNoPaidMessagesException + /// See + public static Task Account_GetPaidMessagesRevenue(this Client client, InputUserBase user_id, InputPeer parent_peer = null) + => client.Invoke(new Account_GetPaidMessagesRevenue { - flags = (Account_AddNoPaidMessagesException.Flags)(refund_charged ? 0x1 : 0), + flags = (Account_GetPaidMessagesRevenue.Flags)(parent_peer != null ? 0x1 : 0), + parent_peer = parent_peer, user_id = user_id, }); - /// See - public static Task Account_GetPaidMessagesRevenue(this Client client, InputUserBase user_id) - => client.Invoke(new Account_GetPaidMessagesRevenue + /// See + 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 { + flags = (Account_ToggleNoPaidMessagesException.Flags)((parent_peer != null ? 0x2 : 0) | (refund_charged ? 0x1 : 0) | (require_payment ? 0x4 : 0)), + parent_peer = parent_peer, user_id = user_id, }); @@ -1902,10 +1905,10 @@ namespace TL /// Send this message as the specified peer /// Add the message to the specified quick reply shortcut », instead. /// Specifies a message effect » to use for the message. - public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) + public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, SuggestedPost suggested_post = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_SendMessage { - flags = (Messages_SendMessage.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), + flags = (Messages_SendMessage.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (suggested_post != null ? 0x400000 : 0) | (no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), peer = peer, reply_to = reply_to, message = message, @@ -1917,6 +1920,7 @@ namespace TL quick_reply_shortcut = quick_reply_shortcut, effect = effect ?? default, allow_paid_stars = allow_paid_stars ?? default, + suggested_post = suggested_post, }); /// Send a media See [bots: ✓] Possible codes: 400,403,406,420,500 (details) @@ -1938,10 +1942,10 @@ namespace TL /// Send this message as the specified peer /// Add the message to the specified quick reply shortcut », instead. /// Specifies a message effect » to use for the message. - public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) + public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, SuggestedPost suggested_post = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_SendMedia { - flags = (Messages_SendMedia.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), + flags = (Messages_SendMedia.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (suggested_post != null ? 0x400000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), peer = peer, reply_to = reply_to, media = media, @@ -1954,6 +1958,7 @@ namespace TL quick_reply_shortcut = quick_reply_shortcut, effect = effect ?? default, allow_paid_stars = allow_paid_stars ?? default, + suggested_post = suggested_post, }); /// Forwards messages by their IDs. See [bots: ✓] Possible codes: 400,403,406,420,500 (details) @@ -1972,10 +1977,10 @@ namespace TL /// Scheduled message date for scheduled messages /// Forward the messages as the specified peer /// Add the messages to the specified quick reply shortcut », instead. - public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, int? video_timestamp = null, long? allow_paid_stars = null, InputReplyTo reply_to = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, bool allow_paid_floodskip = false) + public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, int? video_timestamp = null, long? allow_paid_stars = null, InputReplyTo reply_to = null, SuggestedPost suggested_post = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_ForwardMessages { - flags = (Messages_ForwardMessages.Flags)((top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (video_timestamp != null ? 0x100000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (reply_to != null ? 0x400000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), + flags = (Messages_ForwardMessages.Flags)((top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (video_timestamp != null ? 0x100000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (reply_to != null ? 0x400000 : 0) | (suggested_post != null ? 0x800000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), from_peer = from_peer, id = id, random_id = random_id, @@ -1987,6 +1992,7 @@ namespace TL quick_reply_shortcut = quick_reply_shortcut, video_timestamp = video_timestamp ?? default, allow_paid_stars = allow_paid_stars ?? default, + suggested_post = suggested_post, }); /// Report a new incoming chat for spam, if the of the chat allow us to do that See Possible codes: 400 (details) @@ -2602,16 +2608,17 @@ namespace TL /// Message entities for styled text /// Attached media /// Specifies a message effect » to use for the message. - public static Task Messages_SaveDraft(this Client client, InputPeer peer, string message, MessageEntity[] entities = null, InputReplyTo reply_to = null, InputMedia media = null, long? effect = null, bool no_webpage = false, bool invert_media = false) + public static Task Messages_SaveDraft(this Client client, InputPeer peer, string message, MessageEntity[] entities = null, InputReplyTo reply_to = null, InputMedia media = null, long? effect = null, SuggestedPost suggested_post = null, bool no_webpage = false, bool invert_media = false) => client.Invoke(new Messages_SaveDraft { - flags = (Messages_SaveDraft.Flags)((entities != null ? 0x8 : 0) | (reply_to != null ? 0x10 : 0) | (media != null ? 0x20 : 0) | (effect != null ? 0x80 : 0) | (no_webpage ? 0x2 : 0) | (invert_media ? 0x40 : 0)), + flags = (Messages_SaveDraft.Flags)((entities != null ? 0x8 : 0) | (reply_to != null ? 0x10 : 0) | (media != null ? 0x20 : 0) | (effect != null ? 0x80 : 0) | (suggested_post != null ? 0x100 : 0) | (no_webpage ? 0x2 : 0) | (invert_media ? 0x40 : 0)), reply_to = reply_to, peer = peer, message = message, entities = entities, media = media, effect = effect ?? default, + suggested_post = suggested_post, }); /// Return all message drafts.
Returns all the latest updates related to all chats with drafts. See
@@ -4449,10 +4456,12 @@ namespace TL /// Get a list of sponsored messages for a peer, see here » for more info. See /// The currently open channel/bot. /// a null value means messages.sponsoredMessagesEmpty - public static Task Messages_GetSponsoredMessages(this Client client, InputPeer peer) + public static Task Messages_GetSponsoredMessages(this Client client, InputPeer peer, int? msg_id = null) => client.Invoke(new Messages_GetSponsoredMessages { + flags = (Messages_GetSponsoredMessages.Flags)(msg_id != null ? 0x1 : 0), peer = peer, + msg_id = msg_id ?? default, }); /// Save a prepared inline message, to be shared by the user of the mini app using a web_app_send_prepared_message event See [bots: ✓] Possible codes: 400 (details) @@ -4525,6 +4534,36 @@ namespace TL max_id = max_id, }); + /// See + public static Task Messages_ToggleTodoCompleted(this Client client, InputPeer peer, int msg_id, int[] completed, params int[] incompleted) + => client.Invoke(new Messages_ToggleTodoCompleted + { + peer = peer, + msg_id = msg_id, + completed = completed, + incompleted = incompleted, + }); + + /// See + public static Task Messages_AppendTodoList(this Client client, InputPeer peer, int msg_id, params TodoItem[] list) + => client.Invoke(new Messages_AppendTodoList + { + peer = peer, + msg_id = msg_id, + list = list, + }); + + /// See + public static Task Messages_ToggleSuggestedPostApproval(this Client client, InputPeer peer, int msg_id, DateTime? schedule_date = null, string reject_comment = null, bool reject = false) + => client.Invoke(new Messages_ToggleSuggestedPostApproval + { + flags = (Messages_ToggleSuggestedPostApproval.Flags)((schedule_date != null ? 0x1 : 0) | (reject_comment != null ? 0x4 : 0) | (reject ? 0x2 : 0)), + peer = peer, + msg_id = msg_id, + schedule_date = schedule_date ?? default, + reject_comment = reject_comment, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -6103,9 +6142,10 @@ namespace TL /// Get the current Telegram Stars balance of the current account (with peer=), or the stars balance of the bot specified in peer. See Possible codes: 400 (details) /// Peer of which to get the balance. - public static Task Payments_GetStarsStatus(this Client client, InputPeer peer) + public static Task Payments_GetStarsStatus(this Client client, InputPeer peer, bool ton = false) => client.Invoke(new Payments_GetStarsStatus { + flags = (Payments_GetStarsStatus.Flags)(ton ? 0x1 : 0), peer = peer, }); @@ -6117,10 +6157,10 @@ namespace TL /// Fetch the transaction history of the peer ( or a bot we own). /// Offset for pagination, obtained from the returned next_offset, initially an empty string ». /// Maximum number of results to return, see pagination - public static Task Payments_GetStarsTransactions(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, string subscription_id = null, bool inbound = false, bool outbound = false, bool ascending = false) + public static Task Payments_GetStarsTransactions(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, string subscription_id = null, bool inbound = false, bool outbound = false, bool ascending = false, bool ton = false) => client.Invoke(new Payments_GetStarsTransactions { - flags = (Payments_GetStarsTransactions.Flags)((subscription_id != null ? 0x8 : 0) | (inbound ? 0x1 : 0) | (outbound ? 0x2 : 0) | (ascending ? 0x4 : 0)), + flags = (Payments_GetStarsTransactions.Flags)((subscription_id != null ? 0x8 : 0) | (inbound ? 0x1 : 0) | (outbound ? 0x2 : 0) | (ascending ? 0x4 : 0) | (ton ? 0x10 : 0)), subscription_id = subscription_id, peer = peer, offset = offset, @@ -6150,22 +6190,22 @@ namespace TL /// Get Telegram Star revenue statistics ». See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors /// Get statistics for the specified bot, channel or ourselves (). - public static Task Payments_GetStarsRevenueStats(this Client client, InputPeer peer, bool dark = false) + public static Task Payments_GetStarsRevenueStats(this Client client, InputPeer peer, bool dark = false, bool ton = false) => client.Invoke(new Payments_GetStarsRevenueStats { - flags = (Payments_GetStarsRevenueStats.Flags)(dark ? 0x1 : 0), + flags = (Payments_GetStarsRevenueStats.Flags)((dark ? 0x1 : 0) | (ton ? 0x2 : 0)), peer = peer, }); /// Withdraw funds from a channel or bot's star balance ». See Possible codes: 400 (details) /// Channel or bot from which to withdraw funds. - /// Amount of stars to withdraw. /// 2FA password, see here » for more info. - public static Task Payments_GetStarsRevenueWithdrawalUrl(this Client client, InputPeer peer, long stars, InputCheckPasswordSRP password) + public static Task Payments_GetStarsRevenueWithdrawalUrl(this Client client, InputPeer peer, InputCheckPasswordSRP password, long? amount = null, bool ton = false) => client.Invoke(new Payments_GetStarsRevenueWithdrawalUrl { + flags = (Payments_GetStarsRevenueWithdrawalUrl.Flags)((amount != null ? 0x2 : 0) | (ton ? 0x1 : 0)), peer = peer, - stars = stars, + amount = amount ?? default, password = password, }); @@ -6180,9 +6220,10 @@ namespace TL /// Obtain info about Telegram Star transactions » using specific transaction IDs. See Possible codes: 400 (details) /// Channel or bot. /// Transaction IDs. - public static Task Payments_GetStarsTransactionsByID(this Client client, InputPeer peer, params InputStarsTransaction[] id) + public static Task Payments_GetStarsTransactionsByID(this Client client, InputPeer peer, InputStarsTransaction[] id, bool ton = false) => client.Invoke(new Payments_GetStarsTransactionsByID { + flags = (Payments_GetStarsTransactionsByID.Flags)(ton ? 0x1 : 0), peer = peer, id = id, }); @@ -7119,38 +7160,6 @@ namespace TL limit = limit, }); - /// Get channel ad revenue statistics ». See Possible codes: 400 (details) - /// Whether to enable dark theme for graph colors - /// Get ad revenue stats for the specified channel or bot - public static Task Stats_GetBroadcastRevenueStats(this Client client, InputPeer peer, bool dark = false) - => client.Invoke(new Stats_GetBroadcastRevenueStats - { - flags = (Stats_GetBroadcastRevenueStats.Flags)(dark ? 0x1 : 0), - peer = peer, - }); - - /// Withdraw funds from a channel's ad revenue balance ». See Possible codes: 400 (details) - /// Get ad revenue withdrawal URL for the specified channel or bot - /// 2FA password, see here » for more info. - public static Task Stats_GetBroadcastRevenueWithdrawalUrl(this Client client, InputPeer peer, InputCheckPasswordSRP password) - => client.Invoke(new Stats_GetBroadcastRevenueWithdrawalUrl - { - peer = peer, - password = password, - }); - - /// Fetch channel ad revenue transaction history ». See Possible codes: 400 (details) - /// Get ad revenue transactions for the specified channel or bot - /// Offset for pagination - /// Maximum number of results to return, see pagination - public static Task Stats_GetBroadcastRevenueTransactions(this Client client, InputPeer peer, int offset = default, int limit = int.MaxValue) - => client.Invoke(new Stats_GetBroadcastRevenueTransactions - { - peer = peer, - offset = offset, - limit = limit, - }); - /// Export a folder », creating a chat folder deep link ». See Possible codes: 400 (details) /// The folder to export /// An optional name for the link @@ -8814,24 +8823,34 @@ namespace TL.Methods public long hash; } - [TLDef(0x6F688AA7)] - public sealed partial class Account_AddNoPaidMessagesException : IMethod + [TLDef(0x19BA4A67)] + public sealed partial class Account_GetPaidMessagesRevenue : IMethod { public Flags flags; + [IfFlag(0)] public InputPeer parent_peer; + public InputUserBase user_id; + + [Flags] public enum Flags : uint + { + has_parent_peer = 0x1, + } + } + + [TLDef(0xFE2EDA76)] + public sealed partial class Account_ToggleNoPaidMessagesException : IMethod + { + public Flags flags; + [IfFlag(1)] public InputPeer parent_peer; public InputUserBase user_id; [Flags] public enum Flags : uint { refund_charged = 0x1, + has_parent_peer = 0x2, + require_payment = 0x4, } } - [TLDef(0xF1266F38)] - public sealed partial class Account_GetPaidMessagesRevenue : IMethod - { - public InputUserBase user_id; - } - [TLDef(0x0D91A548)] public sealed partial class Users_GetUsers : IMethod { @@ -9203,7 +9222,7 @@ namespace TL.Methods } } - [TLDef(0xFBF2340A)] + [TLDef(0xFE05DC9A)] public sealed partial class Messages_SendMessage : IMethod { public Flags flags; @@ -9218,6 +9237,7 @@ namespace TL.Methods [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; [IfFlag(18)] public long effect; [IfFlag(21)] public long allow_paid_stars; + [IfFlag(22)] public SuggestedPost suggested_post; [Flags] public enum Flags : uint { @@ -9237,10 +9257,11 @@ namespace TL.Methods has_effect = 0x40000, allow_paid_floodskip = 0x80000, has_allow_paid_stars = 0x200000, + has_suggested_post = 0x400000, } } - [TLDef(0xA550CD78)] + [TLDef(0xAC55D9C1)] public sealed partial class Messages_SendMedia : IMethod { public Flags flags; @@ -9256,6 +9277,7 @@ namespace TL.Methods [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; [IfFlag(18)] public long effect; [IfFlag(21)] public long allow_paid_stars; + [IfFlag(22)] public SuggestedPost suggested_post; [Flags] public enum Flags : uint { @@ -9274,10 +9296,11 @@ namespace TL.Methods has_effect = 0x40000, allow_paid_floodskip = 0x80000, has_allow_paid_stars = 0x200000, + has_suggested_post = 0x400000, } } - [TLDef(0x38F0188C)] + [TLDef(0x978928CA)] public sealed partial class Messages_ForwardMessages : IMethod { public Flags flags; @@ -9292,6 +9315,7 @@ namespace TL.Methods [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; [IfFlag(20)] public int video_timestamp; [IfFlag(21)] public long allow_paid_stars; + [IfFlag(23)] public SuggestedPost suggested_post; [Flags] public enum Flags : uint { @@ -9309,6 +9333,7 @@ namespace TL.Methods has_video_timestamp = 0x100000, has_allow_paid_stars = 0x200000, has_reply_to = 0x400000, + has_suggested_post = 0x800000, } } @@ -9824,7 +9849,7 @@ namespace TL.Methods public InputDialogPeerBase[] peers; } - [TLDef(0xD372C5CE)] + [TLDef(0x54AE308E)] public sealed partial class Messages_SaveDraft : IMethod { public Flags flags; @@ -9834,6 +9859,7 @@ namespace TL.Methods [IfFlag(3)] public MessageEntity[] entities; [IfFlag(5)] public InputMedia media; [IfFlag(7)] public long effect; + [IfFlag(8)] public SuggestedPost suggested_post; [Flags] public enum Flags : uint { @@ -9843,6 +9869,7 @@ namespace TL.Methods has_media = 0x20, invert_media = 0x40, has_effect = 0x80, + has_suggested_post = 0x100, } } @@ -11416,10 +11443,17 @@ namespace TL.Methods public byte[] option; } - [TLDef(0x9BD2F439)] + [TLDef(0x3D6CE850)] public sealed partial class Messages_GetSponsoredMessages : IMethod { + public Flags flags; public InputPeer peer; + [IfFlag(0)] public int msg_id; + + [Flags] public enum Flags : uint + { + has_msg_id = 0x1, + } } [TLDef(0xF21F7F2F)] @@ -11494,6 +11528,40 @@ namespace TL.Methods public int max_id; } + [TLDef(0xD3E03124)] + public sealed partial class Messages_ToggleTodoCompleted : IMethod + { + public InputPeer peer; + public int msg_id; + public int[] completed; + public int[] incompleted; + } + + [TLDef(0x21A61057)] + public sealed partial class Messages_AppendTodoList : IMethod + { + public InputPeer peer; + public int msg_id; + public TodoItem[] list; + } + + [TLDef(0x8107455C)] + public sealed partial class Messages_ToggleSuggestedPostApproval : IMethod + { + public Flags flags; + public InputPeer peer; + public int msg_id; + [IfFlag(0)] public DateTime schedule_date; + [IfFlag(2)] public string reject_comment; + + [Flags] public enum Flags : uint + { + has_schedule_date = 0x1, + reject = 0x2, + has_reject_comment = 0x4, + } + } + [TLDef(0xEDD4882A)] public sealed partial class Updates_GetState : IMethod { } @@ -12740,10 +12808,16 @@ namespace TL.Methods [TLDef(0xC00EC7D3)] public sealed partial class Payments_GetStarsTopupOptions : IMethod { } - [TLDef(0x104FCFA7)] + [TLDef(0x4EA9B3BF)] public sealed partial class Payments_GetStarsStatus : IMethod { + public Flags flags; public InputPeer peer; + + [Flags] public enum Flags : uint + { + ton = 0x1, + } } [TLDef(0x69DA4557)] @@ -12761,6 +12835,7 @@ namespace TL.Methods outbound = 0x2, ascending = 0x4, has_subscription_id = 0x8, + ton = 0x10, } } @@ -12787,15 +12862,23 @@ namespace TL.Methods [Flags] public enum Flags : uint { dark = 0x1, + ton = 0x2, } } - [TLDef(0x13BBE8B3)] + [TLDef(0x2433DC92)] public sealed partial class Payments_GetStarsRevenueWithdrawalUrl : IMethod { + public Flags flags; public InputPeer peer; - public long stars; + [IfFlag(1)] public long amount; public InputCheckPasswordSRP password; + + [Flags] public enum Flags : uint + { + ton = 0x1, + has_amount = 0x2, + } } [TLDef(0xD1D7EFC5)] @@ -12804,11 +12887,17 @@ namespace TL.Methods public InputPeer peer; } - [TLDef(0x27842D2E)] + [TLDef(0x2DCA16B8)] public sealed partial class Payments_GetStarsTransactionsByID : IMethod { + public Flags flags; public InputPeer peer; public InputStarsTransaction[] id; + + [Flags] public enum Flags : uint + { + ton = 0x1, + } } [TLDef(0xD3C96BC8)] @@ -13660,33 +13749,6 @@ namespace TL.Methods public int limit; } - [TLDef(0xF788EE19)] - public sealed partial class Stats_GetBroadcastRevenueStats : IMethod - { - public Flags flags; - public InputPeer peer; - - [Flags] public enum Flags : uint - { - dark = 0x1, - } - } - - [TLDef(0x9DF4FAAD)] - public sealed partial class Stats_GetBroadcastRevenueWithdrawalUrl : IMethod - { - public InputPeer peer; - public InputCheckPasswordSRP password; - } - - [TLDef(0x70990B6D)] - public sealed partial class Stats_GetBroadcastRevenueTransactions : IMethod - { - public InputPeer peer; - public int offset; - public int limit; - } - [TLDef(0x8472478E)] public sealed partial class Chatlists_ExportChatlistInvite : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 9cba0d9..11bbf49 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 = 204; // fetched 04/06/2025 15:07:47 + public const int Version = 206; // fetched 02/07/2025 12:40:29 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -103,6 +103,7 @@ namespace TL [0x89FDD778] = typeof(InputMediaStory), [0xC21B8849] = typeof(InputMediaWebPage), [0xC4103386] = typeof(InputMediaPaidMedia), + [0x9FC55FDE] = typeof(InputMediaTodo), [0x1CA48F57] = null,//InputChatPhotoEmpty [0xBDCDAEC0] = typeof(InputChatUploadedPhoto), [0x8953AD37] = typeof(InputChatPhoto), @@ -139,7 +140,7 @@ namespace TL [0xFE685355] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), [0x2633421B] = typeof(ChatFull), - [0x52D6806B] = typeof(ChannelFull), + [0xE07429DE] = typeof(ChannelFull), [0xC02D4007] = typeof(ChatParticipant), [0xE46BCEE4] = typeof(ChatParticipantCreator), [0xA0933F5B] = typeof(ChatParticipantAdmin), @@ -148,8 +149,8 @@ namespace TL [0x37C1011C] = null,//ChatPhotoEmpty [0x1C6E1C11] = typeof(ChatPhoto), [0x90A6CA84] = typeof(MessageEmpty), - [0xEABCDD4D] = typeof(Message), - [0xD3D28540] = typeof(MessageService), + [0x9815CEC8] = typeof(Message), + [0x7A800E0A] = typeof(MessageService), [0x3DED6320] = null,//MessageMediaEmpty [0x695150D7] = typeof(MessageMediaPhoto), [0x56E0D474] = typeof(MessageMediaGeo), @@ -167,6 +168,7 @@ namespace TL [0xAA073BEB] = typeof(MessageMediaGiveaway), [0xCEAA3EA1] = typeof(MessageMediaGiveawayResults), [0xA8852491] = typeof(MessageMediaPaidMedia), + [0x8A53B014] = typeof(MessageMediaToDo), [0xB6AEF7B0] = null,//MessageActionEmpty [0xBD47CBAD] = typeof(MessageActionChatCreate), [0xB5A1CE5A] = typeof(MessageActionChatEditTitle), @@ -218,6 +220,12 @@ namespace TL [0xAC1F1FCD] = typeof(MessageActionPaidMessagesRefunded), [0x84B88578] = typeof(MessageActionPaidMessagesPrice), [0x2FFE2F7A] = typeof(MessageActionConferenceCall), + [0xCC7C5C89] = typeof(MessageActionTodoCompletions), + [0xC7EDBC83] = typeof(MessageActionTodoAppendTasks), + [0xEE7A1596] = typeof(MessageActionSuggestedPostApproval), + [0x95DDCF69] = typeof(MessageActionSuggestedPostSuccess), + [0x69F916F8] = typeof(MessageActionSuggestedPostRefund), + [0xA8A3C699] = typeof(MessageActionGiftTon), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -418,7 +426,6 @@ namespace TL [0x07DF587C] = typeof(UpdateBotEditBusinessMessage), [0xA02A982E] = typeof(UpdateBotDeleteBusinessMessage), [0x1824E40B] = typeof(UpdateNewStoryReaction), - [0xDFD961F5] = typeof(UpdateBroadcastRevenueTransactions), [0x4E80A379] = typeof(UpdateStarsBalance), [0x1EA2FDA7] = typeof(UpdateBusinessBotCallbackQuery), [0xA584B019] = typeof(UpdateStarsRevenueStatus), @@ -428,6 +435,7 @@ namespace TL [0xA477288F] = typeof(UpdateGroupCallChainBlocks), [0x77B0E372] = typeof(UpdateReadMonoForumInbox), [0xA4A79376] = typeof(UpdateReadMonoForumOutbox), + [0x9F812B08] = typeof(UpdateMonoForumNoPaidException), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -565,6 +573,7 @@ namespace TL [0x29D0F5EE] = typeof(InputStickerSetEmojiDefaultStatuses), [0x44C1F8E9] = typeof(InputStickerSetEmojiDefaultTopicIcons), [0x49748553] = typeof(InputStickerSetEmojiChannelDefaultStatuses), + [0x1CF671A0] = typeof(InputStickerSetTonGifts), [0x2DD14EDC] = typeof(StickerSet), [0x6E153F16] = typeof(Messages_StickerSet), [0xD3F924EB] = null,//Messages_StickerSetNotModified @@ -691,7 +700,7 @@ namespace TL [0x70B772A8] = typeof(Contacts_TopPeers), [0xB52C939D] = typeof(Contacts_TopPeersDisabled), [0x1B0C841A] = typeof(DraftMessageEmpty), - [0x2D65321F] = typeof(DraftMessage), + [0x96EAA5EB] = typeof(DraftMessage), [0xC6DC0C66] = typeof(Messages_FeaturedStickersNotModified), [0xBE382906] = typeof(Messages_FeaturedStickers), [0x0B17F890] = null,//Messages_RecentStickersNotModified @@ -1069,8 +1078,8 @@ namespace TL [0xE3779861] = typeof(Account_ResetPasswordFailedWait), [0xE9EFFC7D] = typeof(Account_ResetPasswordRequestedWait), [0xE926D63E] = typeof(Account_ResetPasswordOk), - [0x4D93A990] = typeof(SponsoredMessage), - [0xC9EE1D87] = typeof(Messages_SponsoredMessages), + [0x7DBF8673] = typeof(SponsoredMessage), + [0xFFDA656D] = typeof(Messages_SponsoredMessages), [0x1839490F] = null,//Messages_SponsoredMessagesEmpty [0xC9B0539F] = typeof(SearchResultsCalendarPeriod), [0x147EE23C] = typeof(Messages_SearchResultsCalendar), @@ -1319,14 +1328,7 @@ namespace TL [0x846F9E42] = typeof(Channels_SponsoredMessageReportResultChooseOption), [0x3E3BCF2F] = typeof(Channels_SponsoredMessageReportResultAdsHidden), [0xAD798849] = typeof(Channels_SponsoredMessageReportResultReported), - [0x5407E297] = typeof(Stats_BroadcastRevenueStats), - [0xEC659737] = typeof(Stats_BroadcastRevenueWithdrawalUrl), - [0x557E2CC4] = typeof(BroadcastRevenueTransactionProceeds), - [0x5A590978] = typeof(BroadcastRevenueTransactionWithdrawal), - [0x42D30D2E] = typeof(BroadcastRevenueTransactionRefund), - [0x87158466] = typeof(Stats_BroadcastRevenueTransactions), [0x56E34970] = typeof(ReactionsNotifySettings), - [0xC3FF71E7] = typeof(BroadcastRevenueBalances), [0x93C3E27E] = typeof(AvailableEffect), [0xD1ED9A5B] = null,//Messages_AvailableEffectsNotModified [0xBDDB616E] = typeof(Messages_AvailableEffects), @@ -1340,13 +1342,13 @@ namespace TL [0x60682812] = typeof(StarsTransactionPeerAds), [0xF9677AAD] = typeof(StarsTransactionPeerAPI), [0x0BD915C0] = typeof(StarsTopupOption), - [0xA39FD94A] = typeof(StarsTransaction), + [0x13659EB0] = typeof(StarsTransaction), [0x6C9CE8ED] = typeof(Payments_StarsStatus), [0xE87ACBC0] = typeof(FoundStory), [0xE2DE7737] = typeof(Stories_FoundStories), [0xDE4C5D93] = typeof(GeoPointAddress), [0xFEBE5491] = typeof(StarsRevenueStatus), - [0xC92BB73B] = typeof(Payments_StarsRevenueStats), + [0x6C207376] = typeof(Payments_StarsRevenueStats), [0x1DAB80B7] = typeof(Payments_StarsRevenueWithdrawalUrl), [0x394E7F21] = typeof(Payments_StarsRevenueAdsAccountUrl), [0x206AE6D1] = typeof(InputStarsTransaction), @@ -1375,6 +1377,7 @@ namespace TL [0x98D5EA1D] = typeof(Payments_ConnectedStarRefBots), [0xB4D5D859] = typeof(Payments_SuggestedStarRefBots), [0xBBB6B4A3] = typeof(StarsAmount), + [0x74AEE3E0] = typeof(StarsTonAmount), [0x6010C534] = typeof(Messages_FoundStickersNotModified), [0x82C9E290] = typeof(Messages_FoundStickers), [0xB0CD6617] = typeof(BotVerifierSettings), @@ -1413,6 +1416,10 @@ namespace TL [0x947A12DF] = typeof(Payments_ResaleStarGifts), [0xC387C04E] = typeof(Stories_CanSendStoryCount), [0xE7E82E12] = typeof(PendingSuggestion), + [0xCBA9A52F] = typeof(TodoItem), + [0x49B92A26] = typeof(TodoList), + [0x4CC120B7] = typeof(TodoCompletion), + [0x0E8E37E5] = typeof(SuggestedPost), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 1c5aa10..8024098 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -11,10 +11,10 @@ snupkg true WTelegramClient - 0.0.0 - layer.204 Wizou - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 204 + 0.0.0 + layer.206 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 206 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From 52d948af2a01c28a68f6c52262be030bb2f0a1ec Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 10 Jul 2025 01:49:25 +0200 Subject: [PATCH 11/54] Fix DateTime type of *_at fields --- .github/workflows/release.yml | 9 +++++++++ src/TL.Schema.cs | 14 +++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5d1519e..42fcb35 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -54,3 +54,12 @@ jobs: run: | git tag $VERSION git push --tags + - name: Deployment Notification + env: + JSON: | + { + "status": "success", "complete": true, "commitMessage": ${{ toJSON(github.event.head_commit.message) }}, + "message": "{ \"commitId\": \"${{ github.sha }}\", \"buildNumber\": \"${{ env.VERSION }}\", \"repoName\": \"${{ github.repository }}\"}" + } + run: | + curl -X POST -H "Content-Type: application/json" -d "$JSON" ${{ secrets.DEPLOYED_WEBHOOK }} diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 367010b..da22aff 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2970,14 +2970,14 @@ namespace TL { public Flags flags; public StarGiftBase gift; - [IfFlag(3)] public int can_export_at; + [IfFlag(3)] public DateTime can_export_at; [IfFlag(4)] public long transfer_stars; [IfFlag(6)] public Peer from_id; [IfFlag(7)] public Peer peer; [IfFlag(7)] public long saved_id; [IfFlag(8)] public long resale_stars; - [IfFlag(9)] public int can_transfer_at; - [IfFlag(10)] public int can_resell_at; + [IfFlag(9)] public DateTime can_transfer_at; + [IfFlag(10)] public DateTime can_resell_at; [Flags] public enum Flags : uint { @@ -19791,7 +19791,7 @@ namespace TL /// Total amount of earned Telegram Stars. public StarsAmountBase overall_revenue; /// Unixtime indicating when will withdrawal be available to the user. If not set, withdrawal can be started now. - [IfFlag(1)] public int next_withdrawal_at; + [IfFlag(1)] public DateTime next_withdrawal_at; [Flags] public enum Flags : uint { @@ -20518,10 +20518,10 @@ namespace TL [IfFlag(11)] public long saved_id; [IfFlag(4)] public long convert_stars; [IfFlag(6)] public long upgrade_stars; - [IfFlag(7)] public int can_export_at; + [IfFlag(7)] public DateTime can_export_at; [IfFlag(8)] public long transfer_stars; - [IfFlag(13)] public int can_transfer_at; - [IfFlag(14)] public int can_resell_at; + [IfFlag(13)] public DateTime can_transfer_at; + [IfFlag(14)] public DateTime can_resell_at; [Flags] public enum Flags : uint { From a3f41330b55c27b7c67de6e37d12d01674c7a88e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 10 Jul 2025 01:50:09 +0200 Subject: [PATCH 12/54] API Layer 207: StarGift.ReleaseBy (that might not be the most recent layer. check https://patreon.com/wizou for the latest layers) --- README.md | 2 +- src/TL.Schema.cs | 20 ++++++++++++++++---- src/TL.Table.cs | 8 ++++---- src/WTelegramClient.csproj | 4 ++-- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 838b958..089b923 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-206-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-207-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 da22aff..d7f3678 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -20050,9 +20050,10 @@ namespace TL /// For limited-supply gifts: the total number of gifts that was available in the initial supply. public virtual int AvailabilityTotal => default; public virtual string Title => default; + public virtual Peer ReleasedBy => default; } /// Represents a star gift, see here » for more info. See - [TLDef(0xC62ACA28)] + [TLDef(0x7F853C12)] public sealed partial class StarGift : StarGiftBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -20077,6 +20078,7 @@ namespace TL [IfFlag(3)] public long upgrade_stars; [IfFlag(4)] public long resell_min_stars; [IfFlag(5)] public string title; + [IfFlag(6)] public Peer released_by; [Flags] public enum Flags : uint { @@ -20092,6 +20094,8 @@ namespace TL has_availability_resale = 0x10, /// Field has a value has_title = 0x20, + /// Field has a value + has_released_by = 0x40, } /// Identifier of the gift @@ -20099,9 +20103,10 @@ namespace TL /// For limited-supply gifts: the total number of gifts that was available in the initial supply. public override int AvailabilityTotal => availability_total; public override string Title => title; + public override Peer ReleasedBy => released_by; } /// See - [TLDef(0x6411DB89)] + [TLDef(0xF63778AE)] public sealed partial class StarGiftUnique : StarGiftBase { public Flags flags; @@ -20117,6 +20122,7 @@ namespace TL public int availability_total; [IfFlag(3)] public string gift_address; [IfFlag(4)] public long resell_stars; + [IfFlag(5)] public Peer released_by; [Flags] public enum Flags : uint { @@ -20125,22 +20131,28 @@ namespace TL has_owner_address = 0x4, has_gift_address = 0x8, has_resell_stars = 0x10, + has_released_by = 0x20, } public override long ID => id; public override int AvailabilityTotal => availability_total; public override string Title => title; + public override Peer ReleasedBy => released_by; } /// Available gifts ». See /// a value means payments.starGiftsNotModified - [TLDef(0x901689EA)] - public sealed partial class Payments_StarGifts : IObject + [TLDef(0x2ED82995)] + public sealed partial class Payments_StarGifts : IObject, IPeerResolver { /// Hash used for caching, for more info click here public int hash; /// List of available gifts. public StarGiftBase[] gifts; + public Dictionary chats; + public Dictionary users; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Report menu option See diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 11bbf49..bbb604f 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 = 206; // fetched 02/07/2025 12:40:29 + public const int Version = 207; // fetched 08/07/2025 17:40:58 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -1361,10 +1361,10 @@ namespace TL [0x4BA3A95A] = typeof(MessageReactor), [0x94CE852A] = typeof(StarsGiveawayOption), [0x54236209] = typeof(StarsGiveawayWinnersOption), - [0xC62ACA28] = typeof(StarGift), - [0x6411DB89] = typeof(StarGiftUnique), + [0x7F853C12] = typeof(StarGift), + [0xF63778AE] = typeof(StarGiftUnique), [0xA388A368] = null,//Payments_StarGiftsNotModified - [0x901689EA] = typeof(Payments_StarGifts), + [0x2ED82995] = typeof(Payments_StarGifts), [0x7903E3D9] = typeof(MessageReportOption), [0xF0E4E0B6] = typeof(ReportResultChooseOption), [0x6F09AC31] = typeof(ReportResultAddComment), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 8024098..3d55ae8 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,8 +13,8 @@ WTelegramClient Wizou 0.0.0 - layer.206 - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 206 + layer.207 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 207 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From 56ba15bc13405500cd5f29999f6882dec095080f Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 14 Jul 2025 22:27:30 +0200 Subject: [PATCH 13/54] API Layer 209: Reply-to specific ToDo item (that might not be the most recent layer. check https://patreon.com/wizou for the latest layers) --- README.md | 2 +- src/TL.Schema.cs | 136 +++++++++++++++++++++++++++++-------- src/TL.SchemaFuncs.cs | 73 ++++++++++---------- src/TL.Table.cs | 6 +- src/WTelegramClient.csproj | 4 +- 5 files changed, 152 insertions(+), 69 deletions(-) diff --git a/README.md b/README.md index 089b923..4da3f32 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-207-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-209-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 d7f3678..281d067 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -163,7 +163,7 @@ namespace TL public InputDocument id; } - /// Defines media content of a message. See Derived classes: , , , , , , , , , , , , , , , , + /// Defines media content of a message. See Derived classes: , , , , , , , , , , , , , , , , , /// a value means inputMediaEmpty public abstract partial class InputMedia : IObject { } /// Photo See @@ -257,7 +257,7 @@ namespace TL has_ttl_seconds = 0x2, /// Field has a value has_thumb = 0x4, - /// Whether to send the file as a video even if it doesn't have an audio track (i.e. if set, the attribute will not be set even for videos without audio) + /// Whether to send the file as a video even if it doesn't have an audio track (i.e. if set, the attribute will not be set even for videos without audio) nosound_video = 0x8, /// Force the media file to be uploaded as document force_file = 0x10, @@ -2012,7 +2012,7 @@ namespace TL public override int TtlPeriod => ttl_period; } - /// Media See Derived classes: , , , , , , , , , , , , , , , + /// Media See Derived classes: , , , , , , , , , , , , , , , , /// a value means messageMediaEmpty public abstract partial class MessageMedia : IObject { } /// Attached photo. See @@ -2337,17 +2337,19 @@ namespace TL [TLDef(0x8A53B014)] public sealed partial class MessageMediaToDo : MessageMedia { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public TodoList todo; [IfFlag(0)] public TodoCompletion[] completions; [Flags] public enum Flags : uint { + /// Field has a value has_completions = 0x1, } } - /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , /// a value means messageActionEmpty public abstract partial class MessageAction : IObject { } /// Group created See @@ -2968,6 +2970,7 @@ namespace TL [TLDef(0x2E3AE60E)] public sealed partial class MessageActionStarGiftUnique : MessageAction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public StarGiftBase gift; [IfFlag(3)] public DateTime can_export_at; @@ -2984,13 +2987,20 @@ namespace TL upgrade = 0x1, transferred = 0x2, saved = 0x4, + /// Field has a value has_can_export_at = 0x8, + /// Field has a value has_transfer_stars = 0x10, refunded = 0x20, + /// Field has a value has_from_id = 0x40, + /// Fields and have a value has_peer = 0x80, + /// Field has a value has_resale_stars = 0x100, + /// Field has a value has_can_transfer_at = 0x200, + /// Field has a value has_can_resell_at = 0x400, } } @@ -3005,6 +3015,7 @@ namespace TL [TLDef(0x84B88578)] public sealed partial class MessageActionPaidMessagesPrice : MessageAction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long stars; @@ -3017,6 +3028,7 @@ namespace TL [TLDef(0x2FFE2F7A)] public sealed partial class MessageActionConferenceCall : MessageAction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long call_id; [IfFlag(2)] public int duration; @@ -3026,7 +3038,9 @@ namespace TL { missed = 0x1, active = 0x2, + /// Field has a value has_duration = 0x4, + /// Field has a value has_other_participants = 0x8, video = 0x10, } @@ -3048,6 +3062,7 @@ namespace TL [TLDef(0xEE7A1596)] public sealed partial class MessageActionSuggestedPostApproval : MessageAction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(2)] public string reject_comment; [IfFlag(3)] public DateTime schedule_date; @@ -3057,8 +3072,11 @@ namespace TL { rejected = 0x1, balance_too_low = 0x2, + /// Field has a value has_reject_comment = 0x4, + /// Field has a value has_schedule_date = 0x8, + /// Field has a value has_price = 0x10, } } @@ -3072,6 +3090,7 @@ namespace TL [TLDef(0x69F916F8)] public sealed partial class MessageActionSuggestedPostRefund : MessageAction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [Flags] public enum Flags : uint @@ -3083,6 +3102,7 @@ namespace TL [TLDef(0xA8A3C699)] public sealed partial class MessageActionGiftTon : MessageAction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public string currency; public long amount; @@ -3092,6 +3112,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_transaction_id = 0x1, } } @@ -3342,7 +3363,7 @@ namespace TL } } - /// Contains info on a confirmation code message sent via SMS, phone call or Telegram. See Derived classes: , + /// Contains info on a confirmation code message sent via SMS, phone call or Telegram. See Derived classes: , , public abstract partial class Auth_SentCodeBase : IObject { } /// Contains info about a sent verification code. See [TLDef(0x5E002502)] @@ -4197,7 +4218,7 @@ namespace TL [TLDef(0x1BB00451)] public sealed partial class InputMessagesFilterPinned : MessagesFilter { } - /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract partial class Update : IObject { public virtual (long mbox_id, int pts, int pts_count) GetMBox() => default; @@ -5279,6 +5300,7 @@ namespace TL [TLDef(0x97D64341)] public sealed partial class UpdateGroupCall : Update { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The channel/supergroup where this group call or livestream takes place [IfFlag(0)] public long chat_id; @@ -5986,6 +6008,7 @@ namespace TL [TLDef(0x9F812B08)] public sealed partial class UpdateMonoForumNoPaidException : Update { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long channel_id; public Peer saved_peer_id; @@ -7355,7 +7378,7 @@ namespace TL [IfFlag(2)] public int preload_prefix_size; /// Floating point UNIX timestamp in seconds, indicating the frame of the video that should be used as static preview and thumbnail. [IfFlag(4)] public double video_start_ts; - /// Codec used for the video, i.e. “h264”, “h265”, or “av1” + /// Codec used for the video, i.e. "h264", "h265", or "av1" [IfFlag(5)] public string video_codec; [Flags] public enum Flags : uint @@ -7541,7 +7564,7 @@ namespace TL public string display_url; /// Hash used for caching, for more info click here public int hash; - /// Type of the web page. One of the following:

- video
- gif
- photo
- document
- profile
- telegram_background
- telegram_theme
- telegram_story
- telegram_channel
- telegram_channel_request
- telegram_megagroup
- telegram_chat
- telegram_megagroup_request
- telegram_chat_request
- telegram_album
- telegram_message
- telegram_bot
- telegram_voicechat
- telegram_livestream
- telegram_user
- telegram_botapp
- telegram_channel_boost
- telegram_group_boost
- telegram_giftcode
- telegram_stickerset

+ /// Type of the web page. One of the following:

- video
- gif
- photo
- document
- profile
- telegram_background
- telegram_theme
- telegram_story
- telegram_channel
- telegram_channel_request
- telegram_megagroup
- telegram_chat
- telegram_megagroup_request
- telegram_chat_request
- telegram_album
- telegram_message
- telegram_bot
- telegram_voicechat
- telegram_livestream
- telegram_call
- telegram_user
- telegram_botapp
- telegram_channel_boost
- telegram_group_boost
- telegram_giftcode
- telegram_stickerset

[IfFlag(0)] public string type; /// Short name of the site (e.g., Google Docs, App Store) [IfFlag(1)] public string site_name; @@ -7928,7 +7951,7 @@ namespace TL public DateTime expires; } - /// Represents a stickerset See Derived classes: , , , , , , , , , + /// Represents a stickerset See Derived classes: , , , , , , , , , , /// a value means inputStickerSetEmpty public abstract partial class InputStickerSet : IObject { } /// Stickerset by ID See @@ -10698,7 +10721,7 @@ namespace TL public PageCaption caption; } - /// Why was the phone call discarded? See Derived classes: , , , + /// Why was the phone call discarded? See Derived classes: , , , , public abstract partial class PhoneCallDiscardReason : IObject { } /// The phone call was missed See [TLDef(0x85E42301)] @@ -11897,7 +11920,7 @@ namespace TL } } - /// Channel admin log event See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Channel admin log event See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract partial class ChannelAdminLogEventAction : IObject { } /// Channel/supergroup title was changed See [TLDef(0xE6DFB825)] @@ -14166,7 +14189,7 @@ namespace TL } } - /// Webpage attributes See Derived classes: , , + /// Webpage attributes See Derived classes: , , , public abstract partial class WebPageAttribute : IObject { } /// Page theme See [TLDef(0x54B56617)] @@ -14851,7 +14874,7 @@ namespace TL /// Reply information See Derived classes: , public abstract partial class MessageReplyHeaderBase : IObject { } /// Message replies and thread information See - [TLDef(0xAFBC09DB)] + [TLDef(0x6917560B)] public sealed partial class MessageReplyHeader : MessageReplyHeaderBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -14872,6 +14895,7 @@ namespace TL [IfFlag(7)] public MessageEntity[] quote_entities; /// Offset of the message quote_text within the original message (in UTF-16 code units). [IfFlag(10)] public int quote_offset; + [IfFlag(11)] public int todo_item_id; [Flags] public enum Flags : uint { @@ -14897,6 +14921,8 @@ namespace TL quote = 0x200, /// Field has a value has_quote_offset = 0x400, + /// Field has a value + has_todo_item_id = 0x800, } } /// Represents a reply to a story See @@ -15053,7 +15079,7 @@ namespace TL public override long AccessHash => access_hash; } - /// Indicates a group call See Derived classes: + /// Indicates a group call See Derived classes: , , public abstract partial class InputGroupCallBase : IObject { } /// Points to a specific group call See [TLDef(0xD8AA840F)] @@ -16054,7 +16080,7 @@ namespace TL Broadcast = 0x7BFBDEFC, } - /// An invoice See Derived classes: , , , , , + /// An invoice See Derived classes: , , , , , , , , , , public abstract partial class InputInvoice : IObject { } /// An invoice contained in a message or paid media ». See [TLDef(0xC5B56859)] @@ -16120,6 +16146,7 @@ namespace TL [TLDef(0x4D818D5D)] public sealed partial class InputInvoiceStarGiftUpgrade : InputInvoice { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public InputSavedStarGift stargift; @@ -16139,6 +16166,7 @@ namespace TL [TLDef(0xDABAB2EF)] public sealed partial class InputInvoicePremiumGiftStars : InputInvoice { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public InputUserBase user_id; public int months; @@ -16146,6 +16174,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_message = 0x1, } } @@ -16214,7 +16243,7 @@ namespace TL public Dictionary users; } - /// Info about a Telegram Premium purchase See Derived classes: , , , , , , + /// Info about a Telegram Premium purchase See Derived classes: , , , , , , , public abstract partial class InputStorePaymentPurpose : IObject { } /// Info about a Telegram Premium purchase See [TLDef(0xA6751E66)] @@ -16373,6 +16402,7 @@ namespace TL [TLDef(0x9BB2636D)] public sealed partial class InputStorePaymentAuthCode : InputStorePaymentPurpose { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public string phone_number; public string phone_code_hash; @@ -16395,7 +16425,7 @@ namespace TL public string title; } - /// Emoji status See Derived classes: , + /// Emoji status See Derived classes: , , /// a value means emojiStatusEmpty public abstract partial class EmojiStatusBase : IObject { @@ -16405,6 +16435,7 @@ namespace TL [TLDef(0xE7FF068A)] public sealed partial class EmojiStatus : EmojiStatusBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Custom emoji document ID public long document_id; @@ -16422,6 +16453,7 @@ namespace TL [TLDef(0x7184603B)] public sealed partial class EmojiStatusCollectible : EmojiStatusBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long collectible_id; public long document_id; @@ -16436,6 +16468,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_until = 0x1, } @@ -16445,12 +16478,14 @@ namespace TL [TLDef(0x07141DBF)] public sealed partial class InputEmojiStatusCollectible : EmojiStatusBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long collectible_id; [IfFlag(0)] public DateTime until; [Flags] public enum Flags : uint { + /// Field has a value has_until = 0x1, } @@ -17641,10 +17676,10 @@ namespace TL public Dictionary users; } - /// Contains info about a message or story to reply to. See Derived classes: , + /// Contains info about a message or story to reply to. See Derived classes: , , public abstract partial class InputReplyTo : IObject { } /// Reply to a message. See - [TLDef(0xB07038B0)] + [TLDef(0x869FBE10)] public sealed partial class InputReplyToMessage : InputReplyTo { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -17662,6 +17697,7 @@ namespace TL /// Offset of the message quote_text within the original message (in UTF-16 code units). [IfFlag(4)] public int quote_offset; [IfFlag(5)] public InputPeer monoforum_peer_id; + [IfFlag(6)] public int todo_item_id; [Flags] public enum Flags : uint { @@ -17677,6 +17713,8 @@ namespace TL has_quote_offset = 0x10, /// Field has a value has_monoforum_peer_id = 0x20, + /// Field has a value + has_todo_item_id = 0x40, } } /// Reply to a story. See @@ -17749,7 +17787,7 @@ namespace TL } } - /// Represents a story media area » See Derived classes: , , , , , , , + /// Represents a story media area » See Derived classes: , , , , , , , , public abstract partial class MediaArea : IObject { } /// Represents a location tag attached to a story, with additional venue information. See [TLDef(0xBE82DB9C)] @@ -18505,7 +18543,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// Represents a saved message dialog ». See Derived classes: + /// Represents a saved message dialog ». See Derived classes: , public abstract partial class SavedDialogBase : IObject { /// The dialog @@ -18539,6 +18577,7 @@ namespace TL [TLDef(0x64407EA7)] public sealed partial class MonoForumDialog : SavedDialogBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public Peer peer; public int top_message; @@ -18550,6 +18589,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_draft = 0x2, unread_mark = 0x8, nopaid_messages_exception = 0x10, @@ -19806,6 +19846,7 @@ namespace TL [TLDef(0x6C207376)] public sealed partial class Payments_StarsRevenueStats : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(0)] public StatsGraphBase top_hours_graph; /// Star revenue graph (number of earned stars) @@ -20042,7 +20083,7 @@ namespace TL } } - /// Represents a star gift, see here » for more info. See Derived classes: + /// Represents a star gift, see here » for more info. See Derived classes: , public abstract partial class StarGiftBase : IObject { /// Identifier of the gift @@ -20109,6 +20150,7 @@ namespace TL [TLDef(0xF63778AE)] public sealed partial class StarGiftUnique : StarGiftBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long id; public string title; @@ -20126,11 +20168,17 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_owner_id = 0x1, + /// Field has a value has_owner_name = 0x2, + /// Field has a value has_owner_address = 0x4, + /// Field has a value has_gift_address = 0x8, + /// Field has a value has_resell_stars = 0x10, + /// Field has a value has_released_by = 0x20, } @@ -20345,7 +20393,7 @@ namespace TL } } - /// Describes a real (i.e. possibly decimal) amount of Telegram Stars. See Derived classes: + /// Describes a real (i.e. possibly decimal) amount of Telegram Stars. See Derived classes: , public abstract partial class StarsAmountBase : IObject { /// The integer amount of Telegram Stars. @@ -20413,6 +20461,7 @@ namespace TL [TLDef(0xB0CD6617)] public sealed partial class BotVerifierSettings : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long icon; public string company; @@ -20420,6 +20469,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_custom_description = 0x1, can_modify_custom_description = 0x2, } @@ -20434,7 +20484,7 @@ namespace TL public string description; } - /// See + /// See Derived classes: , , , public abstract partial class StarGiftAttribute : IObject { } /// See [TLDef(0x39D99013)] @@ -20468,6 +20518,7 @@ namespace TL [TLDef(0xE0BFF26C)] public sealed partial class StarGiftAttributeOriginalDetails : StarGiftAttribute { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(0)] public Peer sender_id; public Peer recipient_id; @@ -20476,7 +20527,9 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_sender_id = 0x1, + /// Field has a value has_message = 0x2, } } @@ -20521,6 +20574,7 @@ namespace TL [TLDef(0xDFDA0499)] public sealed partial class SavedStarGift : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(1)] public Peer from_id; public DateTime date; @@ -20538,19 +20592,29 @@ namespace TL [Flags] public enum Flags : uint { name_hidden = 0x1, + /// Field has a value has_from_id = 0x2, + /// Field has a value has_message = 0x4, + /// Field has a value has_msg_id = 0x8, + /// Field has a value has_convert_stars = 0x10, unsaved = 0x20, + /// Field has a value has_upgrade_stars = 0x40, + /// Field has a value has_can_export_at = 0x80, + /// Field has a value has_transfer_stars = 0x100, refunded = 0x200, can_upgrade = 0x400, + /// Field has a value has_saved_id = 0x800, pinned_to_top = 0x1000, + /// Field has a value has_can_transfer_at = 0x2000, + /// Field has a value has_can_resell_at = 0x4000, } } @@ -20559,6 +20623,7 @@ namespace TL [TLDef(0x95F389B1)] public sealed partial class Payments_SavedStarGifts : IObject, IPeerResolver { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int count; [IfFlag(1)] public bool chat_notifications_enabled; @@ -20569,14 +20634,16 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_next_offset = 0x1, + /// Field has a value has_chat_notifications_enabled = 0x2, } /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// See Derived classes: , , public abstract partial class InputSavedStarGift : IObject { } /// See [TLDef(0x69279795)] @@ -20605,7 +20672,7 @@ namespace TL public string url; } - /// See + /// See Derived classes: , /// a value means paidReactionPrivacyDefault public abstract partial class PaidReactionPrivacy : IObject { } /// See @@ -20625,7 +20692,7 @@ namespace TL public long stars_amount; } - /// See + /// See Derived classes: , /// a value means requirementToContactEmpty public abstract partial class RequirementToContact : IObject { } /// See @@ -20642,6 +20709,7 @@ namespace TL [TLDef(0xA0624CF7)] public sealed partial class BusinessBotRights : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [Flags] public enum Flags : uint @@ -20667,6 +20735,7 @@ namespace TL [TLDef(0x71F276C4)] public sealed partial class DisallowedGiftsSettings : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [Flags] public enum Flags : uint @@ -20682,6 +20751,7 @@ namespace TL [TLDef(0xC69708D3)] public sealed partial class SponsoredPeer : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public byte[] random_id; public Peer peer; @@ -20690,7 +20760,9 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_sponsor_info = 0x1, + /// Field has a value has_additional_info = 0x2, } } @@ -20707,7 +20779,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// See Derived classes: , , public abstract partial class StarGiftAttributeId : IObject { } /// See [TLDef(0x48AAAE3C)] @@ -20740,6 +20812,7 @@ namespace TL [TLDef(0x947A12DF)] public sealed partial class Payments_ResaleStarGifts : IObject, IPeerResolver { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int count; public StarGiftBase[] gifts; @@ -20752,8 +20825,11 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_next_offset = 0x1, + /// Fields and have a value has_attributes = 0x2, + /// Field has a value has_counters = 0x4, } /// returns a or for the given Peer @@ -20789,6 +20865,7 @@ namespace TL [TLDef(0x49B92A26)] public sealed partial class TodoList : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public TextWithEntities title; public TodoItem[] list; @@ -20813,15 +20890,18 @@ namespace TL [TLDef(0x0E8E37E5)] public sealed partial class SuggestedPost : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(3)] public StarsAmountBase price; [IfFlag(0)] public DateTime schedule_date; [Flags] public enum Flags : uint { + /// Field has a value has_schedule_date = 0x1, accepted = 0x2, rejected = 0x4, + /// Field has a value has_price = 0x8, } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 0845d54..6c1c3b5 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1425,7 +1425,7 @@ namespace TL settings = settings, }); - /// See + /// See [bots: ✓] /// a null value means account.emojiStatusesNotModified public static Task Account_GetCollectibleEmojiStatuses(this Client client, long hash = default) => client.Invoke(new Account_GetCollectibleEmojiStatuses @@ -1433,7 +1433,7 @@ namespace TL hash = hash, }); - /// See + /// See [bots: ✓] public static Task Account_GetPaidMessagesRevenue(this Client client, InputUserBase user_id, InputPeer parent_peer = null) => client.Invoke(new Account_GetPaidMessagesRevenue { @@ -1442,7 +1442,7 @@ namespace TL user_id = user_id, }); - /// See + /// See [bots: ✓] 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 { @@ -1477,7 +1477,7 @@ namespace TL errors = errors, }); - /// See + /// See [bots: ✓] public static Task Users_GetRequirementsToContact(this Client client, params InputUserBase[] id) => client.Invoke(new Users_GetRequirementsToContact { @@ -1733,7 +1733,7 @@ namespace TL { }); - /// See + /// See [bots: ✓] /// a null value means contacts.sponsoredPeersEmpty public static Task Contacts_GetSponsoredPeers(this Client client, string q) => client.Invoke(new Contacts_GetSponsoredPeers @@ -4389,12 +4389,12 @@ namespace TL platform = platform, }); - /// Sends one or more paid Telegram Star reactions », transferring Telegram Stars » to a channel's balance. See Possible codes: 400 (details) + /// Sends one or more paid Telegram Star reactions », transferring Telegram Stars » to a channel's balance. See Possible codes: 400 (details) /// The channel /// The message to react to /// The number of stars to send (each will increment the reaction counter by one). /// Unique client message ID required to prevent message resending You can use - /// Each post with star reactions has a leaderboard with the top senders, but users can opt out of appearing there if they prefer more privacy.
If the user explicitly chose to make their paid reaction(s) private, pass to Messages_SendPaidReaction.private.
If the user explicitly chose to make their paid reaction(s) not private, pass to Messages_SendPaidReaction.private.
If the user did not make any explicit choice about the privacy of their paid reaction(s) (i.e. when reacting by clicking on an existing star reaction on a message), do not populate the Messages_SendPaidReaction.private flag. + /// Each post with star reactions has a leaderboard with the top senders, but users can opt out of appearing there if they prefer more privacy.
If the user explicitly chose to make their paid reaction(s) private, pass to Messages_SendPaidReaction.private.
If the user explicitly chose to make their paid reaction(s) not private, pass to Messages_SendPaidReaction.private.
If the user did not make any explicit choice about the privacy of their paid reaction(s) (i.e. when reacting by clicking on an existing star reaction on a message), do not populate the Messages_SendPaidReaction.private flag. public static Task Messages_SendPaidReaction(this Client client, InputPeer peer, int msg_id, int count, long random_id, PaidReactionPrivacy private_ = null) => client.Invoke(new Messages_SendPaidReaction { @@ -4507,7 +4507,7 @@ namespace TL hash = hash, }); - /// See + /// See Possible codes: 400 (details) public static Task Messages_ReportMessagesDelivery(this Client client, InputPeer peer, int[] id, bool push = false) => client.Invoke(new Messages_ReportMessagesDelivery { @@ -4516,7 +4516,7 @@ namespace TL id = id, }); - /// See + /// See [bots: ✓] public static Task Messages_GetSavedDialogsByID(this Client client, InputPeer[] ids, InputPeer parent_peer = null) => client.Invoke(new Messages_GetSavedDialogsByID { @@ -4525,7 +4525,7 @@ namespace TL ids = ids, }); - /// See + /// See [bots: ✓] public static Task Messages_ReadSavedHistory(this Client client, InputPeer parent_peer, InputPeer peer, int max_id = default) => client.Invoke(new Messages_ReadSavedHistory { @@ -4534,7 +4534,7 @@ namespace TL max_id = max_id, }); - /// See + /// See [bots: ✓] public static Task Messages_ToggleTodoCompleted(this Client client, InputPeer peer, int msg_id, int[] completed, params int[] incompleted) => client.Invoke(new Messages_ToggleTodoCompleted { @@ -4544,7 +4544,7 @@ namespace TL incompleted = incompleted, }); - /// See + /// See [bots: ✓] public static Task Messages_AppendTodoList(this Client client, InputPeer peer, int msg_id, params TodoItem[] list) => client.Invoke(new Messages_AppendTodoList { @@ -4553,7 +4553,7 @@ namespace TL list = list, }); - /// See + /// See [bots: ✓] public static Task Messages_ToggleSuggestedPostApproval(this Client client, InputPeer peer, int msg_id, DateTime? schedule_date = null, string reject_comment = null, bool reject = false) => client.Invoke(new Messages_ToggleSuggestedPostApproval { @@ -5648,7 +5648,7 @@ namespace TL limit = limit, }); - /// See + /// See [bots: ✓] 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 { @@ -5657,7 +5657,7 @@ namespace TL send_paid_messages_stars = send_paid_messages_stars, }); - /// See + /// See [bots: ✓] public static Task Channels_ToggleAutotranslation(this Client client, InputChannelBase channel, bool enabled) => client.Invoke(new Channels_ToggleAutotranslation { @@ -5665,7 +5665,7 @@ namespace TL enabled = enabled, }); - /// See + /// See [bots: ✓] public static Task Channels_GetMessageAuthor(this Client client, InputChannelBase channel, int id) => client.Invoke(new Channels_GetMessageAuthor { @@ -5967,7 +5967,7 @@ namespace TL duration_months = duration_months ?? default, }); - /// See + /// See [bots: ✓] Possible codes: 400 (details) public static Task Bots_SetCustomVerification(this Client client, InputPeer peer, InputUserBase bot = null, string custom_description = null, bool enabled = false) => client.Invoke(new Bots_SetCustomVerification { @@ -5977,7 +5977,7 @@ namespace TL custom_description = custom_description, }); - /// See + /// See Possible codes: 400 (details) public static Task Bots_GetBotRecommendations(this Client client, InputUserBase bot) => client.Invoke(new Bots_GetBotRecommendations { @@ -6384,7 +6384,7 @@ namespace TL gift_id = gift_id, }); - /// See + /// See Possible codes: 400 (details) public static Task Payments_UpgradeStarGift(this Client client, InputSavedStarGift stargift, bool keep_original_details = false) => client.Invoke(new Payments_UpgradeStarGift { @@ -6392,7 +6392,7 @@ namespace TL stargift = stargift, }); - /// See + /// See Possible codes: 400 (details) public static Task Payments_TransferStarGift(this Client client, InputSavedStarGift stargift, InputPeer to_id) => client.Invoke(new Payments_TransferStarGift { @@ -6400,14 +6400,15 @@ namespace TL to_id = to_id, }); - /// See + /// See [bots: ✓] public static Task Payments_GetUniqueStarGift(this Client client, string slug) => client.Invoke(new Payments_GetUniqueStarGift { slug = slug, }); - /// See + /// 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) => client.Invoke(new Payments_GetSavedStarGifts { @@ -6417,14 +6418,14 @@ namespace TL limit = limit, }); - /// See + /// See [bots: ✓] public static Task Payments_GetSavedStarGift(this Client client, params InputSavedStarGift[] stargift) => client.Invoke(new Payments_GetSavedStarGift { stargift = stargift, }); - /// See + /// See [bots: ✓] public static Task Payments_GetStarGiftWithdrawalUrl(this Client client, InputSavedStarGift stargift, InputCheckPasswordSRP password) => client.Invoke(new Payments_GetStarGiftWithdrawalUrl { @@ -6432,7 +6433,7 @@ namespace TL password = password, }); - /// See + /// See [bots: ✓] public static Task Payments_ToggleChatStarGiftNotifications(this Client client, InputPeer peer, bool enabled = false) => client.Invoke(new Payments_ToggleChatStarGiftNotifications { @@ -6440,7 +6441,7 @@ namespace TL peer = peer, }); - /// See + /// See [bots: ✓] public static Task Payments_ToggleStarGiftsPinnedToTop(this Client client, InputPeer peer, params InputSavedStarGift[] stargift) => client.Invoke(new Payments_ToggleStarGiftsPinnedToTop { @@ -6448,14 +6449,15 @@ namespace TL stargift = stargift, }); - /// See + /// See [bots: ✓] public static Task Payments_CanPurchaseStore(this Client client, InputStorePaymentPurpose purpose) => client.Invoke(new Payments_CanPurchaseStore { purpose = purpose, }); - /// See + /// See [bots: ✓] + /// Maximum number of results to return, see pagination public static Task Payments_GetResaleStarGifts(this Client client, long gift_id, string offset, int limit = int.MaxValue, long? attributes_hash = null, StarGiftAttributeId[] attributes = null, bool sort_by_price = false, bool sort_by_num = false) => client.Invoke(new Payments_GetResaleStarGifts { @@ -6467,7 +6469,7 @@ namespace TL limit = limit, }); - /// See + /// See [bots: ✓] public static Task Payments_UpdateStarGiftPrice(this Client client, InputSavedStarGift stargift, long resell_stars) => client.Invoke(new Payments_UpdateStarGiftPrice { @@ -6962,7 +6964,7 @@ namespace TL file = file, }); - /// See + /// See [bots: ✓] public static Task Phone_CreateConferenceCall(this Client client, int random_id, Int256? public_key = null, byte[] block = null, DataJSON params_ = null, bool muted = false, bool video_stopped = false, bool join = false) => client.Invoke(new Phone_CreateConferenceCall { @@ -6973,7 +6975,7 @@ namespace TL params_ = params_, }); - /// See + /// See [bots: ✓] public static Task Phone_DeleteConferenceCallParticipants(this Client client, InputGroupCallBase call, long[] ids, byte[] block, bool only_left = false, bool kick = false) => client.Invoke(new Phone_DeleteConferenceCallParticipants { @@ -6983,7 +6985,7 @@ namespace TL block = block, }); - /// See + /// See [bots: ✓] public static Task Phone_SendConferenceCallBroadcast(this Client client, InputGroupCallBase call, byte[] block) => client.Invoke(new Phone_SendConferenceCallBroadcast { @@ -6991,7 +6993,7 @@ namespace TL block = block, }); - /// See + /// See [bots: ✓] public static Task Phone_InviteConferenceCallParticipant(this Client client, InputGroupCallBase call, InputUserBase user_id, bool video = false) => client.Invoke(new Phone_InviteConferenceCallParticipant { @@ -7000,14 +7002,15 @@ namespace TL user_id = user_id, }); - /// See + /// See [bots: ✓] public static Task Phone_DeclineConferenceCallInvite(this Client client, int msg_id) => client.Invoke(new Phone_DeclineConferenceCallInvite { msg_id = msg_id, }); - /// See + /// See [bots: ✓] + /// Maximum number of results to return, see pagination public static Task Phone_GetGroupCallChainBlocks(this Client client, InputGroupCallBase call, int sub_chain_id, int offset = default, int limit = int.MaxValue) => client.Invoke(new Phone_GetGroupCallChainBlocks { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index bbb604f..cf405eb 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 = 207; // fetched 08/07/2025 17:40:58 + public const int Version = 209; // fetched 14/07/2025 20:10:02 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -1039,7 +1039,7 @@ namespace TL [0x455B853D] = typeof(MessageViews), [0xB6C4F543] = typeof(Messages_MessageViews), [0xA6341782] = typeof(Messages_DiscussionMessage), - [0xAFBC09DB] = typeof(MessageReplyHeader), + [0x6917560B] = typeof(MessageReplyHeader), [0x0E5AF939] = typeof(MessageReplyStoryHeader), [0x83D60FC2] = typeof(MessageReplies), [0xE8FD8014] = typeof(PeerBlocked), @@ -1222,7 +1222,7 @@ namespace TL [0xBD74CF49] = typeof(StoryViewPublicRepost), [0x59D78FC5] = typeof(Stories_StoryViewsList), [0xDE9EED1D] = typeof(Stories_StoryViews), - [0xB07038B0] = typeof(InputReplyToMessage), + [0x869FBE10] = typeof(InputReplyToMessage), [0x5881323A] = typeof(InputReplyToStory), [0x69D66C45] = typeof(InputReplyToMonoForum), [0x3FC9053B] = typeof(ExportedStoryLink), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 3d55ae8..8ab7179 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,8 +13,8 @@ WTelegramClient Wizou 0.0.0 - layer.207 - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 207 + layer.209 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 209 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From a8fa32dfd5bc558dffcb5728f77022a33f7c8998 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 18 Jul 2025 02:28:43 +0200 Subject: [PATCH 14/54] Support single-quote arguments in HTML --- src/Services.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Services.cs b/src/Services.cs index d62b877..bb536d2 100644 --- a/src/Services.cs +++ b/src/Services.cs @@ -401,6 +401,7 @@ namespace TL case "u": case "ins": ProcessEntity(); break; case "s": case "strike": case "del": ProcessEntity(); break; case "span class=\"tg-spoiler\"": + case "span class='tg-spoiler'": case "span" when closing: case "tg-spoiler": ProcessEntity(); break; case "code": ProcessEntity(); break; @@ -420,7 +421,8 @@ namespace TL prevEntity.length = offset - prevEntity.offset; } } - else if (tag.StartsWith("a href=\"") && tag[^1] == '"') + else if ((tag[^1] == '"' && tag.StartsWith("a href=\"")) + || (tag[^1] == '\'' && tag.StartsWith("a href='"))) { tag = HttpUtility.HtmlDecode(tag[8..^1]); if (tag.StartsWith("tg://user?id=") && long.TryParse(tag[13..], out var user_id) && users?.GetValueOrDefault(user_id)?.access_hash is long hash) @@ -428,12 +430,13 @@ namespace TL else entities.Add(new MessageEntityTextUrl { offset = offset, length = -1, url = tag }); } - else if (tag.StartsWith("code class=\"language-") && tag[^1] == '"') + else if ((tag[^1] == '"' && tag.StartsWith("code class=\"language-")) + || (tag[^1] == '\'' && tag.StartsWith("code class='language-"))) { if (entities.LastOrDefault(e => e.length == -1) is MessageEntityPre prevEntity) prevEntity.language = tag[21..^1]; } - else if (premium && (tag.StartsWith("tg-emoji emoji-id=\"") || tag.StartsWith("tg-emoji id=\""))) + else if (premium && (tag.StartsWith("tg-emoji emoji-id=\"") || tag.StartsWith("tg-emoji emoji-id='"))) entities.Add(new MessageEntityCustomEmoji { offset = offset, length = -1, document_id = long.Parse(tag[(tag.IndexOf('=') + 2)..^1]) }); break; } From e9543a690b1a332727d8ac1d054b59c48a3efe07 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 25 Jul 2025 01:03:30 +0200 Subject: [PATCH 15/54] Examples for download abort, and uploading streamable video (fix #325, thx @patelriki13) --- .github/workflows/telegram-api.yml | 3 ++- EXAMPLES.md | 37 +++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/.github/workflows/telegram-api.yml b/.github/workflows/telegram-api.yml index 9a69fd9..efd921a 100644 --- a/.github/workflows/telegram-api.yml +++ b/.github/workflows/telegram-api.yml @@ -12,7 +12,7 @@ jobs: if: contains(github.event.issue.labels.*.name, 'telegram api') runs-on: ubuntu-latest steps: - - uses: dessant/support-requests@v3.0.0 + - uses: dessant/support-requests@v4 with: support-label: 'telegram api' issue-comment: > @@ -26,3 +26,4 @@ jobs: If the above links didn't answer your problem, [click here to ask your question on **StackOverflow**](https://stackoverflow.com/questions/ask?tags=c%23+wtelegramclient+telegram-api) so the whole community can help and benefit. close-issue: true + issue-close-reason: 'not planned' diff --git a/EXAMPLES.md b/EXAMPLES.md index e32e10d..ac2daf1 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -210,7 +210,7 @@ that simplifies the download of a photo/document/file once you get a reference t See [Examples/Program_DownloadSavedMedia.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_DownloadSavedMedia.cs?ts=4#L28) that download all media files you forward to yourself (Saved Messages) -_Note: To abort an ongoing download, you can throw an exception via the `progress` callback argument._ +_Note: To abort an ongoing download, you can throw an exception via the `progress` callback argument. Example: `(t,s) => ct.ThrowIfCancellationRequested()`_ ## Upload a media file and post it with caption to a chat @@ -224,6 +224,41 @@ var inputFile = await client.UploadFileAsync(Filepath); await client.SendMediaAsync(peer, "Here is the photo", inputFile); ``` + +## Upload a streamable video with optional custom thumbnail +```csharp +var chats = await client.Messages_GetAllChats(); +InputPeer peer = chats.chats[1234567890]; // the chat we want +const string videoPath = @"C:\...\video.mp4"; +const string thumbnailPath = @"C:\...\thumbnail.jpg"; + +// Extract video information using FFMpegCore or similar library +var mediaInfo = await FFmpeg.GetMediaInfo(videoPath); +var videoStream = mediaInfo.VideoStreams.FirstOrDefault(); +int width = videoStream?.Width ?? 0; +int height = videoStream?.Height ?? 0; +int duration = (int)mediaInfo.Duration.TotalSeconds; + +// Upload video file +var inputFile = await Client.UploadFileAsync(videoPath); + +// Prepare InputMedia structure with video attributes +var media = new InputMediaUploadedDocument(inputFile, "video/mp4", + new DocumentAttributeVideo { w = width, h = height, duration = duration, + flags = DocumentAttributeVideo.Flags.supports_streaming }); +if (thumbnailPath != null) +{ + // upload custom thumbnail and complete InputMedia structure + var inputThumb = await client.UploadFileAsync(thumbnailPath); + media.thumb = inputThumb; + media.flags |= InputMediaUploadedDocument.Flags.has_thumb; +} + +// Send the media message +await client.SendMessageAsync(peer, "caption", media); +``` +*Note: This example requires FFMpegCore NuGet package for video metadata extraction. You can also manually set width, height, and duration if you know the video properties.* + ## Send a grouped media album using photos from various sources ```csharp 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 16/54] 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 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-209-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-210-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 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")) From d9e4b7cc0f653476ffa599203f1dee118fb8d480 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 1 Aug 2025 00:17:12 +0200 Subject: [PATCH 17/54] CollectUsersChats: don't update usernames from min info (thx @riniba) --- src/Services.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Services.cs b/src/Services.cs index bb536d2..a83eed6 100644 --- a/src/Services.cs +++ b/src/Services.cs @@ -29,7 +29,9 @@ namespace TL if (!user.flags.HasFlag(User.Flags.min) || !_users.TryGetValue(user.id, out var prevUser) || prevUser.flags.HasFlag(User.Flags.min)) _users[user.id] = user; else - { // update previously full user from min user: + { // update previously full user from min user: + // see https://github.com/tdlib/td/blob/master/td/telegram/UserManager.cpp#L2689 + // and https://github.com/telegramdesktop/tdesktop/blob/dev/Telegram/SourceFiles/data/data_session.cpp#L515 const User.Flags updated_flags = (User.Flags)0x5DAFE000; const User.Flags2 updated_flags2 = (User.Flags2)0x711; // tdlib updated flags: deleted | bot | bot_chat_history | bot_nochats | verified | bot_inline_geo @@ -53,7 +55,7 @@ namespace TL if (user.lang_code != null) prevUser.lang_code = user.lang_code; // tdlib: updated if present ; tdesktop: ignored prevUser.emoji_status = user.emoji_status; // tdlib/tdesktop: updated - prevUser.usernames = user.usernames; // tdlib: not updated ; tdesktop: updated + //prevUser.usernames = user.usernames; // tdlib/tdesktop: not updated if (user.stories_max_id > 0) prevUser.stories_max_id = user.stories_max_id; // tdlib: updated if > 0 ; tdesktop: not updated prevUser.color = user.color; // tdlib/tdesktop: updated From 7faa3873f8255cdc38488b86ca932d8e46d8337e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 1 Aug 2025 00:49:57 +0200 Subject: [PATCH 18/54] API Layer 211: Stories Albums, user's pending Stars Rating, SearchPosts + Check Flood, ... (that might not be the most recent API layer. check https://patreon.com/wizou for the latest layers) --- README.md | 2 +- src/TL.Schema.cs | 122 ++++++++++++++++++---- src/TL.SchemaFuncs.cs | 204 +++++++++++++++++++++++++++++++++---- src/TL.Table.cs | 20 ++-- src/WTelegramClient.csproj | 4 +- 5 files changed, 303 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index a89d3b9..8bb243f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-210-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-211-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 c887407..21e4c2b 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -818,6 +818,7 @@ namespace TL /// Monthly Active Users (MAU) of this bot (may be absent for small bots). [IfFlag(44)] public int bot_active_users; [IfFlag(46)] public long bot_verification_icon; + /// If set, the user has enabled paid messages », we might need to pay the specified amount of Stars to send them messages, depending on the configured exceptions: check .send_paid_messages_stars or Users_GetRequirementsToContact to see if the currently logged in user actually has to pay or not, see here » for the full flow. [IfFlag(47)] public long send_paid_messages_stars; [Flags] public enum Flags : uint @@ -1124,6 +1125,7 @@ namespace TL /// Expiration date of the Telegram Star subscription » the current user has bought to gain access to this channel. [IfFlag(43)] public DateTime subscription_until_date; [IfFlag(45)] public long bot_verification_icon; + /// If set, this supergroup or monoforum has enabled paid messages », we might need to pay the specified amount of Stars to send messages to it, depending on the configured exceptions: check .send_paid_messages_stars to see if the currently logged in user actually has to pay or not, see here » for the full flow (only set for the monoforum, not the associated channel). [IfFlag(46)] public long send_paid_messages_stars; [IfFlag(50)] public long linked_monoforum_id; @@ -1491,6 +1493,7 @@ namespace TL [IfFlag(42)] public StickerSet emojiset; [IfFlag(49)] public BotVerification bot_verification; [IfFlag(50)] public int stargifts_count; + /// If set and bigger than 0, this supergroup, monoforum or the monoforum associated to this channel has enabled paid messages » and we must pay the specified amount of Stars to send messages to it, see here » for the full flow.
This flag will be set both for the monoforum and for of the associated channel).
If set and equal to 0, the monoforum requires payment in general but we were exempted from paying.
[IfFlag(53)] public long send_paid_messages_stars; [Flags] public enum Flags : uint @@ -1841,7 +1844,9 @@ namespace TL [IfFlag(34)] public long effect; /// Represents a fact-check ». [IfFlag(35)] public FactCheck factcheck; + /// Used for Telegram Gateway verification messages: if set and the current unixtime is bigger than the specified unixtime, invoke Messages_ReportMessagesDelivery passing the ID and the peer of this message as soon as it is received by the client (optionally batching requests for the same peer). [IfFlag(37)] public DateTime report_delivery_until_date; + /// The amount of stars the sender has paid to send the message, see here » for more info. [IfFlag(38)] public long paid_message_stars; [IfFlag(39)] public SuggestedPost suggested_post; @@ -1965,6 +1970,7 @@ namespace TL public DateTime date; /// Event connected with the service message public MessageAction action; + /// Reactions ». [IfFlag(20)] public MessageReactions reactions; /// Time To Live of the message, once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. [IfFlag(25)] public int ttl_period; @@ -1981,6 +1987,7 @@ namespace TL media_unread = 0x20, /// Field has a value has_from_id = 0x100, + /// Whether you can react to this messages ». reactions_are_possible = 0x200, /// Whether the message is silent silent = 0x2000, @@ -2007,6 +2014,7 @@ namespace TL public override MessageReplyHeaderBase ReplyTo => reply_to; /// Message date public override DateTime Date => date; + /// Reactions ». public override MessageReactions Reactions => reactions; /// Time To Live of the message, once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. public override int TtlPeriod => ttl_period; @@ -2967,7 +2975,7 @@ namespace TL } } /// See - [TLDef(0x2E3AE60E)] + [TLDef(0x34F762F3)] public sealed partial class MessageActionStarGiftUnique : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -2978,7 +2986,7 @@ namespace TL [IfFlag(6)] public Peer from_id; [IfFlag(7)] public Peer peer; [IfFlag(7)] public long saved_id; - [IfFlag(8)] public long resale_stars; + [IfFlag(8)] public StarsAmountBase resale_amount; [IfFlag(9)] public DateTime can_transfer_at; [IfFlag(10)] public DateTime can_resell_at; @@ -2996,8 +3004,8 @@ namespace TL has_from_id = 0x40, /// Fields and have a value has_peer = 0x80, - /// Field has a value - has_resale_stars = 0x100, + /// Field has a value + has_resale_amount = 0x100, /// Field has a value has_can_transfer_at = 0x200, /// Field has a value @@ -3596,6 +3604,7 @@ namespace TL [IfFlag(13)] public long business_bot_id; /// Contains a deep link », used to open a management menu in the business bot. This flag is set if and only if business_bot_id is set. [IfFlag(13)] public string business_bot_manage_url; + /// All users that must pay us » to send us private messages will have this flag set only for us, containing the amount of required stars, see here » for more info on paid messages. [IfFlag(14)] public long charge_paid_message_stars; [IfFlag(15)] public string registration_month; [IfFlag(16)] public string phone_country; @@ -3742,7 +3751,7 @@ namespace TL } /// Extended user info See - [TLDef(0x29DE80BE)] + [TLDef(0x7E63CE1F)] public sealed partial class UserFull : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -3806,9 +3815,12 @@ namespace TL /// This bot has an active referral program » [IfFlag(43)] public StarRefProgram starref_program; [IfFlag(44)] public BotVerification bot_verification; + /// If set and bigger than 0, this user has enabled paid messages » and we must pay the specified amount of Stars to send messages to them, see here » for the full flow.
If set and equal to 0, the user requires payment in general but we were exempted from paying for any of the reasons specified in the docs ».
[IfFlag(46)] public long send_paid_messages_stars; [IfFlag(47)] public DisallowedGiftsSettings disallowed_gifts; [IfFlag(49)] public StarsRating stars_rating; + [IfFlag(50)] public StarsRating stars_my_pending_rating; + [IfFlag(50)] public DateTime stars_my_pending_rating_date; [Flags] public enum Flags : uint { @@ -3903,6 +3915,8 @@ namespace TL display_gifts_button = 0x10000, /// Field has a value has_stars_rating = 0x20000, + /// Fields and have a value + has_stars_my_pending_rating = 0x40000, } } @@ -4056,7 +4070,7 @@ namespace TL public override IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Incomplete list of messages and auxiliary data. See - [TLDef(0x3A54685E)] + [TLDef(0x762B263D)] public sealed partial class Messages_MessagesSlice : Messages_Messages, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -4067,6 +4081,7 @@ namespace TL [IfFlag(0)] public int next_rate; /// Indicates the absolute position of messages[0] within the total result set with count count.
This is useful, for example, if the result was fetched using offset_id, and we need to display a progress/total counter (like photo 134 of 200, for all media in a chat, we could simply use photo ${offset_id_offset} of ${count}.
[IfFlag(2)] public int offset_id_offset; + [IfFlag(3)] public SearchPostsFlood search_flood; [Flags] public enum Flags : uint { @@ -4076,6 +4091,8 @@ namespace TL inexact = 0x2, /// Field has a value has_offset_id_offset = 0x4, + /// Field has a value + has_search_flood = 0x8, } } ///
Channel messages See @@ -7163,7 +7180,7 @@ namespace TL Birthday = 0xD65A11CC, ///Whether received gifts will be automatically displayed on our profile StarGiftsAutoSave = 0xE1732341, - ///See + ///Who can send you messages without paying, if paid messages » are enabled. NoPaidMessages = 0xBDC597B4, } @@ -7194,7 +7211,7 @@ namespace TL Birthday = 0x2000A518, ///Whether received gifts will be automatically displayed on our profile StarGiftsAutoSave = 0x2CA4FDF8, - ///See + ///Who can send you messages without paying, if paid messages » are enabled. NoPaidMessages = 0x17D348D2, } @@ -7230,14 +7247,14 @@ namespace TL [TLDef(0x840649CF)] public sealed partial class InputPrivacyValueAllowChatParticipants : InputPrivacyRule { - /// Allowed chat IDs + /// Allowed chat IDs (either a or a supergroup ID, verbatim the way it is received in the constructor (i.e. unlike with bot API IDs, here group and supergroup IDs should be treated in the same way)). public long[] chats; } /// Disallow only participants of certain chats See [TLDef(0xE94F0F86)] public sealed partial class InputPrivacyValueDisallowChatParticipants : InputPrivacyRule { - /// Disallowed chat IDs + /// Disallowed chat IDs (either a or a supergroup ID, verbatim the way it is received in the constructor (i.e. unlike with bot API IDs, here group and supergroup IDs should be treated in the same way)). public long[] chats; } /// Allow only close friends » See @@ -7285,14 +7302,14 @@ namespace TL [TLDef(0x6B134E8E)] public sealed partial class PrivacyValueAllowChatParticipants : PrivacyRule { - /// Allowed chats + /// Allowed chat IDs (either a or a supergroup ID, verbatim the way it is received in the constructor (i.e. unlike with bot API IDs, here group and supergroup IDs should be treated in the same way)). public long[] chats; } /// Disallow only participants of certain chats See [TLDef(0x41C87565)] public sealed partial class PrivacyValueDisallowChatParticipants : PrivacyRule { - /// Disallowed chats + /// Disallowed chats IDs (either a or a supergroup ID, verbatim the way it is received in the constructor (i.e. unlike with bot API IDs, here group and supergroup IDs should be treated in the same way)). public long[] chats; } /// Allow only close friends » See @@ -14255,6 +14272,12 @@ namespace TL { public StarGiftBase gift; } + /// See + [TLDef(0x31CAD303)] + public sealed partial class WebPageAttributeStarGiftCollection : WebPageAttribute + { + public DocumentBase[] icons; + } /// How users voted in a poll See [TLDef(0x4899484E)] @@ -16190,11 +16213,17 @@ namespace TL public long stars; } /// See - [TLDef(0x63CBC38C)] + [TLDef(0xC39F5324)] public sealed partial class InputInvoiceStarGiftResale : InputInvoice { + public Flags flags; public string slug; public InputPeer to_id; + + [Flags] public enum Flags : uint + { + ton = 0x1, + } } /// Exported invoice deep link See @@ -17433,7 +17462,7 @@ namespace TL public override int ID => id; } /// Represents a story. See - [TLDef(0x79B26A24)] + [TLDef(0xEDF164F1)] public sealed partial class StoryItem : StoryItemBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -17462,6 +17491,7 @@ namespace TL [IfFlag(3)] public StoryViews views; /// The reaction we sent. [IfFlag(15)] public Reaction sent_reaction; + [IfFlag(19)] public int[] albums; [Flags] public enum Flags : uint { @@ -17499,6 +17529,8 @@ namespace TL has_fwd_from = 0x20000, /// Field has a value has_from_id = 0x40000, + /// Field has a value + has_albums = 0x80000, } /// ID of the story. @@ -20155,7 +20187,7 @@ namespace TL public override Peer ReleasedBy => released_by; } /// See - [TLDef(0xF63778AE)] + [TLDef(0x3A274D50)] public sealed partial class StarGiftUnique : StarGiftBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -20171,7 +20203,7 @@ namespace TL public int availability_issued; public int availability_total; [IfFlag(3)] public string gift_address; - [IfFlag(4)] public long resell_stars; + [IfFlag(4)] public StarsAmountBase[] resell_amount; [IfFlag(5)] public Peer released_by; [Flags] public enum Flags : uint @@ -20184,11 +20216,12 @@ namespace TL has_owner_address = 0x4, /// Field has a value has_gift_address = 0x8, - /// Field has a value - has_resell_stars = 0x10, + /// Field has a value + has_resell_amount = 0x10, /// Field has a value has_released_by = 0x20, require_premium = 0x40, + resale_ton_only = 0x80, } public override long ID => id; @@ -20697,23 +20730,25 @@ namespace TL public InputPeer peer; } - /// See + /// Total number of non-refunded Telegram Stars a user has spent on sending us messages either directly or through a channel, see here » for more info on paid messages. See [TLDef(0x1E109708)] public sealed partial class Account_PaidMessagesRevenue : IObject { + /// Amount in Stars. public long stars_amount; } - /// See Derived classes: , + /// Specifies a requirement that must be satisfied in order to contact a user. See Derived classes: , /// a value means requirementToContactEmpty public abstract partial class RequirementToContact : IObject { } - /// See + /// This user requires us to buy a Premium subscription in order to contact them. See [TLDef(0xE581E4E9)] public sealed partial class RequirementToContactPremium : RequirementToContact { } - /// See + /// This user requires us to pay the specified amount of Telegram Stars to send them a message, see here » for the full flow. See [TLDef(0xB4F67E93)] public sealed partial class RequirementToContactPaidMessages : RequirementToContact { + /// The required amount of Telegram Stars. public long stars_amount; } @@ -20958,4 +20993,47 @@ namespace TL { public StarGiftCollection[] collections; } + + /// See + [TLDef(0x9325705A)] + public sealed partial class StoryAlbum : IObject + { + public Flags flags; + public int album_id; + public string title; + [IfFlag(0)] public PhotoBase icon_photo; + [IfFlag(1)] public DocumentBase icon_video; + + [Flags] public enum Flags : uint + { + has_icon_photo = 0x1, + has_icon_video = 0x2, + } + } + + /// See + /// a value means stories.albumsNotModified + [TLDef(0xC3987A3A)] + public sealed partial class Stories_Albums : IObject + { + public long hash; + public StoryAlbum[] albums; + } + + /// See + [TLDef(0x3E0B5B6A)] + public sealed partial class SearchPostsFlood : IObject + { + public Flags flags; + public int total_daily; + public int remains; + [IfFlag(1)] public int wait_till; + public long stars_amount; + + [Flags] public enum Flags : uint + { + query_is_free = 0x1, + has_wait_till = 0x2, + } + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index a066365..c10d6f0 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1433,7 +1433,7 @@ namespace TL hash = hash, }); - /// 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: ✓] + /// 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) @@ -1446,7 +1446,7 @@ namespace TL /// 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, requires the user to pay in order to send us messages (can only be used by monoforums, not users, i.e. parent_peer must be set if this flag is set; users must instead use the privacy setting to remove a previously added exemption).
If not set, allows the user to send us messages without paying (can be used by both monoforums and users). /// 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) @@ -1483,7 +1483,8 @@ namespace TL errors = errors, }); - /// See [bots: ✓] + /// Check whether we can write to the specified users, used to implement bulk checks for Premium-only messages » and paid messages ». See [bots: ✓] + /// Users to check. public static Task Users_GetRequirementsToContact(this Client client, params InputUserBase[] id) => client.Invoke(new Users_GetRequirementsToContact { @@ -1911,6 +1912,7 @@ namespace TL /// Send this message as the specified peer /// Add the message to the specified quick reply shortcut », instead. /// Specifies a message effect » to use for the message. + /// For paid messages », specifies the amount of Telegram Stars the user has agreed to pay in order to send the message. public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, SuggestedPost suggested_post = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_SendMessage { @@ -1948,6 +1950,7 @@ namespace TL /// Send this message as the specified peer /// Add the message to the specified quick reply shortcut », instead. /// Specifies a message effect » to use for the message. + /// For paid messages », specifies the amount of Telegram Stars the user has agreed to pay in order to send the message. public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, SuggestedPost suggested_post = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_SendMedia { @@ -1983,6 +1986,7 @@ namespace TL /// Scheduled message date for scheduled messages /// Forward the messages as the specified peer /// Add the messages to the specified quick reply shortcut », instead. + /// For paid messages », specifies the amount of Telegram Stars the user has agreed to pay in order to send the message. public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, int? video_timestamp = null, long? allow_paid_stars = null, InputReplyTo reply_to = null, SuggestedPost suggested_post = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_ForwardMessages { @@ -2496,6 +2500,7 @@ namespace TL /// Scheduled message date for scheduled messages /// Send this message as the specified peer /// Add the message to the specified quick reply shortcut », instead. + /// For paid messages », specifies the amount of Telegram Stars the user has agreed to pay in order to send the message. public static Task Messages_SendInlineBotResult(this Client client, InputPeer peer, long random_id, long query_id, string id, InputReplyTo reply_to = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? allow_paid_stars = null, bool silent = false, bool background = false, bool clear_draft = false, bool hide_via = false) => client.Invoke(new Messages_SendInlineBotResult { @@ -2945,6 +2950,7 @@ namespace TL /// Send this message as the specified peer /// Add the message to the specified quick reply shortcut », instead. /// Specifies a message effect » to use for the message. + /// For paid messages », specifies the amount of Telegram Stars the user has agreed to pay in order to send the message. public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, InputReplyTo reply_to = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_SendMultiMedia { @@ -4513,7 +4519,8 @@ namespace TL hash = hash, }); - /// See Possible codes: 400 (details) + /// Used for Telegram Gateway verification messages »: indicate to the server that one or more s were received by the client, if requested by the .report_delivery_until_date flag or the equivalent flag in push notifications. See Possible codes: 400 (details) + /// If set, public static Task Messages_ReportMessagesDelivery(this Client client, InputPeer peer, int[] id, bool push = false) => client.Invoke(new Messages_ReportMessagesDelivery { @@ -5644,14 +5651,17 @@ namespace TL /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination - public static Task Channels_SearchPosts(this Client client, string hashtag, int offset_rate = default, InputPeer offset_peer = null, int offset_id = default, int limit = int.MaxValue) + public static Task Channels_SearchPosts(this Client client, int offset_rate = default, InputPeer offset_peer = null, int offset_id = default, int limit = int.MaxValue, string hashtag = null, string query = null, long? allow_paid_stars = null) => client.Invoke(new Channels_SearchPosts { + flags = (Channels_SearchPosts.Flags)((hashtag != null ? 0x1 : 0) | (query != null ? 0x2 : 0) | (allow_paid_stars != null ? 0x4 : 0)), hashtag = hashtag, + query = query, offset_rate = offset_rate, offset_peer = offset_peer, offset_id = offset_id, limit = limit, + allow_paid_stars = allow_paid_stars ?? default, }); /// Enable or disable paid messages » in this supergroup or monoforum. See [bots: ✓] @@ -5682,6 +5692,14 @@ namespace TL id = id, }); + /// See + public static Task Channels_CheckSearchPostsFlood(this Client client, string query = null) + => client.Invoke(new Channels_CheckSearchPostsFlood + { + flags = (Channels_CheckSearchPostsFlood.Flags)(query != null ? 0x1 : 0), + query = query, + }); + /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) /// The method name /// JSON-serialized method parameters @@ -5976,7 +5994,11 @@ namespace TL duration_months = duration_months ?? default, }); - /// See [bots: ✓] Possible codes: 400 (details) + /// Verify a user or chat on behalf of an organization ». See [bots: ✓] Possible codes: 400 (details) + /// If set, adds the verification; otherwise removes verification. + /// Must not be set if invoked by a bot, must be set to the ID of an owned bot if invoked by a user. + /// The peer to verify + /// Custom description for the verification, the UTF-8 length limit for this field is contained in bot_verification_description_length_limit ».
If not set, Was verified by organization "organization_name" will be used as description. public static Task Bots_SetCustomVerification(this Client client, InputPeer peer, InputUserBase bot = null, string custom_description = null, bool enabled = false) => client.Invoke(new Bots_SetCustomVerification { @@ -5986,7 +6008,8 @@ namespace TL custom_description = custom_description, }); - /// See Possible codes: 400 (details) + /// Obtain a list of similarly themed bots, selected based on similarities in their subscriber bases, see here » for more info. See Possible codes: 400 (details) + /// The method will return bots related to the passed bot. public static Task Bots_GetBotRecommendations(this Client client, InputUserBase bot) => client.Invoke(new Bots_GetBotRecommendations { @@ -6480,11 +6503,11 @@ namespace TL }); /// See [bots: ✓] - public static Task Payments_UpdateStarGiftPrice(this Client client, InputSavedStarGift stargift, long resell_stars) + public static Task Payments_UpdateStarGiftPrice(this Client client, InputSavedStarGift stargift, StarsAmountBase resell_amount) => client.Invoke(new Payments_UpdateStarGiftPrice { stargift = stargift, - resell_stars = resell_stars, + resell_amount = resell_amount, }); /// See @@ -7021,7 +7044,14 @@ namespace TL file = file, }); - /// See [bots: ✓] + /// Create and optionally join a new conference call. See [bots: ✓] + /// If set, mute our microphone when joining the call (can only be used if join is set). + /// If set, our video stream is disabled (can only be used if join is set). + /// If set, also join the call, otherwise just create the call link. + /// Unique client message ID required to prevent creation of duplicate group calls. + /// Public key (can only be used if join is set). + /// Initial blockchain block (can only be used if join is set). + /// Parameters from tgcalls (can only be used if join is set). public static Task Phone_CreateConferenceCall(this Client client, int random_id, Int256? public_key = null, byte[] block = null, DataJSON params_ = null, bool muted = false, bool video_stopped = false, bool join = false) => client.Invoke(new Phone_CreateConferenceCall { @@ -7349,10 +7379,10 @@ namespace TL /// Period after which the story is moved to archive (and to the profile if pinned is set), in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise. /// If set, indicates that this story is a repost of story with ID fwd_from_story posted by the peer in fwd_from_id. /// If set, indicates that this story is a repost of story with ID fwd_from_story posted by the peer in fwd_from_id. - public static Task Stories_SendStory(this Client client, InputPeer peer, InputMedia media, InputPrivacyRule[] privacy_rules, long random_id, string caption = null, MessageEntity[] entities = null, int? period = null, MediaArea[] media_areas = null, InputPeer fwd_from_id = null, int? fwd_from_story = null, bool pinned = false, bool noforwards = false, bool fwd_modified = false) + public static Task Stories_SendStory(this Client client, InputPeer peer, InputMedia media, InputPrivacyRule[] privacy_rules, long random_id, string caption = null, MessageEntity[] entities = null, int? period = null, MediaArea[] media_areas = null, InputPeer fwd_from_id = null, int? fwd_from_story = null, int[] albums = null, bool pinned = false, bool noforwards = false, bool fwd_modified = false) => client.Invoke(new Stories_SendStory { - flags = (Stories_SendStory.Flags)((caption != null ? 0x1 : 0) | (entities != null ? 0x2 : 0) | (period != null ? 0x8 : 0) | (media_areas != null ? 0x20 : 0) | (fwd_from_id != null ? 0x40 : 0) | (fwd_from_story != null ? 0x40 : 0) | (pinned ? 0x4 : 0) | (noforwards ? 0x10 : 0) | (fwd_modified ? 0x80 : 0)), + flags = (Stories_SendStory.Flags)((caption != null ? 0x1 : 0) | (entities != null ? 0x2 : 0) | (period != null ? 0x8 : 0) | (media_areas != null ? 0x20 : 0) | (fwd_from_id != null ? 0x40 : 0) | (fwd_from_story != null ? 0x40 : 0) | (albums != null ? 0x100 : 0) | (pinned ? 0x4 : 0) | (noforwards ? 0x10 : 0) | (fwd_modified ? 0x80 : 0)), peer = peer, media = media, media_areas = media_areas, @@ -7363,6 +7393,7 @@ namespace TL period = period ?? default, fwd_from_id = fwd_from_id, fwd_from_story = fwd_from_story ?? default, + albums = albums, }); /// Edit an uploaded story See Possible codes: 400 (details) @@ -7641,6 +7672,63 @@ namespace TL limit = limit, }); + /// See + public static Task Stories_CreateAlbum(this Client client, InputPeer peer, string title, params int[] stories) + => client.Invoke(new Stories_CreateAlbum + { + peer = peer, + title = title, + stories = stories, + }); + + /// See + public static Task Stories_UpdateAlbum(this Client client, InputPeer peer, int album_id, string title = null, int[] delete_stories = null, int[] add_stories = null, int[] order = null) + => client.Invoke(new Stories_UpdateAlbum + { + flags = (Stories_UpdateAlbum.Flags)((title != null ? 0x1 : 0) | (delete_stories != null ? 0x2 : 0) | (add_stories != null ? 0x4 : 0) | (order != null ? 0x8 : 0)), + peer = peer, + album_id = album_id, + title = title, + delete_stories = delete_stories, + add_stories = add_stories, + order = order, + }); + + /// See + public static Task Stories_ReorderAlbums(this Client client, InputPeer peer, params int[] order) + => client.Invoke(new Stories_ReorderAlbums + { + peer = peer, + order = order, + }); + + /// See + public static Task Stories_DeleteAlbum(this Client client, InputPeer peer, int album_id) + => client.Invoke(new Stories_DeleteAlbum + { + peer = peer, + album_id = album_id, + }); + + /// See + /// a null value means stories.albumsNotModified + public static Task Stories_GetAlbums(this Client client, InputPeer peer, long hash = default) + => client.Invoke(new Stories_GetAlbums + { + peer = peer, + hash = hash, + }); + + /// See + public static Task Stories_GetAlbumStories(this Client client, InputPeer peer, int album_id, int offset = default, int limit = int.MaxValue) + => client.Invoke(new Stories_GetAlbumStories + { + peer = peer, + album_id = album_id, + offset = offset, + limit = limit, + }); + /// Obtains info about the boosts that were applied to a certain channel or supergroup (admins only) See Possible codes: 400 (details) /// Whether to return only info about boosts received from gift codes and giveaways created by the channel/supergroup » /// The channel/supergroup @@ -12454,14 +12542,24 @@ namespace TL.Methods public bool restricted; } - [TLDef(0xD19F987B)] + [TLDef(0xF2C4F24D)] public sealed partial class Channels_SearchPosts : IMethod { - public string hashtag; + public Flags flags; + [IfFlag(0)] public string hashtag; + [IfFlag(1)] public string query; public int offset_rate; public InputPeer offset_peer; public int offset_id; public int limit; + [IfFlag(2)] public long allow_paid_stars; + + [Flags] public enum Flags : uint + { + has_hashtag = 0x1, + has_query = 0x2, + has_allow_paid_stars = 0x4, + } } [TLDef(0x4B12327B)] @@ -12491,6 +12589,18 @@ namespace TL.Methods public int id; } + [TLDef(0x22567115)] + public sealed partial class Channels_CheckSearchPostsFlood : IMethod + { + public Flags flags; + [IfFlag(0)] public string query; + + [Flags] public enum Flags : uint + { + has_query = 0x1, + } + } + [TLDef(0xAA2769ED)] public sealed partial class Bots_SendCustomRequest : IMethod { @@ -13212,11 +13322,11 @@ namespace TL.Methods } } - [TLDef(0x3BAEA4E1)] + [TLDef(0xEDBE6CCB)] public sealed partial class Payments_UpdateStarGiftPrice : IMethod { public InputSavedStarGift stargift; - public long resell_stars; + public StarsAmountBase resell_amount; } [TLDef(0x1F4A0E87)] @@ -13948,7 +14058,7 @@ namespace TL.Methods public InputPeer peer; } - [TLDef(0xE4E6694B)] + [TLDef(0x737FC2EC)] public sealed partial class Stories_SendStory : IMethod { public Flags flags; @@ -13962,6 +14072,7 @@ namespace TL.Methods [IfFlag(3)] public int period; [IfFlag(6)] public InputPeer fwd_from_id; [IfFlag(6)] public int fwd_from_story; + [IfFlag(8)] public int[] albums; [Flags] public enum Flags : uint { @@ -13973,6 +14084,7 @@ namespace TL.Methods has_media_areas = 0x20, has_fwd_from_id = 0x40, fwd_modified = 0x80, + has_albums = 0x100, } } @@ -14205,6 +14317,64 @@ namespace TL.Methods } } + [TLDef(0xA36396E5)] + public sealed partial class Stories_CreateAlbum : IMethod + { + public InputPeer peer; + public string title; + public int[] stories; + } + + [TLDef(0x5E5259B6)] + public sealed partial class Stories_UpdateAlbum : IMethod + { + public Flags flags; + public InputPeer peer; + public int album_id; + [IfFlag(0)] public string title; + [IfFlag(1)] public int[] delete_stories; + [IfFlag(2)] public int[] add_stories; + [IfFlag(3)] public int[] order; + + [Flags] public enum Flags : uint + { + has_title = 0x1, + has_delete_stories = 0x2, + has_add_stories = 0x4, + has_order = 0x8, + } + } + + [TLDef(0x8535FBD9)] + public sealed partial class Stories_ReorderAlbums : IMethod + { + public InputPeer peer; + public int[] order; + } + + [TLDef(0x8D3456D0)] + public sealed partial class Stories_DeleteAlbum : IMethod + { + public InputPeer peer; + public int album_id; + } + + [TLDef(0x25B3EAC7)] + public sealed partial class Stories_GetAlbums : IMethod + { + public InputPeer peer; + public long hash; + } + + [TLDef(0xAC806D61)] + public sealed partial class Stories_GetAlbumStories : IMethod + { + public InputPeer peer; + public int album_id; + public int offset; + public int limit; + } + [TLDef(0x60F67660)] public sealed partial class Premium_GetBoostsList : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 6745b43..3479f87 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 = 210; // fetched 25/07/2025 14:54:33 + public const int Version = 211; // fetched 31/07/2025 22:39:04 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -216,7 +216,7 @@ namespace TL [0x45D5B021] = typeof(MessageActionGiftStars), [0xB00C47A2] = typeof(MessageActionPrizeStars), [0x4717E8A4] = typeof(MessageActionStarGift), - [0x2E3AE60E] = typeof(MessageActionStarGiftUnique), + [0x34F762F3] = typeof(MessageActionStarGiftUnique), [0xAC1F1FCD] = typeof(MessageActionPaidMessagesRefunded), [0x84B88578] = typeof(MessageActionPaidMessagesPrice), [0x2FFE2F7A] = typeof(MessageActionConferenceCall), @@ -254,7 +254,7 @@ namespace TL [0xF47741F7] = typeof(PeerSettings), [0xA437C3ED] = typeof(WallPaper), [0xE0804116] = typeof(WallPaperNoFile), - [0x29DE80BE] = typeof(UserFull), + [0x7E63CE1F] = typeof(UserFull), [0x145ADE0B] = typeof(Contact), [0xC13E3C50] = typeof(ImportedContact), [0x16D9703B] = typeof(ContactStatus), @@ -267,7 +267,7 @@ namespace TL [0x71E094F3] = typeof(Messages_DialogsSlice), [0xF0E3E596] = typeof(Messages_DialogsNotModified), [0x8C718E87] = typeof(Messages_Messages), - [0x3A54685E] = typeof(Messages_MessagesSlice), + [0x762B263D] = typeof(Messages_MessagesSlice), [0xC776BA4E] = typeof(Messages_ChannelMessages), [0x74535F21] = typeof(Messages_MessagesNotModified), [0x64FF9FD5] = typeof(Messages_Chats), @@ -1008,6 +1008,7 @@ namespace TL [0x2E94C3E7] = typeof(WebPageAttributeStory), [0x50CC03D3] = typeof(WebPageAttributeStickerSet), [0xCF6F6DB8] = typeof(WebPageAttributeUniqueStarGift), + [0x31CAD303] = typeof(WebPageAttributeStarGiftCollection), [0x4899484E] = typeof(Messages_VotesList), [0xF568028A] = typeof(BankCardOpenUrl), [0x3E24E573] = typeof(Payments_BankCardData), @@ -1128,7 +1129,7 @@ namespace TL [0x4A5F5BD9] = typeof(InputInvoiceStarGiftTransfer), [0xDABAB2EF] = typeof(InputInvoicePremiumGiftStars), [0xF4997E42] = typeof(InputInvoiceBusinessBotTransferStars), - [0x63CBC38C] = typeof(InputInvoiceStarGiftResale), + [0xC39F5324] = typeof(InputInvoiceStarGiftResale), [0xAED0CBD9] = typeof(Payments_ExportedInvoice), [0xCFB9D957] = typeof(Messages_TranscribedAudio), [0x5334759C] = typeof(Help_PremiumPromo), @@ -1213,7 +1214,7 @@ namespace TL [0x8D595CD6] = typeof(StoryViews), [0x51E6EE4F] = typeof(StoryItemDeleted), [0xFFADC913] = typeof(StoryItemSkipped), - [0x79B26A24] = typeof(StoryItem), + [0xEDF164F1] = typeof(StoryItem), [0x1158FE3E] = typeof(Stories_AllStoriesNotModified), [0x6EFC5E81] = typeof(Stories_AllStories), [0x63C3DD0A] = typeof(Stories_Stories), @@ -1362,7 +1363,7 @@ namespace TL [0x94CE852A] = typeof(StarsGiveawayOption), [0x54236209] = typeof(StarsGiveawayWinnersOption), [0x00BCFF5B] = typeof(StarGift), - [0xF63778AE] = typeof(StarGiftUnique), + [0x3A274D50] = typeof(StarGiftUnique), [0xA388A368] = null,//Payments_StarGiftsNotModified [0x2ED82995] = typeof(Payments_StarGifts), [0x7903E3D9] = typeof(MessageReportOption), @@ -1424,6 +1425,10 @@ namespace TL [0x9D6B13B0] = typeof(StarGiftCollection), [0xA0BA4F17] = null,//Payments_StarGiftCollectionsNotModified [0x8A2932F3] = typeof(Payments_StarGiftCollections), + [0x9325705A] = typeof(StoryAlbum), + [0x564EDAEB] = null,//Stories_AlbumsNotModified + [0xC3987A3A] = typeof(Stories_Albums), + [0x3E0B5B6A] = typeof(SearchPostsFlood), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), @@ -1558,6 +1563,7 @@ namespace TL [typeof(RequirementToContact)] = 0x050A9839, //requirementToContactEmpty [typeof(Contacts_SponsoredPeers)] = 0xEA32B4B1, //contacts.sponsoredPeersEmpty [typeof(Payments_StarGiftCollections)] = 0xA0BA4F17, //payments.starGiftCollectionsNotModified + [typeof(Stories_Albums)] = 0x564EDAEB, //stories.albumsNotModified [typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty }; } diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index d786b10..ed47ea1 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,8 +13,8 @@ WTelegramClient Wizou 0.0.0 - layer.210 - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 210 + layer.211 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 211 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From e16e39bfba401cc916b10cf2b92259ecf611dff3 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 9 Aug 2025 02:43:43 +0200 Subject: [PATCH 19/54] Avoid using obsolete DataCenter info on alt-DC connect --- .github/workflows/dev.yml | 2 +- .github/workflows/release.yml | 2 +- src/Client.cs | 20 +++++++++++++++----- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index a30001c..222fc7a 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -46,7 +46,7 @@ jobs: env: JSON: | { - "status": "success", "complete": true, "commitMessage": ${{ toJSON(github.event.head_commit.message) }}, + "status": "success", "complete": true, "commitMessage": ${{ toJSON(env.RELEASE_NOTES) }}, "message": "{ \"commitId\": \"${{ github.sha }}\", \"buildNumber\": \"${{ env.VERSION }}\", \"repoName\": \"${{ github.repository }}\"}" } run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 42fcb35..052eafb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,7 +58,7 @@ jobs: env: JSON: | { - "status": "success", "complete": true, "commitMessage": ${{ toJSON(github.event.head_commit.message) }}, + "status": "success", "complete": true, "commitMessage": ${{ toJSON(env.RELEASE_NOTES) }}, "message": "{ \"commitId\": \"${{ github.sha }}\", \"buildNumber\": \"${{ env.VERSION }}\", \"repoName\": \"${{ github.repository }}\"}" } run: | diff --git a/src/Client.cs b/src/Client.cs index f834bd2..2b302fe 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -277,9 +277,8 @@ namespace WTelegram private Session.DCSession GetOrCreateDCSession(int dcId, DcOption.Flags flags) { - if (_session.DCSessions.TryGetValue(dcId, out var dcSession) && dcSession.AuthKey != null) - if (dcSession.Client != null || dcSession.DataCenter.flags == flags) - return dcSession; // if we have already a session with this DC and we are connected or it is a perfect match, use it + if (_session.DCSessions.TryGetValue(dcId, out var dcSession) && dcSession.Client != null) + return dcSession; // we have already a connected session with this DC, use it if (dcSession == null && _session.DCSessions.TryGetValue(-dcId, out dcSession) && dcSession.AuthKey != null) { // we have already negociated an AuthKey with this DC @@ -295,9 +294,10 @@ namespace WTelegram dcId = Math.Abs(dcId); } var dcOptions = GetDcOptions(Math.Abs(dcId), flags); - var dcOption = dcOptions.FirstOrDefault() ?? throw new WTException($"Could not find adequate dc_option for DC {dcId}"); + var dcOption = dcOptions.FirstOrDefault(); dcSession ??= new(); // create new session only if not already existing - dcSession.DataCenter = dcOption; + if (dcOption != null) dcSession.DataCenter = dcOption; + else if (dcSession.DataCenter == null) throw new WTException($"Could not find adequate dc_option for DC {dcId}"); return _session.DCSessions[dcId] = dcSession; } @@ -1630,6 +1630,16 @@ namespace WTelegram got503 = true; goto retry; } + else if (code == 401 && message == "SESSION_REVOKED" && !IsMainDC) // need to renegociate alt-DC auth + { + lock (_session) + { + _session.DCSessions.Remove(_dcSession.DcID); + if (_session.MainDC != -_dcSession.DcID) _session.DCSessions.Remove(-_dcSession.DcID); + _session.Save(); + } + await DisposeAsync(); + } else if (code == 400 && message == "CONNECTION_NOT_INITED") { await InitConnection(); From 5f411d45f983bb7acd570f2cf01e0eb27ba46791 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 16 Aug 2025 13:01:43 +0200 Subject: [PATCH 20/54] API Layer 211.2: StarsTransaction flag posts_search --- src/TL.Schema.cs | 73 ++++++++++++++--- src/TL.SchemaFuncs.cs | 186 +++++++++++++++++++++--------------------- src/TL.Table.cs | 2 +- 3 files changed, 157 insertions(+), 104 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 21e4c2b..299c969 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2945,10 +2945,14 @@ namespace TL [IfFlag(1)] public TextWithEntities message; /// The receiver of this gift may convert it to this many Telegram Stars, instead of displaying it on their profile page.
convert_stars will be equal to stars only if the gift was bought using recently bought Telegram Stars, otherwise it will be less than stars.
[IfFlag(4)] public long convert_stars; + /// If set, this gift was upgraded to a collectible gift, and the corresponding is available at the specified message ID. [IfFlag(5)] public int upgrade_msg_id; [IfFlag(8)] public long upgrade_stars; + /// Sender of the gift (unset for anonymous gifts). [IfFlag(11)] public Peer from_id; + /// Receiver of the gift. [IfFlag(12)] public Peer peer; + /// For channel gifts, ID to use in s. [IfFlag(12)] public long saved_id; [Flags] public enum Flags : uint @@ -2963,10 +2967,13 @@ namespace TL converted = 0x8, /// Field has a value has_convert_stars = 0x10, + /// This gift was upgraded to a collectible gift ». upgraded = 0x20, /// Field has a value has_upgrade_stars = 0x100, + /// This gift is not available anymore because a request to refund the payment related to this gift was made, and the money was returned. refunded = 0x200, + /// If set, this gift can be upgraded to a collectible gift; can only be set for the receiver of a gift. can_upgrade = 0x400, /// Field has a value has_from_id = 0x800, @@ -2974,31 +2981,42 @@ namespace TL has_peer = 0x1000, } } - /// See + /// A gift » was upgraded to a collectible gift ». See [TLDef(0x34F762F3)] public sealed partial class MessageActionStarGiftUnique : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The collectible gift. public StarGiftBase gift; [IfFlag(3)] public DateTime can_export_at; + /// If set, indicates that the gift can be transferred » to another user by paying the specified amount of stars. [IfFlag(4)] public long transfer_stars; + /// Sender of the gift (unset for anonymous gifts). [IfFlag(6)] public Peer from_id; + /// Receiver of the gift. [IfFlag(7)] public Peer peer; + /// For channel gifts, ID to use in s. [IfFlag(7)] public long saved_id; [IfFlag(8)] public StarsAmountBase resale_amount; + /// If set, indicates that the current gift can't be transferred » yet: the owner will be able to transfer it at the specified unixtime. [IfFlag(9)] public DateTime can_transfer_at; + /// If set, indicates that the current gift can't be resold » yet: the owner will be able to put it up for sale at the specified unixtime. [IfFlag(10)] public DateTime can_resell_at; [Flags] public enum Flags : uint { + /// If set, this collectible was upgraded » to a collectible gift from a previously received or sent (depending on the out flag of the containing ) non-collectible gift. upgrade = 0x1, + /// If set, this collectible was transferred (either to the current user or by the current user to the other user in the private chat, depending on the out flag of the containing ). transferred = 0x2, + /// If set, this gift is visible on the user or channel's profile page; can only be set for the receiver of a gift. saved = 0x4, /// Field has a value has_can_export_at = 0x8, /// Field has a value has_transfer_stars = 0x10, + /// This gift was upgraded to a collectible gift » and then re-downgraded to a regular gift because a request to refund the payment related to the upgrade was made, and the money was returned. refunded = 0x20, /// Field has a value has_from_id = 0x40, @@ -7584,7 +7602,7 @@ namespace TL public string display_url; /// Hash used for caching, for more info click here public int hash; - /// Type of the web page. One of the following:

- video
- gif
- photo
- document
- profile
- telegram_background
- telegram_theme
- telegram_story
- telegram_channel
- telegram_channel_request
- telegram_megagroup
- telegram_chat
- telegram_megagroup_request
- telegram_chat_request
- telegram_album
- telegram_message
- telegram_bot
- telegram_voicechat
- telegram_livestream
- telegram_call
- telegram_user
- telegram_botapp
- telegram_channel_boost
- telegram_group_boost
- telegram_giftcode
- telegram_stickerset

+ /// Type of the web page. One of the following:

- video
- gif
- photo
- document
- profile
- telegram_background
- telegram_theme
- telegram_story
- telegram_channel
- telegram_channel_request
- telegram_megagroup
- telegram_chat
- telegram_megagroup_request
- telegram_chat_request
- telegram_album
- telegram_message
- telegram_bot
- telegram_voicechat
- telegram_livestream
- telegram_call
- telegram_user
- telegram_botapp
- telegram_channel_boost
- telegram_group_boost
- telegram_giftcode
- telegram_stickerset
- telegram_story_album
- telegram_collection

[IfFlag(0)] public string type; /// Short name of the site (e.g., Google Docs, App Store) [IfFlag(1)] public string site_name; @@ -19749,6 +19767,7 @@ namespace TL stargift_resale = 0x400000, /// Fields and have a value has_ads_proceeds_from_date = 0x800000, + posts_search = 0x1000000, } } @@ -20186,12 +20205,13 @@ namespace TL public override string Title => title; public override Peer ReleasedBy => released_by; } - /// See + /// Represents a collectible star gift, see here » for more info. See [TLDef(0x3A274D50)] public sealed partial class StarGiftUnique : StarGiftBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Identifier of the gift. public long id; public string title; public string slug; @@ -20224,6 +20244,7 @@ namespace TL resale_ton_only = 0x80, } + /// Identifier of the gift. public override long ID => id; public override int AvailabilityTotal => availability_total; public override string Title => title; @@ -20526,45 +20547,62 @@ namespace TL public string description; } - /// See Derived classes: , , , + /// An attribute of a collectible gift ». See Derived classes: , , , public abstract partial class StarGiftAttribute : IObject { } - /// See + /// The model of a collectible gift ». See [TLDef(0x39D99013)] public sealed partial class StarGiftAttributeModel : StarGiftAttribute { + /// Name of the model public string name; + /// The sticker representing the upgraded gift public DocumentBase document; + /// The number of upgraded gifts that receive this backdrop for each 1000 gifts upgraded. public int rarity_permille; } - /// See + /// A sticker applied on the backdrop of a collectible gift » using a repeating pattern. See [TLDef(0x13ACFF19)] public sealed partial class StarGiftAttributePattern : StarGiftAttribute { + /// Name of the symbol public string name; + /// The symbol public DocumentBase document; + /// The number of upgraded gifts that receive this backdrop for each 1000 gifts upgraded. public int rarity_permille; } - /// See + /// The backdrop of a collectible gift ». See [TLDef(0xD93D859C)] public sealed partial class StarGiftAttributeBackdrop : StarGiftAttribute { + /// Name of the backdrop public string name; + /// Unique ID of the backdrop public int backdrop_id; + /// Color of the center of the backdrop in RGB24 format. public int center_color; + /// Color of the edges of the backdrop in RGB24 format. public int edge_color; + /// Color of the applied on the backdrop in RGB24 format. public int pattern_color; + /// Color of the text on the backdrop in RGB24 format. public int text_color; + /// The number of upgraded gifts that receive this backdrop for each 1000 gifts upgraded. public int rarity_permille; } - /// See + /// Info about the sender, receiver and message attached to the original gift », before it was upgraded to a collectible gift ». See [TLDef(0xE0BFF26C)] public sealed partial class StarGiftAttributeOriginalDetails : StarGiftAttribute { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Original sender of the gift, absent if the gift was private. [IfFlag(0)] public Peer sender_id; + /// Original receiver of the gift. public Peer recipient_id; + /// When was the gift sent. public DateTime date; + /// Original message attached to the gift, if present. [IfFlag(1)] public TextWithEntities message; [Flags] public enum Flags : uint @@ -20576,10 +20614,11 @@ namespace TL } } - /// See + /// A preview of the possible attributes (chosen randomly) a gift » can receive after upgrading it to a collectible gift », see here » for more info. See [TLDef(0x167BD90B)] public sealed partial class Payments_StarGiftUpgradePreview : IObject { + /// Possible gift attributes public StarGiftAttribute[] sample_attributes; } @@ -20690,17 +20729,20 @@ namespace TL /// See Derived classes: , , public abstract partial class InputSavedStarGift : IObject { } - /// See + /// A gift received in a private chat with another user. See [TLDef(0x69279795)] public sealed partial class InputSavedStarGiftUser : InputSavedStarGift { + /// ID of the with the with the gift. public int msg_id; } - /// See + /// A gift received by a channel we own. See [TLDef(0xF101AA7F)] public sealed partial class InputSavedStarGiftChat : InputSavedStarGift { + /// The channel. public InputPeer peer; + /// ID of the gift, must be the saved_id of a /. public long saved_id; } /// See @@ -20957,6 +20999,7 @@ namespace TL [TLDef(0x1B0E4F07)] public sealed partial class StarsRating : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int level; public long current_level_stars; @@ -20965,6 +21008,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_next_level_stars = 0x1, } } @@ -20973,6 +21017,7 @@ namespace TL [TLDef(0x9D6B13B0)] public sealed partial class StarGiftCollection : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int collection_id; public string title; @@ -20982,6 +21027,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_icon = 0x1, } } @@ -20998,6 +21044,7 @@ namespace TL [TLDef(0x9325705A)] public sealed partial class StoryAlbum : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int album_id; public string title; @@ -21006,7 +21053,9 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_icon_photo = 0x1, + /// Field has a value has_icon_video = 0x2, } } @@ -21024,6 +21073,7 @@ namespace TL [TLDef(0x3E0B5B6A)] public sealed partial class SearchPostsFlood : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int total_daily; public int remains; @@ -21033,6 +21083,7 @@ namespace TL [Flags] public enum Flags : uint { query_is_free = 0x1, + /// Field has a value has_wait_till = 0x2, } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index c10d6f0..9ea3dd5 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -54,7 +54,7 @@ namespace TL query = query, }); - /// Invoke the specified query using the specified API layer See Possible codes: 400,403,406 (details) + /// Invoke the specified query using the specified API layer See Possible codes: -504,400,403,406 (details) /// The layer to use /// The query public static Task InvokeWithLayer(this Client client, int layer, IMethod query) @@ -212,7 +212,7 @@ namespace TL bytes = bytes, }); - /// Binds a temporary authorization key temp_auth_key_id to the permanent authorization key perm_auth_key_id. Each permanent key may only be bound to one temporary key at a time, binding a new temporary key overwrites the previous one. See [bots: ✓] Possible codes: 400 (details) + /// Binds a temporary authorization key temp_auth_key_id to the permanent authorization key perm_auth_key_id. Each permanent key may only be bound to one temporary key at a time, binding a new temporary key overwrites the previous one. See [bots: ✓] Possible codes: -504,400 (details) /// Permanent auth_key_id to bind to /// Random long from Binding message contents /// Unix timestamp to invalidate temporary key, see Binding message contents @@ -298,7 +298,7 @@ namespace TL except_auth_keys = except_auth_keys, }); - /// Generate a login token, for login via QR code.
The generated login token should be encoded using base64url, then shown as a tg://login?token=base64encodedtoken deep link » in the QR code. See Possible codes: 400 (details)
+ /// Generate a login token, for login via QR code.
The generated login token should be encoded using base64url, then shown as a tg://login?token=base64encodedtoken deep link » in the QR code. See Possible codes: -504,400 (details)
/// Application identifier (see. App configuration) /// Application identifier hash (see. App configuration) /// List of already logged-in user IDs, to prevent logging in twice with the same user @@ -452,7 +452,7 @@ namespace TL about = about, }); - /// Updates online user status. See + /// Updates online user status. See Possible codes: -504 (details) /// If is transmitted, user status will change to . public static Task Account_UpdateStatus(this Client client, bool offline) => client.Invoke(new Account_UpdateStatus @@ -1425,7 +1425,7 @@ namespace TL settings = settings, }); - /// See [bots: ✓] + /// See /// a null value means account.emojiStatusesNotModified public static Task Account_GetCollectibleEmojiStatuses(this Client client, long hash = default) => client.Invoke(new Account_GetCollectibleEmojiStatuses @@ -1433,7 +1433,7 @@ namespace TL hash = hash, }); - /// 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: ✓] + /// 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 Possible codes: 400 (details) /// 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) @@ -1444,9 +1444,9 @@ namespace TL user_id = user_id, }); - /// Allow a user to send us messages without paying if paid messages » are enabled. See [bots: ✓] + /// Allow a user to send us messages without paying if paid messages » are enabled. See Possible codes: 400 (details) /// 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). - /// If set, requires the user to pay in order to send us messages (can only be used by monoforums, not users, i.e. parent_peer must be set if this flag is set; users must instead use the privacy setting to remove a previously added exemption).
If not set, allows the user to send us messages without paying (can be used by both monoforums and users). + /// If set, requires the user to pay in order to send us messages.
Can only be set by monoforums, not users, i.e. parent_peer must be set if this flag is set; users must instead use the privacy setting to remove a previously added exemption.
If not set, allows the user to send us messages without paying (can be unset by both monoforums and users). /// 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) @@ -1457,7 +1457,7 @@ namespace TL user_id = user_id, }); - /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400 (details) + /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: -504,400 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, params InputUserBase[] id) => client.Invoke(new Users_GetUsers @@ -1465,7 +1465,7 @@ namespace TL id = id, }); - /// Returns extended user info by ID. See [bots: ✓] Possible codes: 400 (details) + /// Returns extended user info by ID. See [bots: ✓] Possible codes: -504,400 (details) /// User ID public static Task Users_GetFullUser(this Client client, InputUserBase id) => client.Invoke(new Users_GetFullUser @@ -1483,7 +1483,7 @@ namespace TL errors = errors, }); - /// Check whether we can write to the specified users, used to implement bulk checks for Premium-only messages » and paid messages ». See [bots: ✓] + /// Check whether we can write to the specified users, used to implement bulk checks for Premium-only messages » and paid messages ». See /// Users to check. public static Task Users_GetRequirementsToContact(this Client client, params InputUserBase[] id) => client.Invoke(new Users_GetRequirementsToContact @@ -1580,7 +1580,7 @@ namespace TL limit = limit, }); - /// Resolve a @username to get peer info See [bots: ✓] Possible codes: 400 (details) + /// Resolve a @username to get peer info See [bots: ✓] Possible codes: -504,400 (details) /// @username to resolve /// Referrer ID from referral links ». public static Task Contacts_ResolveUsername(this Client client, string username, string referer = null) @@ -1740,7 +1740,7 @@ namespace TL { }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) /// a null value means contacts.sponsoredPeersEmpty public static Task Contacts_GetSponsoredPeers(this Client client, string q) => client.Invoke(new Contacts_GetSponsoredPeers @@ -1748,7 +1748,7 @@ namespace TL q = q, }); - /// This method is only for basic Chat. See Terminology in the README to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Returns the list of messages by their IDs. See [bots: ✓]
+ /// This method is only for basic Chat. See Terminology in the README to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Returns the list of messages by their IDs. See
[bots: ✓] Possible codes: -504 (details)
/// Message ID list public static Task Messages_GetMessages(this Client client, params InputMessage[] id) => client.Invoke(new Messages_GetMessages @@ -1756,7 +1756,7 @@ namespace TL id = id, }); - /// Returns the current user dialog list. See Possible codes: 400,403 (details) + /// Returns the current user dialog list. See Possible codes: -504,400,403 (details) /// Exclude pinned dialogs /// Peer folder ID, for more info click here /// Offsets for pagination, for more info click here @@ -1776,7 +1776,7 @@ namespace TL hash = hash, }); - /// Returns the conversation history with one interlocutor / within a chat See Possible codes: 400,406 (details) + /// Returns the conversation history with one interlocutor / within a chat See Possible codes: -504,400,406 (details) /// Target peer /// Only return messages starting from the specified message ID /// Only return messages sent before the specified date @@ -1880,7 +1880,7 @@ namespace TL max_id = max_id, }); - /// Sends a current user typing event (see for all event types) to a conversation partner or group. See [bots: ✓] Possible codes: 400,403,406 (details) + /// Sends a current user typing event (see for all event types) to a conversation partner or group. See [bots: ✓] Possible codes: -504,400,403,406 (details) /// Target user or group /// Topic ID /// Type of action @@ -1893,7 +1893,7 @@ namespace TL action = action, }); - /// Sends a message to a chat See [bots: ✓] Possible codes: 400,403,404,406,420,500 (details) + /// Sends a message to a chat See [bots: ✓] Possible codes: -504,400,403,404,406,420,500 (details) /// Set this flag to disable generation of the webpage preview /// Send this message silently (no notifications for the receivers) /// Send this message as background message @@ -1931,7 +1931,7 @@ namespace TL suggested_post = suggested_post, }); - /// Send a media See [bots: ✓] Possible codes: 400,403,406,420,500 (details) + /// Send a media See [bots: ✓] Possible codes: -504,400,403,406,420,500 (details) /// Send message silently (no notification should be triggered) /// Send message in background /// Clear the draft @@ -2095,7 +2095,7 @@ namespace TL user_id = user_id, }); - /// Creates a new chat. See Possible codes: 400,406,500 (details) + /// Creates a new chat. See Possible codes: 400,403,500 (details) /// List of user IDs to be invited /// Chat name /// Time-to-live of all messages that will be sent in the chat: once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. You can use Messages_SetDefaultHistoryTTL to edit this value later. @@ -2118,7 +2118,7 @@ namespace TL random_length = random_length, }); - /// Sends a request to start a secret chat to the user. See Possible codes: 400 (details) + /// Sends a request to start a secret chat to the user. See Possible codes: 400,403 (details) /// User ID /// Unique client request ID required to prevent resending. This also doubles as the chat ID. /// A = g ^ a mod p, see Wikipedia @@ -2288,7 +2288,7 @@ namespace TL subscription_pricing = subscription_pricing, }); - /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400,406 (details) + /// Check the validity of a chat invite link and get basic info about it See Possible codes: -504,400,406 (details) /// Invite hash from chat invite deep link ». public static Task Messages_CheckChatInvite(this Client client, string hash) => client.Invoke(new Messages_CheckChatInvite @@ -2347,7 +2347,7 @@ namespace TL start_param = start_param, }); - /// Get and increase the view counter of a message sent or forwarded from a channel See Possible codes: 400,406 (details) + /// Get and increase the view counter of a message sent or forwarded from a channel See Possible codes: -504,400,406 (details) /// Peer where the message was found /// ID of message /// Whether to mark the message as viewed and increment the view counter @@ -2602,7 +2602,7 @@ namespace TL cache_time = cache_time, }); - /// Get dialog info of specified peers See Possible codes: 400,406 (details) + /// Get dialog info of specified peers See Possible codes: -504,400,406 (details) /// Peers public static Task Messages_GetPeerDialogs(this Client client, params InputDialogPeerBase[] peers) => client.Invoke(new Messages_GetPeerDialogs @@ -2846,7 +2846,7 @@ namespace TL error = error, }); - /// Upload a file and associate it to a chat (without actually sending it to the chat) See [bots: ✓] Possible codes: 400,403 (details) + /// Upload a file and associate it to a chat (without actually sending it to the chat) See [bots: ✓] Possible codes: -504,400,403 (details) /// Whether the media will be used only in the specified business connection », and not directly by the bot. /// The chat, can be for bots and for users. /// File uploaded in chunks as described in files » @@ -2891,7 +2891,7 @@ namespace TL unfave = unfave, }); - /// Get unread messages where we were mentioned See Possible codes: 400 (details) + /// Get unread messages where we were mentioned See Possible codes: -504,400 (details) /// Peer where to look for mentions /// If set, considers only messages within the specified forum topic /// Offsets for pagination, for more info click here @@ -2912,7 +2912,7 @@ namespace TL min_id = min_id, }); - /// Mark mentions as read See Possible codes: 400 (details) + /// Mark mentions as read See Possible codes: -504,400 (details) /// Dialog /// Mark as read only mentions within the specified forum topic public static Task Messages_ReadMentions(this Client client, InputPeer peer, int? top_msg_id = null) @@ -3692,7 +3692,7 @@ namespace TL reaction = reaction, }); - /// Translate a given text. See Possible codes: 400,500 (details) + /// Translate a given text. See Possible codes: 400,406,500 (details) /// If the text is a chat message, the peer ID /// A list of message IDs to translate /// A list of styled messages to translate @@ -4192,7 +4192,7 @@ namespace TL order = order, }); - /// Fetch the full list of saved message tags created by the user. See + /// Fetch the full list of saved message tags created by the user. See Possible codes: 400 (details) /// If set, returns tags only used in the specified saved message dialog. /// Hash used for caching, for more info click here. /// a null value means messages.savedReactionTagsNotModified @@ -4436,7 +4436,7 @@ namespace TL { }); - /// Mark a specific sponsored message » as read See + /// Mark a specific sponsored message » as read See Possible codes: -504 (details) /// The ad's unique ID. public static Task Messages_ViewSponsoredMessage(this Client client, byte[] random_id) => client.Invoke(new Messages_ViewSponsoredMessage @@ -4465,7 +4465,7 @@ namespace TL option = option, }); - /// Get a list of sponsored messages for a peer, see here » for more info. See + /// Get a list of sponsored messages for a peer, see here » for more info. See Possible codes: 400 (details) /// The currently open channel/bot. /// a null value means messages.sponsoredMessagesEmpty public static Task Messages_GetSponsoredMessages(this Client client, InputPeer peer, int? msg_id = null) @@ -4529,7 +4529,7 @@ namespace TL id = id, }); - /// See [bots: ✓] + /// See public static Task Messages_GetSavedDialogsByID(this Client client, InputPeer[] ids, InputPeer parent_peer = null) => client.Invoke(new Messages_GetSavedDialogsByID { @@ -4538,7 +4538,7 @@ namespace TL ids = ids, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Messages_ReadSavedHistory(this Client client, InputPeer parent_peer, InputPeer peer, int max_id = default) => client.Invoke(new Messages_ReadSavedHistory { @@ -4547,7 +4547,7 @@ namespace TL max_id = max_id, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Messages_ToggleTodoCompleted(this Client client, InputPeer peer, int msg_id, int[] completed, params int[] incompleted) => client.Invoke(new Messages_ToggleTodoCompleted { @@ -4557,7 +4557,7 @@ namespace TL incompleted = incompleted, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Messages_AppendTodoList(this Client client, InputPeer peer, int msg_id, params TodoItem[] list) => client.Invoke(new Messages_AppendTodoList { @@ -4566,7 +4566,7 @@ namespace TL list = list, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Messages_ToggleSuggestedPostApproval(this Client client, InputPeer peer, int msg_id, DateTime? schedule_date = null, string reject_comment = null, bool reject = false) => client.Invoke(new Messages_ToggleSuggestedPostApproval { @@ -4577,13 +4577,13 @@ namespace TL reject_comment = reject_comment, }); - /// Returns a current state of updates. See [bots: ✓] + /// Returns a current state of updates. See [bots: ✓] Possible codes: -504 (details) public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState { }); - /// Get new updates. See [bots: ✓] Possible codes: 400,403,500 (details) + /// Get new updates. See [bots: ✓] Possible codes: -504,400,403,500 (details) /// PTS, see updates. /// PTS limit /// For fast updating: if provided and pts + pts_total_limit < remote pts, will be returned.
Simply tells the server to not return the difference if it is bigger than pts_total_limit
If the remote pts is too big (> ~4000000), this field will default to 1000000 @@ -4602,7 +4602,7 @@ namespace TL qts_limit = qts_limit ?? default, }); - /// Returns the difference between the current state of updates of a certain channel and transmitted. See [bots: ✓] Possible codes: 400,403,406,500 (details) + /// Returns the difference between the current state of updates of a certain channel and transmitted. See [bots: ✓] Possible codes: -504,400,403,406,500 (details) /// Set to true to skip some possibly unneeded updates and reduce server-side load /// The channel /// Messsage filter @@ -4742,7 +4742,7 @@ namespace TL limit = limit, }); - /// Download a CDN file. See Possible codes: 400 (details) + /// Download a CDN file. See Possible codes: 400,404 (details) /// File token /// Offset of chunk to download /// Length of chunk to download @@ -4764,7 +4764,7 @@ namespace TL request_token = request_token, }); - /// Get SHA256 hashes for verifying downloaded CDN files See [bots: ✓] Possible codes: 400 (details) + /// Get SHA256 hashes for verifying downloaded CDN files See [bots: ✓] Possible codes: -504,400 (details) /// File /// Offset from which to start getting hashes public static Task Upload_GetCdnFileHashes(this Client client, byte[] file_token, long offset = default) @@ -4784,7 +4784,7 @@ namespace TL offset = offset, }); - /// Returns current configuration, including data center configuration. See [bots: ✓] Possible codes: 400,403 (details) + /// Returns current configuration, including data center configuration. See [bots: ✓] Possible codes: -504,400,403 (details) public static Task Help_GetConfig(this Client client) => client.Invoke(new Help_GetConfig { @@ -4827,7 +4827,7 @@ namespace TL message = message, }); - /// Get configuration for CDN file downloads. See [bots: ✓] + /// Get configuration for CDN file downloads. See [bots: ✓] Possible codes: -504 (details) public static Task Help_GetCdnConfig(this Client client) => client.Invoke(new Help_GetCdnConfig { @@ -4986,7 +4986,7 @@ namespace TL hash = hash, }); - /// Mark channel/supergroup history as read See Possible codes: 400,406 (details) + /// Mark channel/supergroup history as read See Possible codes: -504,400,406 (details) /// Channel/supergroup /// ID of message up to which messages should be marked as read public static Task Channels_ReadHistory(this Client client, InputChannelBase channel, int max_id = default) @@ -4996,7 +4996,7 @@ namespace TL max_id = max_id, }); - /// Delete messages in a channel/supergroup See [bots: ✓] Possible codes: 400,403,406 (details) + /// Delete messages in a channel/supergroup See [bots: ✓] Possible codes: 400,403,406,420 (details) /// Channel/supergroup /// IDs of messages to delete public static Task Channels_DeleteMessages(this Client client, InputChannelBase channel, params int[] id) @@ -5018,7 +5018,7 @@ namespace TL id = id, }); - /// Get channel/supergroup messages See [bots: ✓] Possible codes: 400,406 (details) + /// Get channel/supergroup messages See [bots: ✓] Possible codes: -504,400,406 (details) /// Channel/supergroup /// IDs of messages to get public static Task Channels_GetMessages(this Client client, InputChannelBase channel, params InputMessage[] id) @@ -5028,7 +5028,7 @@ namespace TL id = id, }); - /// Get the participants of a supergroup/channel See [bots: ✓] Possible codes: 400,403,406 (details) + /// Get the participants of a supergroup/channel See [bots: ✓] Possible codes: -504,400,403,406 (details) /// Channel /// Which participant types to fetch /// Offset @@ -5055,7 +5055,7 @@ namespace TL participant = participant, }); - /// Get info about channels/supergroups See [bots: ✓] Possible codes: 400,406 (details) + /// Get info about channels/supergroups See [bots: ✓] Possible codes: -504,400,406 (details) /// IDs of channels/supergroups to get info about public static Task Channels_GetChannels(this Client client, params InputChannelBase[] id) => client.Invoke(new Channels_GetChannels @@ -5063,7 +5063,7 @@ namespace TL id = id, }); - /// Get full info about a supergroup, gigagroup or channel See [bots: ✓] Possible codes: 400,403,406 (details) + /// Get full info about a supergroup, gigagroup or channel See [bots: ✓] Possible codes: -504,400,403,406 (details) /// The channel, supergroup or gigagroup to get info about public static Task Channels_GetFullChannel(this Client client, InputChannelBase channel) => client.Invoke(new Channels_GetFullChannel @@ -5071,7 +5071,7 @@ namespace TL channel = channel, }); - /// Create a supergroup/channel. See Possible codes: 400,406,500 (details) + /// Create a supergroup/channel. See Possible codes: 400,403,500 (details) /// Whether to create a channel /// Whether to create a supergroup /// Whether the supergroup is being created to import messages from a foreign chat service using Messages_InitHistoryImport @@ -5146,7 +5146,7 @@ namespace TL username = username, }); - /// Join a channel/supergroup See Possible codes: 400,406 (details) + /// Join a channel/supergroup See Possible codes: -504,400,406,420 (details) /// Channel/supergroup to join public static Task Channels_JoinChannel(this Client client, InputChannelBase channel) => client.Invoke(new Channels_JoinChannel @@ -5289,7 +5289,7 @@ namespace TL enabled = enabled, }); - /// Get a list of channels/supergroups we left, requires a takeout session, see here » for more info. See Possible codes: 403 (details) + /// Get a list of channels/supergroups we left, requires a takeout session, see here » for more info. See Possible codes: 400,403 (details) /// Offset for pagination public static Task Channels_GetLeftChannels(this Client client, int offset = default) => client.Invoke(new Channels_GetLeftChannels @@ -5520,7 +5520,7 @@ namespace TL pinned = pinned, }); - /// Delete message history of a forum topic See [bots: ✓] Possible codes: 400 (details) + /// Delete message history of a forum topic See [bots: ✓] Possible codes: 400,403 (details) /// Forum /// Topic ID public static Task Channels_DeleteTopicHistory(this Client client, InputChannelBase channel, int top_msg_id) @@ -5596,7 +5596,7 @@ namespace TL enabled = enabled, }); - /// Obtain a list of similarly themed public channels, selected based on similarities in their subscriber bases. See Possible codes: 400 (details) + /// Obtain a list of similarly themed public channels, selected based on similarities in their subscriber bases. See Possible codes: -504,400 (details) /// The method will return channels related to the passed channel. If not set, the method will returns channels related to channels the user has joined. public static Task Channels_GetChannelRecommendations(this Client client, InputChannelBase channel = null) => client.Invoke(new Channels_GetChannelRecommendations @@ -5645,7 +5645,7 @@ namespace TL restricted = restricted, }); - /// Globally search for posts from public channels » (including those we aren't a member of) containing a specific hashtag. See + /// Globally search for posts from public channels » (including those we aren't a member of) containing a specific hashtag. See Possible codes: 420 (details) /// The hashtag to search, without the # character. /// Initially 0, then set to the next_rate parameter of messages.messagesSlice /// Offsets for pagination, for more info click here @@ -5664,7 +5664,7 @@ namespace TL allow_paid_stars = allow_paid_stars ?? default, }); - /// Enable or disable paid messages » in this supergroup or monoforum. See [bots: ✓] + /// Enable or disable paid messages » in this supergroup or monoforum. See Possible codes: 400 (details) /// 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. @@ -5676,7 +5676,7 @@ namespace TL send_paid_messages_stars = send_paid_messages_stars, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Channels_ToggleAutotranslation(this Client client, InputChannelBase channel, bool enabled) => client.Invoke(new Channels_ToggleAutotranslation { @@ -5684,7 +5684,7 @@ namespace TL enabled = enabled, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Channels_GetMessageAuthor(this Client client, InputChannelBase channel, int id) => client.Invoke(new Channels_GetMessageAuthor { @@ -6016,7 +6016,7 @@ namespace TL bot = bot, }); - /// Get a payment form See Possible codes: 400 (details) + /// Get a payment form See Possible codes: 400,403,406 (details) /// Invoice /// Theme parameters » public static Task Payments_GetPaymentForm(this Client client, InputInvoice invoice, DataJSON theme_params = null) @@ -6172,7 +6172,7 @@ namespace TL { }); - /// Get the current Telegram Stars balance of the current account (with peer=), or the stars balance of the bot specified in peer. See Possible codes: 400 (details) + /// Get the current Telegram Stars balance of the current account (with peer=), or the stars balance of the bot specified in peer. See Possible codes: 400,403 (details) /// Peer of which to get the balance. public static Task Payments_GetStarsStatus(this Client client, InputPeer peer, bool ton = false) => client.Invoke(new Payments_GetStarsStatus @@ -6199,7 +6199,7 @@ namespace TL limit = limit, }); - /// Make a payment using Telegram Stars, see here » for more info. See Possible codes: 400 (details) + /// Make a payment using Telegram Stars, see here » for more info. See Possible codes: 400,403,406 (details) /// Payment form ID /// Invoice public static Task Payments_SendStarsForm(this Client client, long form_id, InputInvoice invoice) @@ -6409,7 +6409,8 @@ namespace TL link = link, }); - /// See + /// Obtain a preview of the possible attributes (chosen randomly) a gift » can receive after upgrading it to a collectible gift », see here » for more info. See Possible codes: 400 (details) + /// The gift to upgrade. public static Task Payments_GetStarGiftUpgradePreview(this Client client, long gift_id) => client.Invoke(new Payments_GetStarGiftUpgradePreview { @@ -6432,14 +6433,14 @@ namespace TL to_id = to_id, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Payments_GetUniqueStarGift(this Client client, string slug) => client.Invoke(new Payments_GetUniqueStarGift { slug = slug, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) /// Maximum number of results to return, see pagination 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 @@ -6451,14 +6452,14 @@ namespace TL limit = limit, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Payments_GetSavedStarGift(this Client client, params InputSavedStarGift[] stargift) => client.Invoke(new Payments_GetSavedStarGift { stargift = stargift, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Payments_GetStarGiftWithdrawalUrl(this Client client, InputSavedStarGift stargift, InputCheckPasswordSRP password) => client.Invoke(new Payments_GetStarGiftWithdrawalUrl { @@ -6466,7 +6467,7 @@ namespace TL password = password, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Payments_ToggleChatStarGiftNotifications(this Client client, InputPeer peer, bool enabled = false) => client.Invoke(new Payments_ToggleChatStarGiftNotifications { @@ -6474,7 +6475,7 @@ namespace TL peer = peer, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Payments_ToggleStarGiftsPinnedToTop(this Client client, InputPeer peer, params InputSavedStarGift[] stargift) => client.Invoke(new Payments_ToggleStarGiftsPinnedToTop { @@ -6482,14 +6483,14 @@ namespace TL stargift = stargift, }); - /// See [bots: ✓] + /// See Possible codes: 406 (details) public static Task Payments_CanPurchaseStore(this Client client, InputStorePaymentPurpose purpose) => client.Invoke(new Payments_CanPurchaseStore { purpose = purpose, }); - /// See [bots: ✓] + /// See Possible codes: -504,400 (details) /// Maximum number of results to return, see pagination public static Task Payments_GetResaleStarGifts(this Client client, long gift_id, string offset, int limit = int.MaxValue, long? attributes_hash = null, StarGiftAttributeId[] attributes = null, bool sort_by_price = false, bool sort_by_num = false) => client.Invoke(new Payments_GetResaleStarGifts @@ -6502,7 +6503,7 @@ namespace TL limit = limit, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Payments_UpdateStarGiftPrice(this Client client, InputSavedStarGift stargift, StarsAmountBase resell_amount) => client.Invoke(new Payments_UpdateStarGiftPrice { @@ -6510,7 +6511,7 @@ namespace TL resell_amount = resell_amount, }); - /// See + /// See Possible codes: 400 (details) public static Task Payments_CreateStarGiftCollection(this Client client, InputPeer peer, string title, params InputSavedStarGift[] stargift) => client.Invoke(new Payments_CreateStarGiftCollection { @@ -6519,7 +6520,7 @@ namespace TL stargift = stargift, }); - /// See + /// See Possible codes: 400 (details) 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 { @@ -6532,7 +6533,7 @@ namespace TL order = order, }); - /// See + /// See Possible codes: 400 (details) public static Task Payments_ReorderStarGiftCollections(this Client client, InputPeer peer, params int[] order) => client.Invoke(new Payments_ReorderStarGiftCollections { @@ -6540,7 +6541,7 @@ namespace TL order = order, }); - /// See + /// See Possible codes: 400 (details) public static Task Payments_DeleteStarGiftCollection(this Client client, InputPeer peer, int collection_id) => client.Invoke(new Payments_DeleteStarGiftCollection { @@ -6548,7 +6549,7 @@ namespace TL collection_id = collection_id, }); - /// See + /// See Possible codes: 400 (details) /// a null value means payments.starGiftCollectionsNotModified public static Task Payments_GetStarGiftCollections(this Client client, InputPeer peer, long hash = default) => client.Invoke(new Payments_GetStarGiftCollections @@ -6693,7 +6694,7 @@ namespace TL { }); - /// Start a telegram phone call See Possible codes: 400,403 (details) + /// Start a telegram phone call See Possible codes: 400,403,500 (details) /// Whether to start a video call /// Destination of the phone call /// Random ID to avoid resending the same object @@ -7044,7 +7045,7 @@ namespace TL file = file, }); - /// Create and optionally join a new conference call. See [bots: ✓] + /// Create and optionally join a new conference call. See /// If set, mute our microphone when joining the call (can only be used if join is set). /// If set, our video stream is disabled (can only be used if join is set). /// If set, also join the call, otherwise just create the call link. @@ -7062,7 +7063,7 @@ namespace TL params_ = params_, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Phone_DeleteConferenceCallParticipants(this Client client, InputGroupCallBase call, long[] ids, byte[] block, bool only_left = false, bool kick = false) => client.Invoke(new Phone_DeleteConferenceCallParticipants { @@ -7072,7 +7073,7 @@ namespace TL block = block, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Phone_SendConferenceCallBroadcast(this Client client, InputGroupCallBase call, byte[] block) => client.Invoke(new Phone_SendConferenceCallBroadcast { @@ -7080,7 +7081,7 @@ namespace TL block = block, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Phone_InviteConferenceCallParticipant(this Client client, InputGroupCallBase call, InputUserBase user_id, bool video = false) => client.Invoke(new Phone_InviteConferenceCallParticipant { @@ -7089,14 +7090,14 @@ namespace TL user_id = user_id, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Phone_DeclineConferenceCallInvite(this Client client, int msg_id) => client.Invoke(new Phone_DeclineConferenceCallInvite { msg_id = msg_id, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) /// Maximum number of results to return, see pagination public static Task Phone_GetGroupCallChainBlocks(this Client client, InputGroupCallBase call, int sub_chain_id, int offset = default, int limit = int.MaxValue) => client.Invoke(new Phone_GetGroupCallChainBlocks @@ -7417,7 +7418,7 @@ namespace TL privacy_rules = privacy_rules, }); - /// Deletes some posted stories. See Possible codes: 400 (details) + /// Deletes some posted stories. See Possible codes: 400,403 (details) /// Channel/user from where to delete stories. /// IDs of stories to delete. public static Task Stories_DeleteStories(this Client client, InputPeer peer, params int[] id) @@ -7532,7 +7533,7 @@ namespace TL limit = limit, }); - /// Obtain info about the view count, forward count, reactions and recent viewers of one or more stories. See Possible codes: 400 (details) + /// Obtain info about the view count, forward count, reactions and recent viewers of one or more stories. See Possible codes: -504,400 (details) /// Peer whose stories should be fetched /// Story IDs public static Task Stories_GetStoriesViews(this Client client, InputPeer peer, params int[] id) @@ -7672,7 +7673,7 @@ namespace TL limit = limit, }); - /// See + /// See Possible codes: 400 (details) public static Task Stories_CreateAlbum(this Client client, InputPeer peer, string title, params int[] stories) => client.Invoke(new Stories_CreateAlbum { @@ -7681,7 +7682,7 @@ namespace TL stories = stories, }); - /// See + /// See Possible codes: 400 (details) public static Task Stories_UpdateAlbum(this Client client, InputPeer peer, int album_id, string title = null, int[] delete_stories = null, int[] add_stories = null, int[] order = null) => client.Invoke(new Stories_UpdateAlbum { @@ -7694,7 +7695,7 @@ namespace TL order = order, }); - /// See + /// See Possible codes: 400 (details) public static Task Stories_ReorderAlbums(this Client client, InputPeer peer, params int[] order) => client.Invoke(new Stories_ReorderAlbums { @@ -7702,7 +7703,7 @@ namespace TL order = order, }); - /// See + /// See Possible codes: 400 (details) public static Task Stories_DeleteAlbum(this Client client, InputPeer peer, int album_id) => client.Invoke(new Stories_DeleteAlbum { @@ -7710,7 +7711,7 @@ namespace TL album_id = album_id, }); - /// See + /// See Possible codes: 400 (details) /// a null value means stories.albumsNotModified public static Task Stories_GetAlbums(this Client client, InputPeer peer, long hash = default) => client.Invoke(new Stories_GetAlbums @@ -7719,7 +7720,8 @@ namespace TL hash = hash, }); - /// See + /// See Possible codes: 400 (details) + /// Maximum number of results to return, see pagination public static Task Stories_GetAlbumStories(this Client client, InputPeer peer, int album_id, int offset = default, int limit = int.MaxValue) => client.Invoke(new Stories_GetAlbumStories { @@ -7760,7 +7762,7 @@ namespace TL peer = peer, }); - /// Gets the current number of boosts of a channel/supergroup. See Possible codes: 400 (details) + /// Gets the current number of boosts of a channel/supergroup. See Possible codes: -504,400 (details) /// The peer. public static Task Premium_GetBoostsStatus(this Client client, InputPeer peer) => client.Invoke(new Premium_GetBoostsStatus diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 3479f87..3be9440 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 = 211; // fetched 31/07/2025 22:39:04 + public const int Version = 211; // fetched 16/08/2025 00:21:53 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; From a9bbdb9fc47fccdb3108cab6e23a50fa5824a80c Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 27 Aug 2025 00:06:30 +0200 Subject: [PATCH 21/54] Try to improve diagnostics/handling of weird email login case (#331) --- src/Client.Helpers.cs | 3 ++- src/Client.cs | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index a26210d..bdfb48f 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -36,9 +36,10 @@ namespace WTelegram var client = await GetClientForDC(-_dcSession.DcID, true); using (stream) { + const long SMALL_FILE_MAX_SIZE = 10 << 20; bool hasLength = stream.CanSeek; long transmitted = 0, length = hasLength ? stream.Length : -1; - bool isBig = !hasLength || length >= 10 * 1024 * 1024; + bool isBig = !hasLength || length > SMALL_FILE_MAX_SIZE; int file_total_parts = hasLength ? (int)((length - 1) / FilePartSize) + 1 : -1; long file_id = Helpers.RandomLong(); int file_part = 0, read; diff --git a/src/Client.cs b/src/Client.cs index 2b302fe..08b6207 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1238,10 +1238,13 @@ namespace WTelegram if (verified is Account_EmailVerifiedLogin verifiedLogin) // (it should always be) sentCodeBase = verifiedLogin.sent_code; } + RaiseUpdates(sentCodeBase); } resent: if (sentCodeBase is Auth_SentCodeSuccess success) authorization = success.authorization; + else if (sentCodeBase is Auth_SentCodePaymentRequired paymentRequired) + throw new WTException("Auth_SentCodePaymentRequired unsupported"); else if (sentCodeBase is Auth_SentCode sentCode) { phone_code_hash = sentCode.phone_code_hash; @@ -1410,7 +1413,7 @@ namespace WTelegram public User LoginAlreadyDone(Auth_AuthorizationBase authorization) { if (authorization is not Auth_Authorization { user: User self }) - throw new WTException("Failed to get Authorization: " + authorization.GetType().Name); + throw new WTException("Failed to get Authorization: " + authorization?.GetType().Name); _session.UserId = _dcSession.UserId = self.id; lock (_session) _session.Save(); RaiseUpdates(self); From eb52dccfa75387445c9743e65e07ffa3c0159644 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 27 Aug 2025 00:18:34 +0200 Subject: [PATCH 22/54] Helper OpenChat to monitor a group/channel without joining (#333) --- src/Client.Helpers.cs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index bdfb48f..3cc888f 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -13,7 +13,6 @@ namespace WTelegram { partial class Client { - #region Client TL Helpers /// Used to indicate progression of file download/upload /// transmitted bytes /// total size of file in bytes, or 0 if unknown @@ -910,6 +909,28 @@ namespace WTelegram } return chat; } - #endregion + + /// Receive updates for a given group/channel until cancellation is requested. + /// Group/channel to monitor without joining + /// Cancel token to stop the monitoring + /// After cancelling, you may still receive updates for a few more seconds + public async void OpenChat(InputChannel channel, CancellationToken ct) + { + var cts = CancellationTokenSource.CreateLinkedTokenSource(_cts.Token, ct); + try + { + while (!cts.IsCancellationRequested) + { + var diff = await this.Updates_GetChannelDifference(channel, null, 1, 1, true); + var timeout = diff.Timeout * 1000; + await Task.Delay(timeout != 0 ? timeout : 30000, cts.Token); + } + } + catch (Exception ex) + { + if (!cts.IsCancellationRequested) + Console.WriteLine($"An exception occured for OpenChat {channel.channel_id}: {ex.Message}"); + } + } } } From 253249e06aec175aac1f4dd3223272f09f782718 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 1 Sep 2025 13:37:41 +0200 Subject: [PATCH 23/54] API Layer 214: ChatTheme, main ProfileTab, user saved music, some StarGift & Store Payment stuff... (that might not be the most recent API layer. check https://patreon.com/wizou for the latest layers) --- README.md | 2 +- src/TL.Schema.cs | 233 ++++++++++++++++++++++++++++++++++--- src/TL.SchemaFuncs.cs | 159 +++++++++++++++++++++++-- src/TL.Table.cs | 42 +++++-- src/WTelegramClient.csproj | 4 +- 5 files changed, 398 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 8bb243f..d085aeb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-211-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-214-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 299c969..08737fd 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1402,7 +1402,7 @@ namespace TL public override int ReactionsLimit => reactions_limit; } /// Full info about a channel, supergroup or gigagroup. See - [TLDef(0xE07429DE)] + [TLDef(0xE4E0B29D)] public sealed partial class ChannelFull : ChatFullBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1495,6 +1495,7 @@ namespace TL [IfFlag(50)] public int stargifts_count; /// If set and bigger than 0, this supergroup, monoforum or the monoforum associated to this channel has enabled paid messages » and we must pay the specified amount of Stars to send messages to it, see here » for the full flow.
This flag will be set both for the monoforum and for of the associated channel).
If set and equal to 0, the monoforum requires payment in general but we were exempted from paying.
[IfFlag(53)] public long send_paid_messages_stars; + [IfFlag(54)] public ProfileTab main_tab; [Flags] public enum Flags : uint { @@ -1606,6 +1607,8 @@ namespace TL paid_messages_available = 0x100000, /// Field has a value has_send_paid_messages_stars = 0x200000, + /// Field has a value + has_main_tab = 0x400000, } /// ID of the channel @@ -2646,11 +2649,10 @@ namespace TL public DateTime schedule_date; } /// The chat theme was changed See - [TLDef(0xAA786345)] + [TLDef(0xB91BBD3A)] public sealed partial class MessageActionSetChatTheme : MessageAction { - /// The emoji that identifies a chat theme - public string emoticon; + public ChatThemeBase theme; } /// A user was accepted into the group by an admin See [TLDef(0xEBBCA3CB)] @@ -2934,7 +2936,7 @@ namespace TL } } /// You received a gift, see here » for more info. See - [TLDef(0x4717E8A4)] + [TLDef(0xF24DE7FA)] public sealed partial class MessageActionStarGift : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -2954,6 +2956,8 @@ namespace TL [IfFlag(12)] public Peer peer; /// For channel gifts, ID to use in s. [IfFlag(12)] public long saved_id; + [IfFlag(14)] public string prepaid_upgrade_hash; + [IfFlag(15)] public int gift_msg_id; [Flags] public enum Flags : uint { @@ -2979,6 +2983,12 @@ namespace TL has_from_id = 0x800, /// Fields and have a value has_peer = 0x1000, + prepaid_upgrade = 0x2000, + /// Field has a value + has_prepaid_upgrade_hash = 0x4000, + /// Field has a value + has_gift_msg_id = 0x8000, + upgrade_separate = 0x10000, } } /// A gift » was upgraded to a collectible gift ». See @@ -3028,6 +3038,7 @@ namespace TL has_can_transfer_at = 0x200, /// Field has a value has_can_resell_at = 0x400, + prepaid_upgrade = 0x800, } } /// See @@ -3422,11 +3433,13 @@ namespace TL public Auth_AuthorizationBase authorization; } /// See - [TLDef(0xD7CEF980)] + [TLDef(0xD7A2FCF9)] public sealed partial class Auth_SentCodePaymentRequired : Auth_SentCodeBase { public string store_product; public string phone_code_hash; + public string support_email_address; + public string support_email_subject; } /// Object contains info on user authorization. See Derived classes: , @@ -3769,7 +3782,7 @@ namespace TL } /// Extended user info See - [TLDef(0x7E63CE1F)] + [TLDef(0xC577B5AD)] public sealed partial class UserFull : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -3800,8 +3813,7 @@ namespace TL [IfFlag(11)] public int folder_id; /// Time To Live of all messages in this chat; once a message is this many seconds old, it must be deleted. [IfFlag(14)] public int ttl_period; - /// Emoji associated with chat theme - [IfFlag(15)] public string theme_emoticon; + [IfFlag(15)] public ChatThemeBase theme; /// Anonymized text to be shown instead of the user's name on forwarded messages [IfFlag(16)] public string private_forward_name; /// A suggested set of administrator rights for the bot, to be shown when adding the bot as admin to a group, see here for more info on how to handle them ». @@ -3839,6 +3851,8 @@ namespace TL [IfFlag(49)] public StarsRating stars_rating; [IfFlag(50)] public StarsRating stars_my_pending_rating; [IfFlag(50)] public DateTime stars_my_pending_rating_date; + [IfFlag(52)] public ProfileTab main_tab; + [IfFlag(53)] public DocumentBase saved_music; [Flags] public enum Flags : uint { @@ -3866,8 +3880,8 @@ namespace TL video_calls_available = 0x2000, /// Field has a value has_ttl_period = 0x4000, - /// Field has a value - has_theme_emoticon = 0x8000, + /// Field has a value + has_theme = 0x8000, /// Field has a value has_private_forward_name = 0x10000, /// Field has a value @@ -3935,6 +3949,10 @@ namespace TL has_stars_rating = 0x20000, /// Fields and have a value has_stars_my_pending_rating = 0x40000, + /// Field has a value + has_main_tab = 0x100000, + /// Field has a value + has_saved_music = 0x200000, } } @@ -15534,6 +15552,42 @@ namespace TL [TLDef(0xE926D63E)] public sealed partial class Account_ResetPasswordOk : Account_ResetPasswordResult { } + /// See + public abstract partial class ChatThemeBase : IObject { } + /// See + [TLDef(0xC3DFFC04)] + public sealed partial class ChatTheme : ChatThemeBase + { + public string emoticon; + } + /// See + [TLDef(0x3458F9C8)] + public sealed partial class ChatThemeUniqueGift : ChatThemeBase + { + public StarGiftBase gift; + public ThemeSettings[] theme_settings; + } + + /// See + /// a value means account.chatThemesNotModified + [TLDef(0x16484857)] + public sealed partial class Account_ChatThemes : IObject, IPeerResolver + { + public Flags flags; + public long hash; + public ChatThemeBase[] themes; + public Dictionary chats; + public Dictionary users; + [IfFlag(0)] public int next_offset; + + [Flags] public enum Flags : uint + { + has_next_offset = 0x1, + } + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); + } + /// A sponsored message. See [TLDef(0x7DBF8673)] public sealed partial class SponsoredMessage : IObject @@ -16243,6 +16297,13 @@ namespace TL ton = 0x1, } } + /// See + [TLDef(0x9A0B48B8)] + public sealed partial class InputInvoiceStarGiftPrepaidUpgrade : InputInvoice + { + public InputPeer peer; + public string hash; + } /// Exported invoice deep link See [TLDef(0xAED0CBD9)] @@ -16385,15 +16446,23 @@ namespace TL } } /// Used to top up the Telegram Stars balance of the current account. See - [TLDef(0xDDDD0F56)] + [TLDef(0xF9A2A6CB)] public sealed partial class InputStorePaymentStarsTopup : InputStorePaymentPurpose { + public Flags flags; /// Amount of stars to topup public long stars; /// Three-letter ISO 4217 currency code public string currency; /// Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). public long amount; + [IfFlag(0)] public InputPeer spend_purpose_peer; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_spend_purpose_peer = 0x1, + } } /// Used to gift Telegram Stars to a friend. See [TLDef(0x1D741EF7)] @@ -19768,6 +19837,7 @@ namespace TL /// Fields and have a value has_ads_proceeds_from_date = 0x800000, posts_search = 0x1000000, + stargift_prepaid_upgrade = 0x2000000, } } @@ -20149,7 +20219,7 @@ namespace TL public virtual Peer ReleasedBy => default; } /// Represents a star gift, see here » for more info. See - [TLDef(0x00BCFF5B)] + [TLDef(0x80AC53C3)] public sealed partial class StarGift : StarGiftBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -20177,6 +20247,7 @@ namespace TL [IfFlag(6)] public Peer released_by; [IfFlag(8)] public int per_user_total; [IfFlag(8)] public int per_user_remains; + [IfFlag(9)] public DateTime locked_until_date; [Flags] public enum Flags : uint { @@ -20196,6 +20267,8 @@ namespace TL has_released_by = 0x40, require_premium = 0x80, limited_per_user = 0x100, + /// Field has a value + has_locked_until_date = 0x200, } /// Identifier of the gift @@ -20206,13 +20279,14 @@ namespace TL public override Peer ReleasedBy => released_by; } /// Represents a collectible star gift, see here » for more info. See - [TLDef(0x3A274D50)] + [TLDef(0x1BEFE865)] public sealed partial class StarGiftUnique : StarGiftBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Identifier of the gift. public long id; + public long gift_id; public string title; public string slug; public int num; @@ -20225,6 +20299,9 @@ namespace TL [IfFlag(3)] public string gift_address; [IfFlag(4)] public StarsAmountBase[] resell_amount; [IfFlag(5)] public Peer released_by; + [IfFlag(8)] public long value_amount; + [IfFlag(8)] public string value_currency; + [IfFlag(10)] public Peer theme_peer; [Flags] public enum Flags : uint { @@ -20242,6 +20319,11 @@ namespace TL has_released_by = 0x20, require_premium = 0x40, resale_ton_only = 0x80, + /// Fields and have a value + has_value_amount = 0x100, + theme_available = 0x200, + /// Field has a value + has_theme_peer = 0x400, } /// Identifier of the gift. @@ -20636,23 +20718,29 @@ namespace TL } /// See - [TLDef(0xCAA2F60B)] - public sealed partial class Payments_UniqueStarGift : IObject + [TLDef(0x416C56E8)] + public sealed partial class Payments_UniqueStarGift : IObject, IPeerResolver { public StarGiftBase gift; + public Dictionary chats; public Dictionary users; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// See - [TLDef(0xB53E8B21)] - public sealed partial class Messages_WebPagePreview : IObject + [TLDef(0x8C9A88AC)] + public sealed partial class Messages_WebPagePreview : IObject, IPeerResolver { public MessageMedia media; + public Dictionary chats; public Dictionary users; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// See - [TLDef(0x1EA646DF)] + [TLDef(0x19A9B572)] public sealed partial class SavedStarGift : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -20670,6 +20758,7 @@ namespace TL [IfFlag(13)] public DateTime can_transfer_at; [IfFlag(14)] public DateTime can_resell_at; [IfFlag(15)] public int[] collection_id; + [IfFlag(16)] public string prepaid_upgrade_hash; [Flags] public enum Flags : uint { @@ -20700,6 +20789,9 @@ namespace TL has_can_resell_at = 0x4000, /// Field has a value has_collection_id = 0x8000, + /// Field has a value + has_prepaid_upgrade_hash = 0x10000, + upgrade_separate = 0x20000, } } @@ -21087,4 +21179,107 @@ namespace TL has_wait_till = 0x2, } } + + /// See + [TLDef(0x512FE446)] + public sealed partial class Payments_UniqueStarGiftValueInfo : IObject + { + public Flags flags; + public string currency; + public long value; + public DateTime initial_sale_date; + public long initial_sale_stars; + public long initial_sale_price; + [IfFlag(0)] public DateTime last_sale_date; + [IfFlag(0)] public long last_sale_price; + [IfFlag(2)] public long floor_price; + [IfFlag(3)] public long average_price; + [IfFlag(4)] public int listed_count; + [IfFlag(5)] public int fragment_listed_count; + [IfFlag(5)] public string fragment_listed_url; + + [Flags] public enum Flags : uint + { + has_last_sale_date = 0x1, + last_sale_on_fragment = 0x2, + has_floor_price = 0x4, + has_average_price = 0x8, + has_listed_count = 0x10, + has_fragment_listed_count = 0x20, + value_is_average = 0x40, + } + } + + /// See + public enum ProfileTab : uint + { + ///See + Posts = 0xB98CD696, + ///See + Gifts = 0x4D4BD46A, + ///See + Media = 0x72C64955, + ///See + Files = 0xAB339C00, + ///See + Music = 0x9F27D26E, + ///See + Voice = 0xE477092E, + ///See + Links = 0xD3656499, + ///See + Gifs = 0xA2C0F695, + } + + /// See + public abstract partial class Users_SavedMusicBase : IObject { } + /// See + [TLDef(0xE3878AA4)] + public sealed partial class Users_SavedMusicNotModified : Users_SavedMusicBase + { + public int count; + } + /// See + [TLDef(0x34A2F297)] + public sealed partial class Users_SavedMusic : Users_SavedMusicBase + { + public int count; + public DocumentBase[] documents; + } + + /// See + /// a value means account.savedMusicIdsNotModified + [TLDef(0x998D6636)] + public sealed partial class Account_SavedMusicIds : IObject + { + public long[] ids; + } + + /// See + public abstract partial class Payments_CheckCanSendGiftResult : IObject { } + /// See + [TLDef(0x374FA7AD)] + public sealed partial class Payments_CheckCanSendGiftResultOk : Payments_CheckCanSendGiftResult { } + /// See + [TLDef(0xD5E58274)] + public sealed partial class Payments_CheckCanSendGiftResultFail : Payments_CheckCanSendGiftResult + { + public TextWithEntities reason; + } + + /// See + /// a value means inputChatThemeEmpty + public abstract partial class InputChatThemeBase : IObject { } + /// See + [TLDef(0xC93DE95C)] + public sealed partial class InputChatTheme : InputChatThemeBase + { + public string emoticon; + } + /// See + [TLDef(0x87E5DFE4)] + public sealed partial class InputChatThemeUniqueGift : InputChatThemeBase + { + public string slug; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 9ea3dd5..804263a 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1457,6 +1457,40 @@ namespace TL user_id = user_id, }); + /// See + public static Task Account_SetMainProfileTab(this Client client, ProfileTab tab) + => client.Invoke(new Account_SetMainProfileTab + { + tab = tab, + }); + + /// See + public static Task Account_SaveMusic(this Client client, InputDocument id, InputDocument after_id = null, bool unsave = false) + => client.Invoke(new Account_SaveMusic + { + flags = (Account_SaveMusic.Flags)((after_id != null ? 0x2 : 0) | (unsave ? 0x1 : 0)), + id = id, + after_id = after_id, + }); + + /// See + /// a null value means account.savedMusicIdsNotModified + public static Task Account_GetSavedMusicIds(this Client client, long hash = default) + => client.Invoke(new Account_GetSavedMusicIds + { + hash = hash, + }); + + /// See + /// a null value means account.chatThemesNotModified + public static Task Account_GetUniqueGiftChatThemes(this Client client, int offset = default, int limit = int.MaxValue, long hash = default) + => client.Invoke(new Account_GetUniqueGiftChatThemes + { + offset = offset, + limit = limit, + hash = hash, + }); + /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: -504,400 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, params InputUserBase[] id) @@ -1491,6 +1525,24 @@ namespace TL id = id, }); + /// See + public static Task Users_GetSavedMusic(this Client client, InputUserBase id, int offset = default, int limit = int.MaxValue, long hash = default) + => client.Invoke(new Users_GetSavedMusic + { + id = id, + offset = offset, + limit = limit, + hash = hash, + }); + + /// See + public static Task Users_GetSavedMusicByID(this Client client, InputUserBase id, params InputDocument[] documents) + => client.Invoke(new Users_GetSavedMusicByID + { + id = id, + documents = documents, + }); + /// Get the telegram IDs of all contacts.
Returns an array of Telegram user IDs for all contacts (0 if a contact does not have an associated Telegram account or have hidden their account using privacy settings). See
/// Hash used for caching, for more info click here public static Task Contacts_GetContactIDs(this Client client, long hash = default) @@ -3522,12 +3574,11 @@ namespace TL /// Change the chat theme of a certain chat See Possible codes: 400 (details) /// Private chat where to change theme - /// Emoji, identifying a specific chat theme; a list of chat themes can be fetched using Account_GetChatThemes - public static Task Messages_SetChatTheme(this Client client, InputPeer peer, string emoticon) + public static Task Messages_SetChatTheme(this Client client, InputPeer peer, InputChatThemeBase theme) => client.Invoke(new Messages_SetChatTheme { peer = peer, - emoticon = emoticon, + theme = theme, }); /// Get which users read a specific message: only available for groups and supergroups with less than chat_read_mark_size_threshold members, read receipts will be stored for chat_read_mark_expire_period seconds after the message was sent, see client configuration for more info ». See Possible codes: 400 (details) @@ -5700,6 +5751,14 @@ namespace TL query = query, }); + /// See + public static Task Channels_SetMainProfileTab(this Client client, InputChannelBase channel, ProfileTab tab) + => client.Invoke(new Channels_SetMainProfileTab + { + channel = channel, + tab = tab, + }); + /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) /// The method name /// JSON-serialized method parameters @@ -6442,10 +6501,10 @@ namespace TL /// See Possible codes: 400 (details) /// Maximum number of results to return, see pagination - 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) + 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_unique = false, bool sort_by_value = false, bool exclude_upgradable = false, bool exclude_unupgradable = false) => client.Invoke(new Payments_GetSavedStarGifts { - 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)), + flags = (Payments_GetSavedStarGifts.Flags)((collection_id != null ? 0x40 : 0) | (exclude_unsaved ? 0x1 : 0) | (exclude_saved ? 0x2 : 0) | (exclude_unlimited ? 0x4 : 0) | (exclude_unique ? 0x10 : 0) | (sort_by_value ? 0x20 : 0) | (exclude_upgradable ? 0x80 : 0) | (exclude_unupgradable ? 0x100 : 0)), peer = peer, collection_id = collection_id ?? default, offset = offset, @@ -6558,6 +6617,20 @@ namespace TL hash = hash, }); + /// See + public static Task Payments_GetUniqueStarGiftValueInfo(this Client client, string slug) + => client.Invoke(new Payments_GetUniqueStarGiftValueInfo + { + slug = slug, + }); + + /// See + public static Task Payments_CheckCanSendGift(this Client client, long gift_id) + => client.Invoke(new Payments_CheckCanSendGift + { + gift_id = gift_id, + }); + /// Create a stickerset. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is a custom emoji stickerset. @@ -9001,6 +9074,40 @@ namespace TL.Methods } } + [TLDef(0x5DEE78B0)] + public sealed partial class Account_SetMainProfileTab : IMethod + { + public ProfileTab tab; + } + + [TLDef(0xB26732A9)] + public sealed partial class Account_SaveMusic : IMethod + { + public Flags flags; + public InputDocument id; + [IfFlag(1)] public InputDocument after_id; + + [Flags] public enum Flags : uint + { + unsave = 0x1, + has_after_id = 0x2, + } + } + + [TLDef(0xE09D5FAF)] + public sealed partial class Account_GetSavedMusicIds : IMethod + { + public long hash; + } + + [TLDef(0xFE74EF9F)] + public sealed partial class Account_GetUniqueGiftChatThemes : IMethod + { + public int offset; + public int limit; + public long hash; + } + [TLDef(0x0D91A548)] public sealed partial class Users_GetUsers : IMethod { @@ -9026,6 +9133,22 @@ namespace TL.Methods public InputUserBase[] id; } + [TLDef(0x788D7FE3)] + public sealed partial class Users_GetSavedMusic : IMethod + { + public InputUserBase id; + public int offset; + public int limit; + public long hash; + } + + [TLDef(0x7573A4E9)] + public sealed partial class Users_GetSavedMusicByID : IMethod + { + public InputUserBase id; + public InputDocument[] documents; + } + [TLDef(0x7ADC669D)] public sealed partial class Contacts_GetContactIDs : IMethod { @@ -10789,11 +10912,11 @@ namespace TL.Methods public InputPeer peer; } - [TLDef(0xE63BE13F)] + [TLDef(0x081202C9)] public sealed partial class Messages_SetChatTheme : IMethod { public InputPeer peer; - public string emoticon; + public InputChatThemeBase theme; } [TLDef(0x31C1C44F)] @@ -12603,6 +12726,13 @@ namespace TL.Methods } } + [TLDef(0x3583FCB1)] + public sealed partial class Channels_SetMainProfileTab : IMethod + { + public InputChannelBase channel; + public ProfileTab tab; + } + [TLDef(0xAA2769ED)] public sealed partial class Bots_SendCustomRequest : IMethod { @@ -13260,10 +13390,11 @@ namespace TL.Methods exclude_unsaved = 0x1, exclude_saved = 0x2, exclude_unlimited = 0x4, - exclude_limited = 0x8, exclude_unique = 0x10, sort_by_value = 0x20, has_collection_id = 0x40, + exclude_upgradable = 0x80, + exclude_unupgradable = 0x100, } } @@ -13380,6 +13511,18 @@ namespace TL.Methods public long hash; } + [TLDef(0x4365AF6B)] + public sealed partial class Payments_GetUniqueStarGiftValueInfo : IMethod + { + public string slug; + } + + [TLDef(0xC0C4EDC9)] + public sealed partial class Payments_CheckCanSendGift : IMethod + { + public long gift_id; + } + [TLDef(0x9021AB67)] public sealed partial class Stickers_CreateStickerSet : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 3be9440..00b0355 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 = 211; // fetched 16/08/2025 00:21:53 + public const int Version = 214; // fetched 01/09/2025 11:20:56 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -140,7 +140,7 @@ namespace TL [0xFE685355] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), [0x2633421B] = typeof(ChatFull), - [0xE07429DE] = typeof(ChannelFull), + [0xE4E0B29D] = typeof(ChannelFull), [0xC02D4007] = typeof(ChatParticipant), [0xE46BCEE4] = typeof(ChatParticipantCreator), [0xA0933F5B] = typeof(ChatParticipantAdmin), @@ -197,7 +197,7 @@ namespace TL [0x502F92F7] = typeof(MessageActionInviteToGroupCall), [0x3C134D7B] = typeof(MessageActionSetMessagesTTL), [0xB3A07661] = typeof(MessageActionGroupCallScheduled), - [0xAA786345] = typeof(MessageActionSetChatTheme), + [0xB91BBD3A] = typeof(MessageActionSetChatTheme), [0xEBBCA3CB] = typeof(MessageActionChatJoinedByRequest), [0x47DD8079] = typeof(MessageActionWebViewDataSentMe), [0xB4C38CB5] = typeof(MessageActionWebViewDataSent), @@ -215,7 +215,7 @@ namespace TL [0x41B3E202] = typeof(MessageActionPaymentRefunded), [0x45D5B021] = typeof(MessageActionGiftStars), [0xB00C47A2] = typeof(MessageActionPrizeStars), - [0x4717E8A4] = typeof(MessageActionStarGift), + [0xF24DE7FA] = typeof(MessageActionStarGift), [0x34F762F3] = typeof(MessageActionStarGiftUnique), [0xAC1F1FCD] = typeof(MessageActionPaidMessagesRefunded), [0x84B88578] = typeof(MessageActionPaidMessagesPrice), @@ -240,7 +240,7 @@ namespace TL [0xB2A2F663] = typeof(GeoPoint), [0x5E002502] = typeof(Auth_SentCode), [0x2390FE44] = typeof(Auth_SentCodeSuccess), - [0xD7CEF980] = typeof(Auth_SentCodePaymentRequired), + [0xD7A2FCF9] = typeof(Auth_SentCodePaymentRequired), [0x2EA2C0D4] = typeof(Auth_Authorization), [0x44747E9A] = typeof(Auth_AuthorizationSignUpRequired), [0xB434E2B8] = typeof(Auth_ExportedAuthorization), @@ -254,7 +254,7 @@ namespace TL [0xF47741F7] = typeof(PeerSettings), [0xA437C3ED] = typeof(WallPaper), [0xE0804116] = typeof(WallPaperNoFile), - [0x7E63CE1F] = typeof(UserFull), + [0xC577B5AD] = typeof(UserFull), [0x145ADE0B] = typeof(Contact), [0xC13E3C50] = typeof(ImportedContact), [0x16D9703B] = typeof(ContactStatus), @@ -1079,6 +1079,10 @@ namespace TL [0xE3779861] = typeof(Account_ResetPasswordFailedWait), [0xE9EFFC7D] = typeof(Account_ResetPasswordRequestedWait), [0xE926D63E] = typeof(Account_ResetPasswordOk), + [0xC3DFFC04] = typeof(ChatTheme), + [0x3458F9C8] = typeof(ChatThemeUniqueGift), + [0xE011E1C4] = null,//Account_ChatThemesNotModified + [0x16484857] = typeof(Account_ChatThemes), [0x7DBF8673] = typeof(SponsoredMessage), [0xFFDA656D] = typeof(Messages_SponsoredMessages), [0x1839490F] = null,//Messages_SponsoredMessagesEmpty @@ -1130,6 +1134,7 @@ namespace TL [0xDABAB2EF] = typeof(InputInvoicePremiumGiftStars), [0xF4997E42] = typeof(InputInvoiceBusinessBotTransferStars), [0xC39F5324] = typeof(InputInvoiceStarGiftResale), + [0x9A0B48B8] = typeof(InputInvoiceStarGiftPrepaidUpgrade), [0xAED0CBD9] = typeof(Payments_ExportedInvoice), [0xCFB9D957] = typeof(Messages_TranscribedAudio), [0x5334759C] = typeof(Help_PremiumPromo), @@ -1137,7 +1142,7 @@ namespace TL [0x616F7FE8] = typeof(InputStorePaymentGiftPremium), [0xFB790393] = typeof(InputStorePaymentPremiumGiftCode), [0x160544CA] = typeof(InputStorePaymentPremiumGiveaway), - [0xDDDD0F56] = typeof(InputStorePaymentStarsTopup), + [0xF9A2A6CB] = typeof(InputStorePaymentStarsTopup), [0x1D741EF7] = typeof(InputStorePaymentStarsGift), [0x751F08FA] = typeof(InputStorePaymentStarsGiveaway), [0x9BB2636D] = typeof(InputStorePaymentAuthCode), @@ -1362,8 +1367,8 @@ namespace TL [0x4BA3A95A] = typeof(MessageReactor), [0x94CE852A] = typeof(StarsGiveawayOption), [0x54236209] = typeof(StarsGiveawayWinnersOption), - [0x00BCFF5B] = typeof(StarGift), - [0x3A274D50] = typeof(StarGiftUnique), + [0x80AC53C3] = typeof(StarGift), + [0x1BEFE865] = typeof(StarGiftUnique), [0xA388A368] = null,//Payments_StarGiftsNotModified [0x2ED82995] = typeof(Payments_StarGifts), [0x7903E3D9] = typeof(MessageReportOption), @@ -1390,9 +1395,9 @@ namespace TL [0x167BD90B] = typeof(Payments_StarGiftUpgradePreview), [0x62D706B8] = typeof(Users_Users), [0x315A4974] = typeof(Users_UsersSlice), - [0xCAA2F60B] = typeof(Payments_UniqueStarGift), - [0xB53E8B21] = typeof(Messages_WebPagePreview), - [0x1EA646DF] = typeof(SavedStarGift), + [0x416C56E8] = typeof(Payments_UniqueStarGift), + [0x8C9A88AC] = typeof(Messages_WebPagePreview), + [0x19A9B572] = typeof(SavedStarGift), [0x95F389B1] = typeof(Payments_SavedStarGifts), [0x69279795] = typeof(InputSavedStarGiftUser), [0xF101AA7F] = typeof(InputSavedStarGiftChat), @@ -1429,6 +1434,16 @@ namespace TL [0x564EDAEB] = null,//Stories_AlbumsNotModified [0xC3987A3A] = typeof(Stories_Albums), [0x3E0B5B6A] = typeof(SearchPostsFlood), + [0x512FE446] = typeof(Payments_UniqueStarGiftValueInfo), + [0xE3878AA4] = typeof(Users_SavedMusicNotModified), + [0x34A2F297] = typeof(Users_SavedMusic), + [0x4FC81D6E] = null,//Account_SavedMusicIdsNotModified + [0x998D6636] = typeof(Account_SavedMusicIds), + [0x374FA7AD] = typeof(Payments_CheckCanSendGiftResultOk), + [0xD5E58274] = typeof(Payments_CheckCanSendGiftResultFail), + [0x83268483] = null,//InputChatThemeEmpty + [0xC93DE95C] = typeof(InputChatTheme), + [0x87E5DFE4] = typeof(InputChatThemeUniqueGift), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), @@ -1548,6 +1563,7 @@ namespace TL [typeof(ChatReactions)] = 0xEAFC32BC, //chatReactionsNone [typeof(Messages_Reactions)] = 0xB06FDBDF, //messages.reactionsNotModified // from TL.Secret: + [typeof(Account_ChatThemes)] = 0xE011E1C4, //account.chatThemesNotModified [typeof(EmojiStatusBase)] = 0x2DE11AAE, //emojiStatusEmpty [typeof(EmojiList)] = 0x481EADFA, //emojiListNotModified [typeof(Messages_EmojiGroups)] = 0x6FB4AD87, //messages.emojiGroupsNotModified @@ -1564,6 +1580,8 @@ namespace TL [typeof(Contacts_SponsoredPeers)] = 0xEA32B4B1, //contacts.sponsoredPeersEmpty [typeof(Payments_StarGiftCollections)] = 0xA0BA4F17, //payments.starGiftCollectionsNotModified [typeof(Stories_Albums)] = 0x564EDAEB, //stories.albumsNotModified + [typeof(Account_SavedMusicIds)] = 0x4FC81D6E, //account.savedMusicIdsNotModified + [typeof(InputChatThemeBase)] = 0x83268483, //inputChatThemeEmpty [typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty }; } diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index ed47ea1..6fd580b 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,8 +13,8 @@ WTelegramClient Wizou 0.0.0 - layer.211 - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 211 + layer.214 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 214 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From 4578dea3a37f98767f48f1f362128969b6ccd198 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 21 Sep 2025 01:55:11 +0200 Subject: [PATCH 24/54] HtmlToEntities tolerate unclosed &.. html entities --- src/Services.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Services.cs b/src/Services.cs index a83eed6..4b8cd9d 100644 --- a/src/Services.cs +++ b/src/Services.cs @@ -378,15 +378,15 @@ namespace TL end = offset + 1; if (end < sb.Length && sb[end] == '#') end++; while (end < sb.Length && sb[end] is >= 'a' and <= 'z' or >= 'A' and <= 'Z' or >= '0' and <= '9') end++; - if (end >= sb.Length || sb[end] != ';') break; - var html = HttpUtility.HtmlDecode(sb.ToString(offset, end - offset + 1)); + var html = HttpUtility.HtmlDecode(end >= sb.Length || sb[end] != ';' + ? sb.ToString(offset, end - offset) + ";" : sb.ToString(offset, ++end - offset)); if (html.Length == 1) { sb[offset] = html[0]; - sb.Remove(++offset, end - offset + 1); + sb.Remove(++offset, end - offset); } else - offset = end + 1; + offset = end; } else if (c == '<') { From 3f1036a559b0739b278c1d44a2a8562d1b36a63e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 25 Sep 2025 02:04:16 +0200 Subject: [PATCH 25/54] Fix #335 GetAllDialogs infinite loop when last dialogs' messages are unavailable --- README.md | 2 +- src/Client.Helpers.cs | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d085aeb..5bf0849 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This library allows you to connect to Telegram and control a user programmatically (or a bot, but [WTelegramBot](https://www.nuget.org/packages/WTelegramBot) is much easier for that). All the Telegram Client APIs (MTProto) are supported so you can do everything the user could do with a full Telegram GUI client. -Library was developed solely by one unemployed guy. [Donations are welcome](https://buymeacoffee.com/wizou). +Library was developed solely by one unemployed guy. [Donations](https://buymeacoffee.com/wizou) or [Patreon memberships are welcome](https://patreon.com/wizou). This ReadMe is a **quick but important tutorial** to learn the fundamentals about this library. Please read it all. diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 3cc888f..2dd3c59 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -535,18 +535,20 @@ namespace WTelegram case Messages_DialogsSlice mds: var dialogList = new List(); var messageList = new List(); - while (dialogs.Dialogs.Length != 0) + int skip = 0; + while (dialogs.Dialogs.Length > skip) { - dialogList.AddRange(dialogs.Dialogs); + dialogList.AddRange(skip == 0 ? dialogs.Dialogs : dialogs.Dialogs[skip..]); messageList.AddRange(dialogs.Messages); + skip = 0; int last = dialogs.Dialogs.Length - 1; var lastDialog = dialogs.Dialogs[last]; + retryDate: var lastPeer = dialogs.UserOrChat(lastDialog).ToInputPeer(); var lastMsgId = lastDialog.TopMessage; - retryDate: var lastDate = dialogs.Messages.LastOrDefault(m => m.Peer.ID == lastDialog.Peer.ID && m.ID == lastDialog.TopMessage)?.Date ?? default; if (lastDate == default) - if (--last < 0) break; else { lastDialog = dialogs.Dialogs[last]; goto retryDate; } + if (--last < 0) break; else { ++skip; lastDialog = dialogs.Dialogs[last]; goto retryDate; } dialogs = await this.Messages_GetDialogs(lastDate, lastMsgId, lastPeer, folder_id: folder_id); if (dialogs is not Messages_Dialogs md) break; foreach (var (key, value) in md.chats) mds.chats[key] = value; From 610d059b4ce57401e66d0fff16187c782661650e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 3 Oct 2025 13:09:33 +0200 Subject: [PATCH 26/54] Fix: Messages_Search helper parameter name --- src/Client.Helpers.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 2dd3c59..e205579 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -94,19 +94,19 @@ namespace WTelegram /// Search messages in chat with filter and text See /// See for a list of possible filter types /// User or chat, histories with which are searched, or constructor for global search - /// Text search request + /// Text search request /// Only return messages starting from the specified message ID /// Number of results to return - public Task Messages_Search(InputPeer peer, string text = null, int offset_id = 0, int limit = int.MaxValue) where T : MessagesFilter, new() - => this.Messages_Search(peer, text, new T(), offset_id: offset_id, limit: limit); + public Task Messages_Search(InputPeer peer, string q = null, int offset_id = 0, int limit = int.MaxValue) where T : MessagesFilter, new() + => this.Messages_Search(peer, q, new T(), offset_id: offset_id, limit: limit); /// Search messages globally with filter and text See /// See for a list of possible filter types - /// Text search request + /// Query /// Only return messages starting from the specified message ID /// Number of results to return - public Task Messages_SearchGlobal(string text = null, int offset_id = 0, int limit = int.MaxValue) where T : MessagesFilter, new() - => this.Messages_SearchGlobal(text, new T(), offset_id: offset_id, limit: limit); + public Task Messages_SearchGlobal(string q = null, int offset_id = 0, int limit = int.MaxValue) where T : MessagesFilter, new() + => this.Messages_SearchGlobal(q, new T(), offset_id: offset_id, limit: limit); /// Helper method to send a media message more easily /// Destination of message (chat group, channel, user chat, etc..) From a5323eaa8647fec4d3b4f0896ea62c3cd473c6fe Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 6 Oct 2025 18:34:25 +0200 Subject: [PATCH 27/54] api doc --- src/TL.Schema.cs | 728 ++++++++++++++++++++++++++++++++---------- src/TL.SchemaFuncs.cs | 470 ++++++++++++++++++--------- src/TL.Secret.cs | 31 +- 3 files changed, 900 insertions(+), 329 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 08737fd..16411b9 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -244,7 +244,9 @@ namespace TL public DocumentAttribute[] attributes; /// Attached stickers [IfFlag(0)] public InputDocument[] stickers; + /// Start playing the video at the specified timestamp (seconds). [IfFlag(6)] public InputPhoto video_cover; + /// Start playing the video at the specified timestamp (seconds). [IfFlag(7)] public int video_timestamp; /// Time to live in seconds of self-destructing document [IfFlag(1)] public int ttl_seconds; @@ -277,7 +279,9 @@ namespace TL public Flags flags; /// The document to be forwarded. public InputDocument id; + /// Custom video cover. [IfFlag(3)] public InputPhoto video_cover; + /// Start playing the video at the specified timestamp (seconds). [IfFlag(4)] public int video_timestamp; /// Time to live of self-destructing document [IfFlag(0)] public int ttl_seconds; @@ -344,7 +348,9 @@ namespace TL public string url; /// Self-destruct time to live of document [IfFlag(0)] public int ttl_seconds; + /// Custom video cover. [IfFlag(2)] public InputPhoto video_cover; + /// Start playing the video at the specified timestamp (seconds). [IfFlag(3)] public int video_timestamp; [Flags] public enum Flags : uint @@ -507,10 +513,11 @@ namespace TL has_payload = 0x1, } } - /// See + /// Creates a todo list ». See [TLDef(0x9FC55FDE)] public sealed partial class InputMediaTodo : InputMedia { + /// The todo list. public TodoList todo; } @@ -582,7 +589,7 @@ namespace TL public long id; /// REQUIRED FIELD. See how to obtain it
access_hash value from the
public long access_hash; - ///
File reference + /// File reference public byte[] file_reference; } @@ -598,7 +605,7 @@ namespace TL public int local_id; /// Check sum to access the file public long secret; - /// File reference + /// File reference public byte[] file_reference; } /// Location of encrypted secret chat file. See @@ -618,7 +625,7 @@ namespace TL public long id; /// REQUIRED FIELD. See how to obtain it
access_hash parameter from the
public long access_hash; - ///
File reference + /// File reference public byte[] file_reference; /// Thumbnail size to download the thumbnail public string thumb_size; @@ -643,7 +650,7 @@ namespace TL public long id; /// REQUIRED FIELD. See how to obtain it
Photo's access hash, obtained from the object
public long access_hash; - /// File reference + /// File reference public byte[] file_reference; /// The to download: must be set to the type field of the desired PhotoSize object of the public string thumb_size; @@ -781,7 +788,7 @@ namespace TL public Flags flags; /// Extra bits of information, use flags2.HasFlag(...) to test for those public Flags2 flags2; - /// ID of the user, see here » for more info. + /// ID of the user, see here » for more info and the available ID range. 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.
[IfFlag(0)] public long access_hash; @@ -817,6 +824,7 @@ namespace TL [IfFlag(41)] public PeerColor profile_color; /// Monthly Active Users (MAU) of this bot (may be absent for small bots). [IfFlag(44)] public int bot_active_users; + /// Describes a bot verification icon ». [IfFlag(46)] public long bot_verification_icon; /// If set, the user has enabled paid messages », we might need to pay the specified amount of Stars to send them messages, depending on the configured exceptions: check .send_paid_messages_stars or Users_GetRequirementsToContact to see if the currently logged in user actually has to pay or not, see here » for the full flow. [IfFlag(47)] public long send_paid_messages_stars; @@ -901,7 +909,7 @@ namespace TL has_profile_color = 0x200, /// See here for more info on this flag ». contact_require_premium = 0x400, - /// Whether this bot can be connected to a user as specified here ». + /// Whether this bot can be connected to a user as specified here ». bot_business = 0x800, /// Field has a value has_bot_active_users = 0x1000, @@ -999,7 +1007,7 @@ namespace TL /// Object defines a group. See Derived classes: , , , , public abstract partial class ChatBase : IObject { - /// ID of the group, see here » for more info + /// ID of the group, see here » for more info and the available ID range. public virtual long ID => default; /// Title public virtual string Title => default; @@ -1020,7 +1028,7 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// ID of the group, see here » for more info + /// ID of the group, see here » for more info and the available ID range. public long id; /// Title public string title; @@ -1061,7 +1069,7 @@ namespace TL noforwards = 0x2000000, } - /// ID of the group, see here » for more info + /// ID of the group, see here » for more info and the available ID range. public override long ID => id; /// Title public override string Title => title; @@ -1088,7 +1096,7 @@ namespace TL public Flags flags; /// Extra bits of information, use flags2.HasFlag(...) to test for those public Flags2 flags2; - /// ID of the channel, see here » for more info + /// ID of the channel, see here » for more info and the available ID range. public long id; /// Access hash, see here » for more info [IfFlag(13)] public long access_hash; @@ -1124,9 +1132,11 @@ namespace TL [IfFlag(42)] public int level; /// Expiration date of the Telegram Star subscription » the current user has bought to gain access to this channel. [IfFlag(43)] public DateTime subscription_until_date; + /// Describes a bot verification icon ». [IfFlag(45)] public long bot_verification_icon; - /// If set, this supergroup or monoforum has enabled paid messages », we might need to pay the specified amount of Stars to send messages to it, depending on the configured exceptions: check .send_paid_messages_stars to see if the currently logged in user actually has to pay or not, see here » for the full flow (only set for the monoforum, not the associated channel). + /// If set, this supergroup or monoforum has enabled paid messages », we might need to pay the specified amount of Stars to send messages to it, depending on the configured exceptions: check .send_paid_messages_stars to see if the currently logged in user actually has to pay or not, see here » for the full flow (only set for the monoforum, not the associated channel). [IfFlag(46)] public long send_paid_messages_stars; + /// For channels with associated monoforums, the monoforum ID. For Monoforums, the ID of the associated channel. [IfFlag(50)] public long linked_monoforum_id; [Flags] public enum Flags : uint @@ -1213,15 +1223,19 @@ namespace TL has_bot_verification_icon = 0x2000, /// Field has a value has_send_paid_messages_stars = 0x4000, + /// If set, autotranslation was enabled for all users by the admin of the channel, as specified here ». autotranslation = 0x8000, + /// If set, this channel has an associated monoforum », and its ID is specified in the linked_monoforum_id flag. broadcast_messages_allowed = 0x10000, + /// If set, this is a monoforum », and the ID of the associated channel is specified in the linked_monoforum_id. monoforum = 0x20000, /// Field has a value has_linked_monoforum_id = 0x40000, + /// If set, enables the tabbed forum UI ». forum_tabs = 0x80000, } - /// ID of the channel, see here » for more info + /// ID of the channel, see here » for more info and the available ID range. public override long ID => id; /// Title public override string Title => title; @@ -1491,10 +1505,13 @@ namespace TL [IfFlag(41)] public int boosts_unrestrict; /// Custom emoji stickerset associated to the current supergroup, set using Channels_SetEmojiStickers after reaching the appropriate boost level, see here » for more info. [IfFlag(42)] public StickerSet emojiset; + /// Bot verification icon [IfFlag(49)] public BotVerification bot_verification; + /// Admins with .post_messages rights will see the total number of received gifts, everyone else will see the number of gifts added to the channel's profile. [IfFlag(50)] public int stargifts_count; - /// If set and bigger than 0, this supergroup, monoforum or the monoforum associated to this channel has enabled paid messages » and we must pay the specified amount of Stars to send messages to it, see here » for the full flow.
This flag will be set both for the monoforum and for of the associated channel).
If set and equal to 0, the monoforum requires payment in general but we were exempted from paying.
+ /// If set and bigger than 0, this supergroup, monoforum or the monoforum associated to this channel has enabled paid messages » and we must pay the specified amount of Stars to send messages to it, see here » for the full flow.
This flag will be set both for the monoforum and for of the associated channel).
If set and equal to 0, the monoforum requires payment in general but we were exempted from paying.
[IfFlag(53)] public long send_paid_messages_stars; + /// The main tab for the channel's profile, see here » for more info. [IfFlag(54)] public ProfileTab main_tab; [Flags] public enum Flags : uint @@ -1603,7 +1620,9 @@ namespace TL has_bot_verification = 0x20000, /// Field has a value has_stargifts_count = 0x40000, + /// If set, users may send Gifts » to this channel. stargifts_available = 0x80000, + /// If set, admins may enable enable paid messages » in this supergroup. paid_messages_available = 0x100000, /// Field has a value has_send_paid_messages_stars = 0x200000, @@ -1754,7 +1773,7 @@ namespace TL public virtual Peer From => default; /// Peer ID, the chat where this message was sent public virtual Peer Peer => default; - /// Messages fetched from a saved messages dialog » will have peer= and the saved_peer_id flag set to the ID of the saved dialog.
+ /// Messages from a saved messages dialog » will have peer= and the saved_peer_id flag set to the ID of the saved dialog.
Messages from a monoforum » will have peer=ID of the monoforum and the saved_peer_id flag set to the ID of a topic.
public virtual Peer SavedPeer => default; /// Reply information public virtual MessageReplyHeaderBase ReplyTo => default; @@ -1803,13 +1822,13 @@ namespace TL [IfFlag(29)] public int from_boosts_applied; /// Peer ID, the chat where this message was sent public Peer peer_id; - /// Messages fetched from a saved messages dialog » will have peer= and the saved_peer_id flag set to the ID of the saved dialog.
+ /// Messages from a saved messages dialog » will have peer= and the saved_peer_id flag set to the ID of the saved dialog.
Messages from a monoforum » will have peer=ID of the monoforum and the saved_peer_id flag set to the ID of a topic.
[IfFlag(28)] public Peer saved_peer_id; /// Info about forwarded messages [IfFlag(2)] public MessageFwdHeader fwd_from; /// ID of the inline bot that generated the message [IfFlag(11)] public long via_bot_id; - /// Whether the message was sent by the business bot specified in via_bot_id on behalf of the user. + /// Whether the message was sent by the business bot specified in via_bot_id on behalf of the user. [IfFlag(32)] public long via_business_bot_id; /// Reply information [IfFlag(3)] public MessageReplyHeaderBase reply_to; @@ -1851,6 +1870,7 @@ namespace TL [IfFlag(37)] public DateTime report_delivery_until_date; /// The amount of stars the sender has paid to send the message, see here » for more info. [IfFlag(38)] public long paid_message_stars; + /// Used to suggest a post to a channel, see here » for more info on the full flow. [IfFlag(39)] public SuggestedPost suggested_post; [Flags] public enum Flags : uint @@ -1933,7 +1953,9 @@ namespace TL has_paid_message_stars = 0x40, /// Field has a value has_suggested_post = 0x80, + /// Set if this is a suggested channel post » that was paid using Telegram Stars. paid_suggested_post_stars = 0x100, + /// Set if this is a suggested channel post » that was paid using Toncoins. paid_suggested_post_ton = 0x200, } @@ -1943,7 +1965,7 @@ namespace TL public override Peer From => from_id; /// Peer ID, the chat where this message was sent public override Peer Peer => peer_id; - /// Messages fetched from a saved messages dialog » will have peer= and the saved_peer_id flag set to the ID of the saved dialog.
+ /// Messages from a saved messages dialog » will have peer= and the saved_peer_id flag set to the ID of the saved dialog.
Messages from a monoforum » will have peer=ID of the monoforum and the saved_peer_id flag set to the ID of a topic.
public override Peer SavedPeer => saved_peer_id; /// Reply information public override MessageReplyHeaderBase ReplyTo => reply_to; @@ -1966,6 +1988,7 @@ namespace TL [IfFlag(8)] public Peer from_id; /// Sender of service message public Peer peer_id; + /// Will only be set for service messages within a monoforum topic »: peer will be equal to the ID of the monoforum and the saved_peer_id flag will be set to the ID of a topic. [IfFlag(28)] public Peer saved_peer_id; /// Reply (thread) information [IfFlag(3)] public MessageReplyHeaderBase reply_to; @@ -1990,7 +2013,7 @@ namespace TL media_unread = 0x20, /// Field has a value has_from_id = 0x100, - /// Whether you can react to this messages ». + /// Whether you can react to this message ». reactions_are_possible = 0x200, /// Whether the message is silent silent = 0x2000, @@ -2012,6 +2035,7 @@ namespace TL public override Peer From => from_id; /// Sender of service message public override Peer Peer => peer_id; + /// Will only be set for service messages within a monoforum topic »: peer will be equal to the ID of the monoforum and the saved_peer_id flag will be set to the ID of a topic. public override Peer SavedPeer => saved_peer_id; /// Reply (thread) information public override MessageReplyHeaderBase ReplyTo => reply_to; @@ -2082,7 +2106,9 @@ namespace TL [IfFlag(0)] public DocumentBase document; /// Videos only, contains alternative qualities of the video. [IfFlag(5)] public DocumentBase[] alt_documents; + /// Custom video cover. [IfFlag(9)] public PhotoBase video_cover; + /// Start playing the video at the specified timestamp (seconds). [IfFlag(10)] public int video_timestamp; /// Time to live of self-destructing document [IfFlag(2)] public int ttl_seconds; @@ -2344,13 +2370,15 @@ namespace TL /// Either the paid-for media, or super low resolution media previews if the media wasn't purchased yet, see here » for more info. public MessageExtendedMediaBase[] extended_media; } - /// See + /// Represents a todo list ». See [TLDef(0x8A53B014)] public sealed partial class MessageMediaToDo : MessageMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The todo list. public TodoList todo; + /// Completed items. [IfFlag(0)] public TodoCompletion[] completions; [Flags] public enum Flags : uint @@ -2652,6 +2680,7 @@ namespace TL [TLDef(0xB91BBD3A)] public sealed partial class MessageActionSetChatTheme : MessageAction { + /// The new chat theme. public ChatThemeBase theme; } /// A user was accepted into the group by an admin See @@ -2681,7 +2710,7 @@ namespace TL public string currency; /// Price of the gift in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). public long amount; - /// Duration of the gifted Telegram Premium subscription + /// Duration of the gifted Telegram Premium subscription. public int months; /// If the gift was bought using a cryptocurrency, the cryptocurrency name. [IfFlag(0)] public string crypto_currency; @@ -2949,6 +2978,7 @@ namespace TL [IfFlag(4)] public long convert_stars; /// If set, this gift was upgraded to a collectible gift, and the corresponding is available at the specified message ID. [IfFlag(5)] public int upgrade_msg_id; + /// The number of Telegram Stars the user can pay to convert the gift into a collectible gift ». [IfFlag(8)] public long upgrade_stars; /// Sender of the gift (unset for anonymous gifts). [IfFlag(11)] public Peer from_id; @@ -2956,7 +2986,9 @@ namespace TL [IfFlag(12)] public Peer peer; /// For channel gifts, ID to use in s. [IfFlag(12)] public long saved_id; + /// Hash to prepay for a gift upgrade separately ». [IfFlag(14)] public string prepaid_upgrade_hash; + /// For separate upgrades, the identifier of the message with the gift whose upgrade was prepaid (valid for everyone, since all messages across all private chats with users share the same message ID sequence, and for channels the service message will already be sent to the channel, that will contain the service message with the original gift). [IfFlag(15)] public int gift_msg_id; [Flags] public enum Flags : uint @@ -2965,7 +2997,7 @@ namespace TL name_hidden = 0x1, /// Field has a value has_message = 0x2, - /// Whether this gift was added to the destination user's profile (may be toggled using Payments_SaveStarGift and fetched using Payments_GetUserStarGifts) + /// Whether this gift was added to the destination user's profile (may be toggled using Payments_SaveStarGift and fetched using Payments_GetSavedStarGifts) saved = 0x4, /// Whether this gift was converted to Telegram Stars and cannot be displayed on the profile anymore. converted = 0x8, @@ -2983,11 +3015,13 @@ namespace TL has_from_id = 0x800, /// Fields and have a value has_peer = 0x1000, + /// The sender has already pre-paid for the upgrade of this gift to a collectible gift. prepaid_upgrade = 0x2000, /// Field has a value has_prepaid_upgrade_hash = 0x4000, /// Field has a value has_gift_msg_id = 0x8000, + /// This service message is the notification of a separate pre-payment for the upgrade of a gift we own. upgrade_separate = 0x10000, } } @@ -2999,6 +3033,7 @@ namespace TL public Flags flags; /// The collectible gift. public StarGiftBase gift; + /// If set, indicates that the current gift can't be exported to the TON blockchain » yet: the owner will be able to export it at the specified unixtime. [IfFlag(3)] public DateTime can_export_at; /// If set, indicates that the gift can be transferred » to another user by paying the specified amount of stars. [IfFlag(4)] public long transfer_stars; @@ -3008,10 +3043,11 @@ namespace TL [IfFlag(7)] public Peer peer; /// For channel gifts, ID to use in s. [IfFlag(7)] public long saved_id; + /// Resale price of the gift. [IfFlag(8)] public StarsAmountBase resale_amount; /// If set, indicates that the current gift can't be transferred » yet: the owner will be able to transfer it at the specified unixtime. [IfFlag(9)] public DateTime can_transfer_at; - /// If set, indicates that the current gift can't be resold » yet: the owner will be able to put it up for sale at the specified unixtime. + /// If set, indicates that the current gift can't be resold » yet: the owner will be able to put it up for sale at the specified unixtime. [IfFlag(10)] public DateTime can_resell_at; [Flags] public enum Flags : uint @@ -3038,76 +3074,95 @@ namespace TL has_can_transfer_at = 0x200, /// Field has a value has_can_resell_at = 0x400, + /// The sender has pre-paid for the upgrade of this gift to a collectible gift. prepaid_upgrade = 0x800, } } - /// See + /// Sent from peer A to B, indicates that A refunded all stars B previously paid to send messages to A, see here » for more info on paid messages. See [TLDef(0xAC1F1FCD)] public sealed partial class MessageActionPaidMessagesRefunded : MessageAction { + /// Number of paid messages affected by the refund. public int count; + /// Number of refunded stars. public long stars; } - /// See + /// The price of paid messages » in this chat was changed. See [TLDef(0x84B88578)] public sealed partial class MessageActionPaidMessagesPrice : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The new price in Telegram Stars, can be 0 if messages are now free. public long stars; [Flags] public enum Flags : uint { + /// Can only be set for channels, if set indicates that direct messages were enabled », otherwise indicates that direct messages were disabled; the price of paid messages is related to the price of direct messages (aka those sent to the associated monoforum). broadcast_messages_allowed = 0x1, } } - /// See + /// Represents a conference call (or an invitation to a conference call, if neither the missed nor active flags are set). See [TLDef(0x2FFE2F7A)] public sealed partial class MessageActionConferenceCall : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Call ID. public long call_id; + /// Call duration, for left calls only. [IfFlag(2)] public int duration; + /// Identifiers of some other call participants. [IfFlag(3)] public Peer[] other_participants; [Flags] public enum Flags : uint { + /// Whether the conference call has ended and the user hasn't joined. missed = 0x1, + /// Whether the user is currently in the conference call. active = 0x2, /// Field has a value has_duration = 0x4, /// Field has a value has_other_participants = 0x8, + /// Whether this is a video conference call. video = 0x10, } } - /// See + /// Items were marked as completed or not completed in a todo list ». See [TLDef(0xCC7C5C89)] public sealed partial class MessageActionTodoCompletions : MessageAction { + /// Items marked as completed. public int[] completed; + /// Items marked as not completed. public int[] incompleted; } - /// See + /// Items were appended to the todo list ». See [TLDef(0xC7EDBC83)] public sealed partial class MessageActionTodoAppendTasks : MessageAction { + /// Appended items. public TodoItem[] list; } - /// See + /// A suggested post » was approved or rejected. See [TLDef(0xEE7A1596)] public sealed partial class MessageActionSuggestedPostApproval : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// If the suggested post was rejected, can optionally contain a rejection comment. [IfFlag(2)] public string reject_comment; + /// Scheduling date. [IfFlag(3)] public DateTime schedule_date; + /// Price for the suggested post. [IfFlag(4)] public StarsAmountBase price; [Flags] public enum Flags : uint { + /// Whether the suggested post was rejected. rejected = 0x1, + /// If set, the post was approved but the user's balance is too low to pay for the suggested post. balance_too_low = 0x2, /// Field has a value has_reject_comment = 0x4, @@ -3117,13 +3172,14 @@ namespace TL has_price = 0x10, } } - /// See + /// A suggested post » was successfully posted, and payment for it was successfully received. See [TLDef(0x95DDCF69)] public sealed partial class MessageActionSuggestedPostSuccess : MessageAction { + /// The price. public StarsAmountBase price; } - /// See + /// A suggested post » was accepted and posted or scheduled, but either the channel deleted the posted/scheduled post before stars_suggested_post_age_min seconds have elapsed, or the user refunded the payment for the stars used to pay for the suggested post. See [TLDef(0x69F916F8)] public sealed partial class MessageActionSuggestedPostRefund : MessageAction { @@ -3132,19 +3188,25 @@ namespace TL [Flags] public enum Flags : uint { + /// If set, the user refunded the payment for the stars used to pay for the suggested post. payer_initiated = 0x1, } } - /// See + /// You were gifted some toncoins. See [TLDef(0xA8A3C699)] public sealed partial class MessageActionGiftTon : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Name of a localized FIAT currency. public string currency; + /// FIAT currency equivalent (in the currency specified in currency) of the amount specified in crypto_amount. public long amount; + /// Name of the cryptocurrency. public string crypto_currency; + /// Amount in the smallest unit of the cryptocurrency (for TONs, one billionth of a ton, AKA a nanoton). public long crypto_amount; + /// Transaction ID. [IfFlag(0)] public string transaction_id; [Flags] public enum Flags : uint @@ -3268,7 +3330,7 @@ namespace TL public long id; /// Access hash public long access_hash; - /// file reference + /// file reference public byte[] file_reference; /// Date of upload public DateTime date; @@ -3432,13 +3494,17 @@ namespace TL /// Authorization info public Auth_AuthorizationBase authorization; } - /// See + /// Official apps may receive this constructor, indicating that due to the high cost of SMS verification codes for the user's country/provider, the user must purchase a Telegram Premium subscription in order to proceed with the login/signup. See [TLDef(0xD7A2FCF9)] public sealed partial class Auth_SentCodePaymentRequired : Auth_SentCodeBase { + /// Store identifier of the Telegram Premium subscription. public string store_product; + /// Phone code hash, to be stored and later re-used with Auth_SignIn public string phone_code_hash; + /// An email address that can be contacted for more information about this request. public string support_email_address; + /// The mandatory subject for the email. public string support_email_subject; } @@ -3450,7 +3516,7 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Iff setup_password_required is set and the user declines to set a 2-step verification password, they will be able to log into their account via SMS again only after this many days pass. + /// If and only if setup_password_required is set and the user declines to set a 2-step verification password, they will be able to log into their account via SMS again only after this many days pass. [IfFlag(1)] public int otherwise_relogin_days; /// Temporary passport sessions [IfFlag(0)] public int tmp_sessions; @@ -3631,15 +3697,19 @@ namespace TL [IfFlag(9)] public string request_chat_title; /// If set, this is a private chat with an administrator of a chat or channel to which the user sent a join request, and this field contains the timestamp when the join request » was sent. [IfFlag(9)] public DateTime request_chat_date; - /// Contains the ID of the business bot » managing this chat, used to display info about the bot in the action bar. + /// Contains the ID of the business bot » managing this chat, used to display info about the bot in the action bar. [IfFlag(13)] public long business_bot_id; /// Contains a deep link », used to open a management menu in the business bot. This flag is set if and only if business_bot_id is set. [IfFlag(13)] public string business_bot_manage_url; /// All users that must pay us » to send us private messages will have this flag set only for us, containing the amount of required stars, see here » for more info on paid messages. [IfFlag(14)] public long charge_paid_message_stars; + /// Used to display the user's registration year and month, the string is in MM.YYYY format, where MM is the registration month (1-12), and YYYY is the registration year. [IfFlag(15)] public string registration_month; + /// The country code of the user's phone number. [IfFlag(16)] public string phone_country; + /// When was the user's name last changed. [IfFlag(17)] public DateTime name_change_date; + /// When was the user's photo last changed. [IfFlag(18)] public DateTime photo_change_date; [Flags] public enum Flags : uint @@ -3666,9 +3736,9 @@ namespace TL has_request_chat_title = 0x200, /// This flag is set if request_chat_title and request_chat_date fields are set and the join request » is related to a channel (otherwise if only the request fields are set, the join request » is related to a chat). request_chat_broadcast = 0x400, - /// This flag is set if both business_bot_id and business_bot_manage_url are set and all connected business bots » were paused in this chat using Account_ToggleConnectedBotPaused. + /// This flag is set if both business_bot_id and business_bot_manage_url are set and all connected business bots » were paused in this chat using Account_ToggleConnectedBotPaused. business_bot_paused = 0x800, - /// This flag is set if both business_bot_id and business_bot_manage_url are set and connected business bots » can reply to messages in this chat, as specified by the settings during initial configuration. + /// This flag is set if both business_bot_id and business_bot_manage_url are set and connected business bots » can reply to messages in this chat, as specified by the settings during initial configuration. business_bot_can_reply = 0x1000, /// Fields and have a value has_business_bot_id = 0x2000, @@ -3813,6 +3883,7 @@ namespace TL [IfFlag(11)] public int folder_id; /// Time To Live of all messages in this chat; once a message is this many seconds old, it must be deleted. [IfFlag(14)] public int ttl_period; + /// The chat theme associated with this user ». [IfFlag(15)] public ChatThemeBase theme; /// Anonymized text to be shown instead of the user's name on forwarded messages [IfFlag(16)] public string private_forward_name; @@ -3844,14 +3915,21 @@ namespace TL [IfFlag(40)] public int stargifts_count; /// This bot has an active referral program » [IfFlag(43)] public StarRefProgram starref_program; + /// Describes a bot verification icon ». [IfFlag(44)] public BotVerification bot_verification; /// If set and bigger than 0, this user has enabled paid messages » and we must pay the specified amount of Stars to send messages to them, see here » for the full flow.
If set and equal to 0, the user requires payment in general but we were exempted from paying for any of the reasons specified in the docs ».
[IfFlag(46)] public long send_paid_messages_stars; + /// Disallows the reception of specific gift types. [IfFlag(47)] public DisallowedGiftsSettings disallowed_gifts; + /// The user's star rating. [IfFlag(49)] public StarsRating stars_rating; + /// Our pending star rating, only visible for ourselves. [IfFlag(50)] public StarsRating stars_my_pending_rating; + /// When the pending star rating will be applied, only visible for ourselves. [IfFlag(50)] public DateTime stars_my_pending_rating_date; + /// The main tab for the user's profile, see here » for more info. [IfFlag(52)] public ProfileTab main_tab; + /// The first song on the music tab of the profile, see here » for more info on the music profile tab. [IfFlag(53)] public DocumentBase saved_music; [Flags] public enum Flags : uint @@ -3944,6 +4022,7 @@ namespace TL has_send_paid_messages_stars = 0x4000, /// Field has a value has_disallowed_gifts = 0x8000, + /// If this flag is set for both us and another user (changed through ), a gift button should always be displayed in the text field in private chats with the other user: once clicked, the gift UI should be displayed, offering the user options to gift Telegram Premium » subscriptions or Telegram Gifts ». display_gifts_button = 0x10000, /// Field has a value has_stars_rating = 0x20000, @@ -4115,8 +4194,9 @@ namespace TL public int count; /// Rate to use in the offset_rate parameter in the next call to Messages_SearchGlobal [IfFlag(0)] public int next_rate; - /// Indicates the absolute position of messages[0] within the total result set with count count.
This is useful, for example, if the result was fetched using offset_id, and we need to display a progress/total counter (like photo 134 of 200, for all media in a chat, we could simply use photo ${offset_id_offset} of ${count}.
+ /// Indicates the absolute position of messages[0] within the total result set with count count.
This is useful, for example, if the result was fetched using offset_id, and we need to display a progress/total counter (like photo 134 of 200, for all media in a chat, we could simply use photo ${offset_id_offset} of ${count}).
[IfFlag(2)] public int offset_id_offset; + /// For global post searches », the remaining amount of free searches, here query_is_free is related to the current call only, not to the next paginated call, and all subsequent pagination calls will always be free. [IfFlag(3)] public SearchPostsFlood search_flood; [Flags] public enum Flags : uint @@ -4550,7 +4630,7 @@ namespace TL public override (long, int, int) GetMBox() => (0, pts, pts_count); } - /// Contents of messages in the common message box were read See + /// Contents of messages in the common message box were read (emitted specifically for messages like voice messages or video, only once the media is watched and marked as read using Messages_ReadMessageContents). See [TLDef(0xF8227181)] public sealed partial class UpdateReadMessagesContents : Update { @@ -4847,6 +4927,7 @@ namespace TL public Peer peer; /// ID of the forum topic to which the draft is associated [IfFlag(0)] public int top_msg_id; + /// If set, the draft is related to the specified monoforum topic ID ». [IfFlag(1)] public Peer saved_peer_id; /// The draft public DraftMessageBase draft; @@ -5002,7 +5083,7 @@ namespace TL /// The list of favorited stickers was changed, the client should call Messages_GetFavedStickers to refetch the new list See [TLDef(0xE511996D)] public sealed partial class UpdateFavedStickers : Update { } - /// The specified channel/supergroup messages were read See + /// The specified channel/supergroup messages were read (emitted specifically for messages like voice messages or video, only once the media is watched and marked as read using Channels_ReadMessageContents) See [TLDef(0x25F324F7)] public sealed partial class UpdateChannelReadMessagesContents : Update { @@ -5012,6 +5093,7 @@ namespace TL public long channel_id; /// Forum topic ID. [IfFlag(0)] public int top_msg_id; + /// If set, the messages were read within the specified monoforum topic ». [IfFlag(1)] public Peer saved_peer_id; /// IDs of messages that were read public int[] messages; @@ -5042,6 +5124,7 @@ namespace TL public Flags flags; /// The dialog public DialogPeerBase peer; + /// If set, the mark is related to the specified monoforum topic ID ». [IfFlag(1)] public Peer saved_peer_id; [Flags] public enum Flags : uint @@ -5541,6 +5624,7 @@ namespace TL public int msg_id; /// Forum topic ID [IfFlag(0)] public int top_msg_id; + /// If set, the reactions are in the specified monoforum topic ». [IfFlag(1)] public Peer saved_peer_id; /// Reactions public MessageReactions reactions; @@ -5881,7 +5965,7 @@ namespace TL /// IDs of the deleted messages. public int[] messages; } - /// Connecting or disconnecting a business bot or changing the connection settings will emit an update to the bot, with the new settings and a connection_id that will be used by the bot to handle updates from and send messages as the user. See + /// Connecting or disconnecting a business bot or changing the connection settings will emit an update to the bot, with the new settings and a connection_id that will be used by the bot to handle updates from and send messages as the user. See [TLDef(0x8AE5C97A)] public sealed partial class UpdateBotBusinessConnect : Update { @@ -5892,7 +5976,7 @@ namespace TL public override (long, int, int) GetMBox() => (-1, qts, 1); } - /// A message was received via a connected business chat ». See + /// A message was received via a connected business chat ». See [TLDef(0x9DDB347C)] public sealed partial class UpdateBotNewBusinessMessage : Update { @@ -5915,7 +5999,7 @@ namespace TL public override (long, int, int) GetMBox() => (-1, qts, 1); } - /// A message was edited in a connected business chat ». See + /// A message was edited in a connected business chat ». See [TLDef(0x07DF587C)] public sealed partial class UpdateBotEditBusinessMessage : Update { @@ -5938,7 +6022,7 @@ namespace TL public override (long, int, int) GetMBox() => (-1, qts, 1); } - /// A message was deleted in a connected business chat ». See + /// A message was deleted in a connected business chat ». See [TLDef(0xA02A982E)] public sealed partial class UpdateBotDeleteBusinessMessage : Update { @@ -5971,7 +6055,7 @@ namespace TL /// New balance. public StarsAmountBase balance; } - /// A callback button sent via a business connection was pressed, and the button data was sent to the bot that created the button. See + /// A callback button sent via a business connection was pressed, and the button data was sent to the bot that created the button. See [TLDef(0x1EA2FDA7)] public sealed partial class UpdateBusinessBotCallbackQuery : Update { @@ -5981,7 +6065,7 @@ namespace TL public long query_id; /// ID of the user that pressed the button public long user_id; - /// Business connection ID + /// Business connection ID public string connection_id; /// Message that contains the keyboard (also contains info about the chat where the message was sent). public MessageBase message; @@ -6026,51 +6110,65 @@ namespace TL [TLDef(0x8B725FCE)] public sealed partial class UpdatePaidReactionPrivacy : Update { - /// Whether paid reaction privacy is enabled or disabled. + /// Paid reaction privacy settings. public PaidReactionPrivacy private_; } - /// See + /// A paid login SMS code was successfully sent. See [TLDef(0x504AA18F)] public sealed partial class UpdateSentPhoneCode : Update { + /// Info about the sent code. public Auth_SentCodeBase sent_code; } - /// See + /// Contains updates to the blockchain of a conference call, see here » for more info. See [TLDef(0xA477288F)] public sealed partial class UpdateGroupCallChainBlocks : Update { + /// The conference call. public InputGroupCallBase call; + /// Subchain ID. public int sub_chain_id; + /// Blocks. public byte[][] blocks; + /// Offset of the next block. public int next_offset; } - /// See + /// Incoming messages in a monoforum topic were read See [TLDef(0x77B0E372)] public sealed partial class UpdateReadMonoForumInbox : Update { + /// ID of the monoforum. public long channel_id; + /// Topic ID. public Peer saved_peer_id; + /// Position up to which all incoming messages are read. public int read_max_id; } - /// See + /// Outgoing messages in a monoforum were read. See [TLDef(0xA4A79376)] public sealed partial class UpdateReadMonoForumOutbox : Update { + /// ID of the monoforum. public long channel_id; + /// Topic ID. public Peer saved_peer_id; + /// Position up to which all outgoing messages are read. public int read_max_id; } - /// See + /// An admin has (un)exempted this monoforum topic » from payment to send messages using Account_ToggleNoPaidMessagesException. See [TLDef(0x9F812B08)] public sealed partial class UpdateMonoForumNoPaidException : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The monoforum ID. public long channel_id; + /// The peer/topic ID. public Peer saved_peer_id; [Flags] public enum Flags : uint { + /// If set, an admin has exempted this peer, otherwise the peer was unexempted. exception = 0x1, } } @@ -6993,7 +7091,7 @@ namespace TL public long id; /// REQUIRED FIELD. See how to obtain it
access_hash parameter from the
public long access_hash; - ///
File reference + /// File reference public byte[] file_reference; } @@ -7016,7 +7114,7 @@ namespace TL public long id; /// Check sum, dependent on document ID public long access_hash; - /// File reference + /// File reference public byte[] file_reference; /// Creation date public DateTime date; @@ -7080,7 +7178,7 @@ namespace TL public int top_msg_id; } - /// User actions. Use this to provide users with detailed info about their chat partner's actions: typing or sending attachments of all kinds. See Derived classes: , , , , , , , , , , , , , , , , , + /// User actions. Use this to provide users with detailed info about their chat partner's actions: typing or sending attachments of all kinds. See Derived classes: , , , , , , , , , , , , , , , , , public abstract partial class SendMessageAction : IObject { } /// User is typing. See [TLDef(0x16BF744E)] @@ -7620,7 +7718,7 @@ namespace TL public string display_url; /// Hash used for caching, for more info click here public int hash; - /// Type of the web page. One of the following:

- video
- gif
- photo
- document
- profile
- telegram_background
- telegram_theme
- telegram_story
- telegram_channel
- telegram_channel_request
- telegram_megagroup
- telegram_chat
- telegram_megagroup_request
- telegram_chat_request
- telegram_album
- telegram_message
- telegram_bot
- telegram_voicechat
- telegram_livestream
- telegram_call
- telegram_user
- telegram_botapp
- telegram_channel_boost
- telegram_group_boost
- telegram_giftcode
- telegram_stickerset
- telegram_story_album
- telegram_collection

+ /// Type of the web page. One of the following:

- app
- article
- document
- gif
- photo
- profile
- telegram_album
- telegram_background
- telegram_bot
- telegram_botapp
- telegram_call
- telegram_channel
- telegram_channel_boost
- telegram_channel_direct
- telegram_channel_request
- telegram_chat
- telegram_chat_request
- telegram_chatlist
- telegram_collection
- telegram_community
- telegram_giftcode
- telegram_group_boost
- telegram_livestream
- telegram_megagroup
- telegram_megagroup_request
- telegram_message
- telegram_nft
- telegram_stickerset
- telegram_story
- telegram_story_album
- telegram_theme
- telegram_user
- telegram_videochat
- telegram_voicechat
- video

[IfFlag(0)] public string type; /// Short name of the site (e.g., Google Docs, App Store) [IfFlag(1)] public string site_name; @@ -7677,6 +7775,7 @@ namespace TL has_attributes = 0x1000, /// Whether the size of the media in the preview can be changed. has_large_media = 0x2000, + /// Represents a custom video cover. video_cover_photo = 0x4000, } @@ -7963,6 +8062,7 @@ namespace TL [IfFlag(10)] public StarsSubscriptionPricing subscription_pricing; /// For Telegram Star subscriptions », the ID of the payment form for the subscription. [IfFlag(12)] public long subscription_form_id; + /// Describes a bot verification icon ». [IfFlag(13)] public BotVerification bot_verification; [Flags] public enum Flags : uint @@ -8007,7 +8107,7 @@ namespace TL public DateTime expires; } - /// Represents a stickerset See Derived classes: , , , , , , , , , , + /// Represents a stickerset See Derived classes: , , , , , , , , , , /// a value means inputStickerSetEmpty public abstract partial class InputStickerSet : IObject { } /// Stickerset by ID See @@ -8054,7 +8154,7 @@ namespace TL /// Default custom emoji status stickerset for channel statuses See [TLDef(0x49748553)] public sealed partial class InputStickerSetEmojiChannelDefaultStatuses : InputStickerSet { } - /// See + /// TON gifts stickerset. See [TLDef(0x1CF671A0)] public sealed partial class InputStickerSetTonGifts : InputStickerSet { } @@ -8159,6 +8259,7 @@ namespace TL [IfFlag(7)] public string privacy_policy_url; /// Mini app » settings
[IfFlag(8)] public BotAppSettings app_settings; + /// This bot can verify peers: this field contains more info about the verification the bot can assign to peers. [IfFlag(9)] public BotVerifierSettings verifier_settings; [Flags] public enum Flags : uint @@ -8491,7 +8592,7 @@ namespace TL public KeyboardButtonRow[] rows; } - /// Message entities, representing styled text in a message See Derived classes: , , , , , , , , , , , , , , , , , , , , + /// Message entities, representing styled text in a message See Derived classes: , , , , , , , , , , , , , , , , , , , , public abstract partial class MessageEntity : IObject { /// Offset of message entity within message (in UTF-16 code units) @@ -10095,6 +10196,7 @@ namespace TL public DateTime date; /// A message effect that should be played as specified here ». [IfFlag(7)] public long effect; + /// Used to suggest a post to a channel, see here » for more info on the full flow. [IfFlag(8)] public SuggestedPost suggested_post; [Flags] public enum Flags : uint @@ -10791,10 +10893,11 @@ namespace TL /// The phone call was discarded because the user is busy in another call See [TLDef(0xFAF7E8C9)] public sealed partial class PhoneCallDiscardReasonBusy : PhoneCallDiscardReason { } - /// See + /// This phone call was migrated to a conference call. See [TLDef(0x9FBBF1F7)] public sealed partial class PhoneCallDiscardReasonMigrateConferenceCall : PhoneCallDiscardReason { + /// Conference link » slug. public string slug; } @@ -11664,6 +11767,7 @@ namespace TL video = 0x40, /// Field has a value has_custom_parameters = 0x80, + /// If set, the other party supports upgrading of the call to a conference call. conference_supported = 0x100, } @@ -12372,10 +12476,11 @@ namespace TL /// The subscriber that extended the subscription. public ChannelParticipantBase new_participant; } - /// See + /// Channel autotranslation was toggled ». See [TLDef(0xC517F77E)] public sealed partial class ChannelAdminLogEventActionToggleAutotranslation : ChannelAdminLogEventAction { + /// New value of the toggle public bool new_value; } @@ -13501,7 +13606,7 @@ namespace TL public Flags flags; /// The question of the poll (only Premium users can use custom emoji entities here). public TextWithEntities question; - /// The possible answers, vote using Messages_SendVote. + /// The possible answers (2-poll_answers_max), vote using Messages_SendVote. public PollAnswer[] answers; /// Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date. [IfFlag(4)] public int close_period; @@ -13632,6 +13737,7 @@ namespace TL edit_stories = 0x8000, /// If set, allows the admin to delete stories posted by the other admins of the channel. delete_stories = 0x10000, + /// If set, allows the admin to manage the direct messages monoforum » and decline suggested posts ». manage_direct_messages = 0x20000, } } @@ -14245,7 +14351,7 @@ namespace TL } } - /// Webpage attributes See Derived classes: , , , + /// Webpage attributes See Derived classes: , , , , public abstract partial class WebPageAttribute : IObject { } /// Page theme See [TLDef(0x54B56617)] @@ -14302,16 +14408,18 @@ namespace TL text_color = 0x2, } } - /// See + /// Contains info about collectible gift » for a preview of a collectible gift » (the will have a type of telegram_nft). See [TLDef(0xCF6F6DB8)] public sealed partial class WebPageAttributeUniqueStarGift : WebPageAttribute { + /// The . public StarGiftBase gift; } - /// See + /// Contains info about a gift collection » for a preview of a gift collection » (the will have a type of telegram_collection). See [TLDef(0x31CAD303)] public sealed partial class WebPageAttributeStarGiftCollection : WebPageAttribute { + /// Gifts in the collection. public DocumentBase[] icons; } @@ -14421,6 +14529,7 @@ namespace TL has_emoticon = 0x2000000, /// Field has a value has_color = 0x8000000, + /// If set, any animated emojis present in title should not be animated and should be instead frozen on the first frame. title_noanimate = 0x10000000, } @@ -14464,6 +14573,7 @@ namespace TL has_my_invites = 0x4000000, /// Field has a value has_color = 0x8000000, + /// If set, any animated emojis present in title should not be animated and should be instead frozen on the first frame. title_noanimate = 0x10000000, } @@ -14614,22 +14724,25 @@ namespace TL /// Re-fetch PSA/MTProxy info after the specified number of seconds public DateTime expires; } - /// MTProxy/Public Service Announcement information See + /// A set of useful suggestions and a PSA/MTProxy sponsored peer, see here » for more info. See [TLDef(0x08A4D87A)] public sealed partial class Help_PromoData : Help_PromoDataBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Expiry of PSA/MTProxy info + /// Unixtime when to re-invoke Help_GetPromoData. public DateTime expires; /// MTProxy/PSA peer [IfFlag(3)] public Peer peer; - /// PSA type + /// For Public Service Announcement peers, indicates the type of the PSA. [IfFlag(1)] public string psa_type; - /// PSA message + /// For Public Service Announcement peers, contains the PSA itself. [IfFlag(2)] public string psa_message; + /// Contains a list of pending suggestions ». public string[] pending_suggestions; + /// Contains a list of inverted suggestions ». public string[] dismissed_suggestions; + /// Contains a list of custom pending suggestions ». [IfFlag(4)] public PendingSuggestion custom_pending_suggestion; /// Chat info public Dictionary chats; @@ -14638,7 +14751,7 @@ namespace TL [Flags] public enum Flags : uint { - /// MTProxy-related channel + /// Set when connecting using an MTProxy that has configured an associated peer (that will be passed in peer, i.e. the channel that sponsored the MTProxy) that should be pinned on top of the chat list. proxy = 0x1, /// Field has a value has_psa_type = 0x2, @@ -14783,6 +14896,7 @@ namespace TL 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; + /// Disallows the reception of specific gift types. [IfFlag(6)] public DisallowedGiftsSettings disallowed_gifts; [Flags] public enum Flags : uint @@ -14801,6 +14915,7 @@ namespace TL has_noncontact_peers_paid_stars = 0x20, /// Field has a value has_disallowed_gifts = 0x40, + /// Enables or disables our .display_gifts_button flag: if the .display_gifts_button flag of both us and another user is set, a gift button should always be displayed in the text field in private chats with the other user: once clicked, the gift UI should be displayed, offering the user options to gift Telegram Premium » subscriptions or Telegram Gifts ». display_gifts_button = 0x80, } } @@ -14958,6 +15073,7 @@ namespace TL [IfFlag(7)] public MessageEntity[] quote_entities; /// Offset of the message quote_text within the original message (in UTF-16 code units). [IfFlag(10)] public int quote_offset; + /// Can be set to reply to the specified item of a todo list ». [IfFlag(11)] public int todo_item_id; [Flags] public enum Flags : uint @@ -14998,7 +15114,7 @@ namespace TL public int story_id; } - /// Info about the comment section of a channel post, or a simple message thread See + /// Info about the comment section of a channel post, a simple message thread, a forum topic, or a direct messages topic (all features ultimately based on message threads). See [TLDef(0x83D60FC2)] public sealed partial class MessageReplies : IObject { @@ -15100,6 +15216,7 @@ namespace TL public int unmuted_video_limit; /// Version public int version; + /// Invitation link for the conference. [IfFlag(16)] public string invite_link; [Flags] public enum Flags : uint @@ -15130,7 +15247,9 @@ namespace TL rtmp_stream = 0x1000, /// Whether the listeners list is hidden and cannot be fetched using Phone_GetGroupParticipants. The phone.groupParticipants.count and groupCall.participants_count counters will still include listeners. listeners_hidden = 0x2000, + /// Whether this is an E2E conference call. conference = 0x4000, + /// Whether we're created this group call. creator = 0x8000, /// Field has a value has_invite_link = 0x10000, @@ -15153,16 +15272,18 @@ namespace TL /// REQUIRED FIELD. See how to obtain it
Group call access hash
public long access_hash; } - ///
See + /// Join a conference call through an invitation link ». See [TLDef(0xFE06823F)] public sealed partial class InputGroupCallSlug : InputGroupCallBase { + /// Slug from the conference link ». public string slug; } - /// See + /// Join a group call through a invitation message. See [TLDef(0x8C10603F)] public sealed partial class InputGroupCallInviteMessage : InputGroupCallBase { + /// ID of the . public int msg_id; } @@ -15552,36 +15673,46 @@ namespace TL [TLDef(0xE926D63E)] public sealed partial class Account_ResetPasswordOk : Account_ResetPasswordResult { } - /// See + /// A chat theme See Derived classes: , public abstract partial class ChatThemeBase : IObject { } - /// See + /// A chat theme See [TLDef(0xC3DFFC04)] public sealed partial class ChatTheme : ChatThemeBase { + /// The emoji identifying the chat theme. public string emoticon; } - /// See + /// A chat theme based on a collectible gift ». See [TLDef(0x3458F9C8)] public sealed partial class ChatThemeUniqueGift : ChatThemeBase { + /// The owned collectible gift on which this theme is based, as a . public StarGiftBase gift; + /// Theme settings. public ThemeSettings[] theme_settings; } - /// See + /// Available chat themes See /// a value means account.chatThemesNotModified [TLDef(0x16484857)] public sealed partial class Account_ChatThemes : IObject, IPeerResolver { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Hash to pass to the method that returned this constructor, to avoid refetching the result if it hasn't changed. public long hash; + /// Themes. public ChatThemeBase[] themes; + /// Chats mentioned in the themes field. public Dictionary chats; + /// Users mentioned in the themes field. public Dictionary users; + /// Next offset for pagination. [IfFlag(0)] public int next_offset; [Flags] public enum Flags : uint { + /// Field has a value has_next_offset = 0x1, } /// returns a or for the given Peer @@ -15616,7 +15747,9 @@ namespace TL [IfFlag(7)] public string sponsor_info; /// If set, contains additional information about the sponsored message to be shown along with the message. [IfFlag(8)] public string additional_info; + /// For sponsored messages to show on channel videos », allow the user to hide the ad only after the specified amount of seconds. [IfFlag(15)] public int min_display_duration; + /// For sponsored messages to show on channel videos », autohide the ad after after the specified amount of seconds. [IfFlag(15)] public int max_display_duration; [Flags] public enum Flags : uint @@ -15651,7 +15784,9 @@ namespace TL public Flags flags; /// If set, specifies the minimum number of messages between shown sponsored messages; otherwise, only one sponsored message must be shown after all ordinary messages. [IfFlag(0)] public int posts_between; + /// For sponsored messages to show on channel videos », the number of seconds to wait before showing the first ad. [IfFlag(1)] public int start_delay; + /// For sponsored messages to show on channel videos », the number of seconds to wait after the previous ad is hidden, before showing the next ad. [IfFlag(2)] public int between_delay; /// Sponsored messages public SponsoredMessage[] messages; @@ -16179,7 +16314,7 @@ namespace TL Broadcast = 0x7BFBDEFC, } - /// An invoice See Derived classes: , , , , , , , , , , + /// An invoice See Derived classes: , , , , , , , , , , , public abstract partial class InputInvoice : IObject { } /// An invoice contained in a message or paid media ». See [TLDef(0xC5B56859)] @@ -16226,6 +16361,7 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Receiver of the gift. public InputPeer peer; /// Identifier of the gift, from .id public long gift_id; @@ -16238,37 +16374,45 @@ namespace TL hide_name = 0x1, /// Field has a value has_message = 0x2, + /// Also pay for an eventual upgrade of the gift to a collectible gift ». include_upgrade = 0x4, } } - /// See + /// Used to pay to upgrade a Gift to a collectible gift, see the collectible gifts » documentation for more info on the full flow. See [TLDef(0x4D818D5D)] public sealed partial class InputInvoiceStarGiftUpgrade : InputInvoice { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The identifier of the received gift to upgrade. public InputSavedStarGift stargift; [Flags] public enum Flags : uint { + /// Set this flag to keep the original gift text, sender and receiver in the upgraded gift as a attribute. keep_original_details = 0x1, } } - /// See + /// Used to pay to transfer a collectible gift to another peer, see the gifts » documentation for more info. See [TLDef(0x4A5F5BD9)] public sealed partial class InputInvoiceStarGiftTransfer : InputInvoice { + /// The identifier of the received gift public InputSavedStarGift stargift; + /// The destination peer public InputPeer to_id; } - /// See + /// Used to gift a Telegram Premium subscription to another user, paying with Telegram Stars. See [TLDef(0xDABAB2EF)] public sealed partial class InputInvoicePremiumGiftStars : InputInvoice { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Who will receive the gifted subscription. public InputUserBase user_id; + /// Duration of the subscription in months, must be one of the options with currency == "XTR" returned by Payments_GetPremiumGiftCodeOptions. public int months; + /// Message attached with the gift. [IfFlag(0)] public TextWithEntities message; [Flags] public enum Flags : uint @@ -16277,31 +16421,39 @@ namespace TL has_message = 0x1, } } - /// See + /// Transfer stars from the balance of a user account connected to a business bot, to the balance of the business bot, see here » for more info on the full flow. See [TLDef(0xF4997E42)] public sealed partial class InputInvoiceBusinessBotTransferStars : InputInvoice { + /// Always . public InputUserBase bot; + /// The number of stars to transfer. public long stars; } - /// See + /// Used to buy a collectible gift currently up on resale, see here for more info on the full flow. See [TLDef(0xC39F5324)] public sealed partial class InputInvoiceStarGiftResale : InputInvoice { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Slug of the gift to buy. public string slug; + /// The receiver of the gift. public InputPeer to_id; [Flags] public enum Flags : uint { + /// Buy the gift using TON. ton = 0x1, } } - /// See + /// Separately prepay for the upgrade of a gift ». See [TLDef(0x9A0B48B8)] public sealed partial class InputInvoiceStarGiftPrepaidUpgrade : InputInvoice { + /// The peer that owns the gift. public InputPeer peer; + /// The upgrade hash from .prepaid_upgrade_hash or .prepaid_upgrade_hash. public string hash; } @@ -16449,6 +16601,7 @@ namespace TL [TLDef(0xF9A2A6CB)] public sealed partial class InputStorePaymentStarsTopup : InputStorePaymentPurpose { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Amount of stars to topup public long stars; @@ -16456,6 +16609,7 @@ namespace TL public string currency; /// Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). public long amount; + /// Should be populated with the peer where the topup process was initiated due to low funds (i.e. a bot for bot payments, a channel for paid media/reactions, etc); leave this flag unpopulated if the topup flow was not initated when attempting to spend more Stars than currently available on the account's balance. [IfFlag(0)] public InputPeer spend_purpose_peer; [Flags] public enum Flags : uint @@ -16518,19 +16672,24 @@ namespace TL has_prize_description = 0x10, } } - /// See + /// Indicates payment for a login code. See [TLDef(0x9BB2636D)] public sealed partial class InputStorePaymentAuthCode : InputStorePaymentPurpose { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Phone number. public string phone_number; + /// phone_code_hash returned by Auth_SendCode. public string phone_code_hash; + /// Three-letter ISO 4217 currency code public string currency; + /// Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). public long amount; [Flags] public enum Flags : uint { + /// Set this flag to restore a previously made purchase. restore = 0x1, } } @@ -16549,6 +16708,7 @@ namespace TL /// a value means emojiStatusEmpty public abstract partial class EmojiStatusBase : IObject { + /// If set, the emoji status will be active until the specified unixtime. public virtual DateTime Until => default; } /// An emoji status See @@ -16559,6 +16719,7 @@ namespace TL public Flags flags; /// Custom emoji document ID public long document_id; + /// If set, the emoji status will be active until the specified unixtime. [IfFlag(0)] public DateTime until; [Flags] public enum Flags : uint @@ -16567,23 +16728,34 @@ namespace TL has_until = 0x1, } + /// If set, the emoji status will be active until the specified unixtime. public override DateTime Until => until; } - /// See + /// An owned collectible gift » as emoji status. See [TLDef(0x7184603B)] public sealed partial class EmojiStatusCollectible : EmojiStatusBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// ID of the collectible (from .id). public long collectible_id; + /// ID of the custom emoji representing the status. public long document_id; + /// Name of the collectible. public string title; + /// Unique identifier of the collectible that may be used to create a collectible gift link » for the current collectible, or to fetch further info about the collectible using Payments_GetUniqueStarGift. public string slug; + /// The ID of a pattern to apply on the profile's backdrop, correlated to the from the gift in slug. public long pattern_document_id; + /// Color of the center of the profile backdrop in RGB24 format, from the gift's . public int center_color; + /// Color of the edges of the profile backdrop in RGB24 format, from the gift's . public int edge_color; + /// Color of the pattern_document_id applied on the profile backdrop in RGB24 format, from the gift's . public int pattern_color; + /// Color of text on the profile backdrop in RGB24 format, from the gift's . public int text_color; + /// If set, the emoji status will be active until the specified unixtime. [IfFlag(0)] public DateTime until; [Flags] public enum Flags : uint @@ -16592,15 +16764,18 @@ namespace TL has_until = 0x1, } + /// If set, the emoji status will be active until the specified unixtime. public override DateTime Until => until; } - /// See + /// An owned collectible gift » as emoji status: can only be used in Account_UpdateEmojiStatus, is never returned by the API. See [TLDef(0x07141DBF)] public sealed partial class InputEmojiStatusCollectible : EmojiStatusBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// ID of the collectible (from .id). public long collectible_id; + /// If set, the emoji status will be active until the specified unixtime. [IfFlag(0)] public DateTime until; [Flags] public enum Flags : uint @@ -16609,6 +16784,7 @@ namespace TL has_until = 0x1, } + /// If set, the emoji status will be active until the specified unixtime. public override DateTime Until => until; } @@ -16673,7 +16849,7 @@ namespace TL [TLDef(0xEAFDF716)] public sealed partial class Messages_Reactions : IObject { - /// Hash used for caching, for more info click here + /// Hash used for caching, can also be locally regenerated using the algorithm specified here ». public long hash; /// Reactions public Reaction[] reactions; @@ -17386,6 +17562,7 @@ namespace TL { /// Field has a value has_emoticon = 0x1, + /// If set, any animated emojis present in title should not be animated and should be instead frozen on the first frame. title_noanimate = 0x2, } @@ -17578,6 +17755,7 @@ namespace TL [IfFlag(3)] public StoryViews views; /// The reaction we sent. [IfFlag(15)] public Reaction sent_reaction; + /// Albums this story is part of. [IfFlag(19)] public int[] albums; [Flags] public enum Flags : uint @@ -17819,7 +17997,9 @@ namespace TL [IfFlag(3)] public MessageEntity[] quote_entities; /// Offset of the message quote_text within the original message (in UTF-16 code units). [IfFlag(4)] public int quote_offset; + /// Must be set to the ID of the topic when replying to a message within a monoforum topic. [IfFlag(5)] public InputPeer monoforum_peer_id; + /// Can be set to reply to the specified item of a todo list ». [IfFlag(6)] public int todo_item_id; [Flags] public enum Flags : uint @@ -17849,10 +18029,11 @@ namespace TL /// ID of the story to reply to. public int story_id; } - /// See + /// Used to send messages to a monoforum topic. See [TLDef(0x69D66C45)] public sealed partial class InputReplyToMonoForum : InputReplyTo { + /// The topic ID. public InputPeer monoforum_peer_id; } @@ -17884,7 +18065,7 @@ namespace TL } } - /// Coordinates and size of a clicable rectangular area on top of a story. See + /// Coordinates and size of a clickable rectangular area on top of a story. See [TLDef(0xCFC9E002)] public sealed partial class MediaAreaCoordinates : IObject { @@ -18024,11 +18205,13 @@ namespace TL /// ARGB background color. public int color; } - /// See + /// Represents a collectible gift ». See [TLDef(0x5787686D)] public sealed partial class MediaAreaStarGift : MediaArea { + /// Coordinates of the media area. public MediaAreaCoordinates coordinates; + /// slug from .slug, that can be resolved as specified here ». public string slug; } @@ -18696,29 +18879,40 @@ namespace TL /// The latest message ID public override int TopMessage => top_message; } - /// See + /// Represents a monoforum topic ». See [TLDef(0x64407EA7)] public sealed partial class MonoForumDialog : SavedDialogBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The peer associated to the topic, AKA the topic ID. public Peer peer; + /// The latest message ID public int top_message; + /// Position up to which all incoming messages are read. public int read_inbox_max_id; + /// Position up to which all outgoing messages are read. public int read_outbox_max_id; + /// Number of unread messages. public int unread_count; + /// Number of unread reactions. public int unread_reactions_count; + /// A pending message draft. [IfFlag(1)] public DraftMessageBase draft; [Flags] public enum Flags : uint { /// Field has a value has_draft = 0x2, + /// Whether this topic has a manually set (with Messages_MarkDialogUnread) unread mark. unread_mark = 0x8, + /// If set, an admin has exempted this peer from payment to send messages using Account_ToggleNoPaidMessagesException. nopaid_messages_exception = 0x10, } + /// The peer associated to the topic, AKA the topic ID. public override Peer Peer => peer; + /// The latest message ID public override int TopMessage => top_message; } @@ -18800,7 +18994,7 @@ namespace TL { /// Saved reaction tags. public SavedReactionTag[] tags; - /// Hash used for caching, for more info click here + /// Hash used for caching, for more info click here. Can also be manually regenerated, if needed, using the custom algorithm specified here ». public long hash; } @@ -19117,7 +19311,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// Contains info about a connected business bot ». See + /// Contains info about a connected business bot ». See [TLDef(0xCD64636C)] public sealed partial class ConnectedBot : IObject { @@ -19125,8 +19319,9 @@ namespace TL public Flags flags; /// ID of the connected bot public long bot_id; - /// Specifies the private chats that a connected business bot » may receive messages and interact with.
+ /// Specifies the private chats that a connected business bot » may receive messages and interact with.
public BusinessBotRecipients recipients; + /// Business bot rights. public BusinessBotRights rights; [Flags] public enum Flags : uint @@ -19134,7 +19329,7 @@ namespace TL } } - /// Info about currently connected business bots. See + /// Info about currently connected business bots. See [TLDef(0x17D7F87B)] public sealed partial class Account_ConnectedBots : IObject { @@ -19180,20 +19375,21 @@ namespace TL } } - /// Contains info about a bot business connection. See + /// Contains info about a bot business connection. See [TLDef(0x8F34B2F5)] public sealed partial class BotBusinessConnection : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Business connection ID, used to identify messages coming from the connection and to reply to them as specified here ». + /// Business connection ID, used to identify messages coming from the connection and to reply to them as specified here ». public string connection_id; /// ID of the user that the bot is connected to via this connection. public long user_id; - /// ID of the datacenter where to send queries wrapped in a InvokeWithBusinessConnection as specified here ». + /// ID of the datacenter where to send queries wrapped in a InvokeWithBusinessConnection as specified here ». public int dc_id; /// When was the connection created. public DateTime date; + /// Business bot rights. [IfFlag(2)] public BusinessBotRights rights; [Flags] public enum Flags : uint @@ -19290,7 +19486,7 @@ namespace TL public string url; } - /// Specifies the private chats that a connected business bot » may interact with. See + /// Specifies the private chats that a connected business bot » may interact with. See [TLDef(0xC4E5921E)] public sealed partial class InputBusinessBotRecipients : IObject { @@ -19320,7 +19516,7 @@ namespace TL } } - /// Specifies the private chats that a connected business bot » may receive messages and interact with. See + /// Specifies the private chats that a connected business bot » may receive messages and interact with. See [TLDef(0xB88CF373)] public sealed partial class BusinessBotRecipients : IObject { @@ -19741,7 +19937,7 @@ namespace TL } } - /// Represents a Telegram Stars transaction ». See + /// Represents a Telegram Stars or TON transaction ». See [TLDef(0x13659EB0)] public sealed partial class StarsTransaction : IObject { @@ -19749,6 +19945,7 @@ namespace TL public Flags flags; /// Transaction ID. public string id; + /// Amount of Telegram Stars or TON. public StarsAmountBase amount; /// Date of the transaction (unixtime). public DateTime date; @@ -19784,9 +19981,13 @@ namespace TL [IfFlag(17)] public Peer starref_peer; /// For transactions made by referred users, the amount of Telegram Stars received by the affiliate, can be negative for refunds. [IfFlag(17)] public StarsAmountBase starref_amount; + /// This transaction is related to the reception or transmission of a paid message ». [IfFlag(19)] public int paid_messages; + /// This transaction indicates the payment for a gifted Telegram Premium subscription ». [IfFlag(20)] public int premium_gift_months; + /// Indicates that this is payment for ad revenue from the specified unixtime (always set together with ads_proceeds_to_date). [IfFlag(23)] public DateTime ads_proceeds_from_date; + /// Indicates that this is payment for ad revenue to the specified unixtime. [IfFlag(23)] public DateTime ads_proceeds_to_date; [Flags] public enum Flags : uint @@ -19827,16 +20028,21 @@ namespace TL has_starref_commission_permille = 0x10000, /// Fields and have a value has_starref_peer = 0x20000, + /// This transaction pays for the upgrade of a gift to a collectible gift ». stargift_upgrade = 0x40000, /// Field has a value has_paid_messages = 0x80000, /// Field has a value has_premium_gift_months = 0x100000, + /// This transaction transfers stars from the balance of a user account connected to a business bot, to the balance of the business bot, see here » for more info. business_transfer = 0x200000, + /// This transaction is related to the resale of a collectible gift ». stargift_resale = 0x400000, /// Fields and have a value has_ads_proceeds_from_date = 0x800000, + /// Represents payment for a paid global post search ». posts_search = 0x1000000, + /// Represents payment for a separate prepaid upgrade of a gift. stargift_prepaid_upgrade = 0x2000000, } } @@ -19960,7 +20166,7 @@ namespace TL [Flags] public enum Flags : uint { - /// If set, the user may withdraw up to available_balance stars. + /// If set, the user may withdraw up to available_balance stars. withdrawal_enabled = 0x1, /// Field has a value has_next_withdrawal_at = 0x2, @@ -19973,6 +20179,7 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// For ad revenue statistics, ad impressions graph [IfFlag(0)] public StatsGraphBase top_hours_graph; /// Star revenue graph (number of earned stars) public StatsGraphBase revenue_graph; @@ -19988,11 +20195,11 @@ namespace TL } } - /// Contains the URL to use to withdraw Telegram Star revenue. See + /// Contains the URL to use to withdraw Telegram Star revenue. See [TLDef(0x1DAB80B7)] public sealed partial class Payments_StarsRevenueWithdrawalUrl : IObject { - /// Contains the URL to use to withdraw Telegram Star revenue. + /// Contains the URL to use to withdraw Telegram Star revenue. public string url; } @@ -20215,7 +20422,9 @@ namespace TL public virtual long ID => default; /// For limited-supply gifts: the total number of gifts that was available in the initial supply. public virtual int AvailabilityTotal => default; + /// Title of the gift public virtual string Title => default; + /// This gift was released by the specified peer. public virtual Peer ReleasedBy => default; } /// Represents a star gift, see here » for more info. See @@ -20234,6 +20443,7 @@ namespace TL [IfFlag(0)] public int availability_remains; /// For limited-supply gifts: the total number of gifts that was available in the initial supply. [IfFlag(0)] public int availability_total; + /// The total number of (upgraded to collectibles) gifts of this type currently on resale [IfFlag(4)] public long availability_resale; /// The receiver of this gift may convert it to this many Telegram Stars, instead of displaying it on their profile page.
convert_stars will be equal to stars only if the gift was bought using recently bought Telegram Stars, otherwise it will be less than stars.
public long convert_stars; @@ -20241,12 +20451,19 @@ namespace TL [IfFlag(1)] public DateTime first_sale_date; /// For sold out gifts only: when was the gift last bought. [IfFlag(1)] public DateTime last_sale_date; + /// The number of Telegram Stars the user can pay to convert the gift into a collectible gift ». [IfFlag(3)] public long upgrade_stars; + /// The minimum price in Stars for gifts of this type currently on resale. [IfFlag(4)] public long resell_min_stars; + /// Title of the gift [IfFlag(5)] public string title; + /// This gift was released by the specified peer. [IfFlag(6)] public Peer released_by; + /// Maximum number of gifts of this type that can be owned by any user. [IfFlag(8)] public int per_user_total; + /// Remaining number of gifts of this type that can be owned by the current user. [IfFlag(8)] public int per_user_remains; + /// If set, the specified gift possibly cannot be sent until the specified date, see here » for the full flow. [IfFlag(9)] public DateTime locked_until_date; [Flags] public enum Flags : uint @@ -20265,7 +20482,9 @@ namespace TL has_title = 0x20, /// Field has a value has_released_by = 0x40, + /// This gift can only be bought by users with a Premium subscription. require_premium = 0x80, + /// If set, the maximum number of gifts of this type that can be owned by a single user is limited and specified in per_user_total, and the remaining slots for the current user in per_user_remains. limited_per_user = 0x100, /// Field has a value has_locked_until_date = 0x200, @@ -20275,7 +20494,9 @@ namespace TL public override long ID => id; /// For limited-supply gifts: the total number of gifts that was available in the initial supply. public override int AvailabilityTotal => availability_total; + /// Title of the gift public override string Title => title; + /// This gift was released by the specified peer. public override Peer ReleasedBy => released_by; } /// Represents a collectible star gift, see here » for more info. See @@ -20284,23 +20505,39 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Identifier of the gift. + /// Identifier of the collectible gift. public long id; + /// Unique ID of the gift. public long gift_id; + /// Collectible title. public string title; + /// Slug that can be used to create a collectible gift deep link », or elsewhere in the API where a collectible slug is accepted. public string slug; + /// Unique identifier of this collectible gift among all (already upgraded) collectible gifts of the same type. public int num; + /// The owner of the gift. [IfFlag(0)] public Peer owner_id; + /// The name of the owner if neither owner_id nor owner_address are set. [IfFlag(1)] public string owner_name; + /// For NFTs on the TON blockchain, contains the address of the owner (append it to the ton_blockchain_explorer_url client configuration value » to obtain a link with information about the address). [IfFlag(2)] public string owner_address; + /// Collectible attributes public StarGiftAttribute[] attributes; + /// Total number of gifts of the same type that were upgraded to a collectible gift. public int availability_issued; + /// Total number of gifts of the same type that can be upgraded or were already upgraded to a collectible gift. public int availability_total; + /// For NFTs on the TON blockchain, contains the address of the NFT (append it to the ton_blockchain_explorer_url client configuration value » to obtain a link with information about the address). [IfFlag(3)] public string gift_address; + /// Resale price of the gift. [IfFlag(4)] public StarsAmountBase[] resell_amount; + /// This gift was released by the specified peer. [IfFlag(5)] public Peer released_by; + /// Price of the gift. [IfFlag(8)] public long value_amount; + /// Currency for the gift's price. [IfFlag(8)] public string value_currency; + /// The current chat where the associated chat theme is installed, if any (gift-based themes can only be installed in one chat at a time). [IfFlag(10)] public Peer theme_peer; [Flags] public enum Flags : uint @@ -20317,19 +20554,25 @@ namespace TL has_resell_amount = 0x10, /// Field has a value has_released_by = 0x20, + /// This gift can only be bought by users with a Premium subscription. require_premium = 0x40, + /// Whether the gift can be bought only using Toncoins. resale_ton_only = 0x80, /// Fields and have a value has_value_amount = 0x100, + /// A chat theme associated to this gift is available, see here » for more info on how to use it. theme_available = 0x200, /// Field has a value has_theme_peer = 0x400, } - /// Identifier of the gift. + /// Identifier of the collectible gift. public override long ID => id; + /// Total number of gifts of the same type that can be upgraded or were already upgraded to a collectible gift. public override int AvailabilityTotal => availability_total; + /// Collectible title. public override string Title => title; + /// This gift was released by the specified peer. public override Peer ReleasedBy => released_by; } @@ -20342,7 +20585,9 @@ namespace TL public int hash; /// List of available gifts. public StarGiftBase[] gifts; + /// Chats mentioned in the gifts field. public Dictionary chats; + /// Users mentioned in the gifts field. public Dictionary users; /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); @@ -20550,18 +20795,20 @@ namespace TL { /// The integer amount of Telegram Stars. public long amount; - /// The decimal amount of Telegram Stars, expressed as nanostars (i.e. 1 nanostar is equal to 1/1'000'000'000th of a Telegram Star).
This field may also be negative (the allowed range is -999999999 to 999999999).
+ /// The decimal amount of Telegram Stars, expressed as nanostars (i.e. 1 nanostar is equal to 1/1'000'000'000th (one billionth) of a Telegram Star).
This field may also be negative (the allowed range is -999999999 to 999999999).
public int nanos; /// The integer amount of Telegram Stars. public override long Amount => amount; } - /// See + /// Describes an amount of toncoin in nanotons (i.e. 1/1_000_000_000 of a toncoin). See [TLDef(0x74AEE3E0)] public sealed partial class StarsTonAmount : StarsAmountBase { + /// The amount in nanotons. public long amount; + /// The amount in nanotons. public override long Amount => amount; } @@ -20602,30 +20849,37 @@ namespace TL } } - /// See + /// Info about the current verifier bot ». See [TLDef(0xB0CD6617)] public sealed partial class BotVerifierSettings : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Verification icon public long icon; + /// The name of the organization that provides the verification public string company; + /// An optional default description for the verification [IfFlag(0)] public string custom_description; [Flags] public enum Flags : uint { /// Field has a value has_custom_description = 0x1, + /// Indicates whether the bot is allowed to set a custom description field for individual verified peers, different from the custom_description provided here. can_modify_custom_description = 0x2, } } - /// See + /// Describes a bot verification icon ». See [TLDef(0xF93CD45C)] public sealed partial class BotVerification : IObject { + /// ID of the bot that verified this peer public long bot_id; + /// Verification icon public long icon; + /// Verification description public string description; } @@ -20704,64 +20958,87 @@ namespace TL public StarGiftAttribute[] sample_attributes; } - /// See + /// Describes a list of users (or bots). See [TLDef(0x62D706B8)] public partial class Users_Users : IObject { + /// Users public Dictionary users; } - /// See + /// Describes a partial list of users. See [TLDef(0x315A4974)] public sealed partial class Users_UsersSlice : Users_Users { + /// Total number of users (bigger than the users specified in users) public int count; } - /// See + /// Represents a collectible gift ». See [TLDef(0x416C56E8)] public sealed partial class Payments_UniqueStarGift : IObject, IPeerResolver { + /// The . public StarGiftBase gift; + /// Chats mentioned in the gift field. public Dictionary chats; + /// Users mentioned in the gift field. public Dictionary users; /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// Represents a webpage preview. See [TLDef(0x8C9A88AC)] public sealed partial class Messages_WebPagePreview : IObject, IPeerResolver { + /// The or a if there is no preview. public MessageMedia media; + /// Chats mentioned in the gift field. public Dictionary chats; + /// Users mentioned within the media object. public Dictionary users; /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// Represents a gift owned by a peer. See [TLDef(0x19A9B572)] public sealed partial class SavedStarGift : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Sender of the gift (unset for anonymous gifts). [IfFlag(1)] public Peer from_id; + /// Reception date of the gift. public DateTime date; + /// The collectible gift. public StarGiftBase gift; + /// Message attached to the gift. [IfFlag(2)] public TextWithEntities message; + /// For gifts received by users, ID to use in s. [IfFlag(3)] public int msg_id; + /// For gifts received by channels, ID to use in s. [IfFlag(11)] public long saved_id; + /// For non-collectible gifts, the receiver of this gift may convert it to this many Telegram Stars, instead of displaying it on their profile page. [IfFlag(4)] public long convert_stars; + /// Only for pre-paid non-collectible gifts, the number of Telegram Stars the sender has already paid to convert the gift into a collectible gift » (this is different from the meaning of the flag in , where it signals the upgrade price for not yet upgraded gifts). [IfFlag(6)] public long upgrade_stars; + /// If set, indicates that the current gift can't be exported to the TON blockchain » yet: the owner will be able to export it at the specified unixtime. [IfFlag(7)] public DateTime can_export_at; + /// If set, indicates that the gift can be transferred » to another user by paying the specified amount of stars. [IfFlag(8)] public long transfer_stars; + /// If set, indicates that the current gift can't be transferred » yet: the owner will be able to transfer it at the specified unixtime. [IfFlag(13)] public DateTime can_transfer_at; + /// If set, indicates that the current gift can't be resold » yet: the owner will be able to put it up for sale at the specified unixtime. [IfFlag(14)] public DateTime can_resell_at; + /// IDs of the collections » that this gift is a part of. [IfFlag(15)] public int[] collection_id; + /// Hash to prepay for a gift upgrade separately ». [IfFlag(16)] public string prepaid_upgrade_hash; [Flags] public enum Flags : uint { + /// If set, the gift sender in from_id and the message are set only for the receiver of the gift. name_hidden = 0x1, /// Field has a value has_from_id = 0x2, @@ -20771,6 +21048,7 @@ namespace TL has_msg_id = 0x8, /// Field has a value has_convert_stars = 0x10, + /// If set, the gift is not pinned on the user's profile. unsaved = 0x20, /// Field has a value has_upgrade_stars = 0x40, @@ -20778,10 +21056,13 @@ namespace TL has_can_export_at = 0x80, /// Field has a value has_transfer_stars = 0x100, + /// This gift was upgraded to a collectible gift » and then re-downgraded to a regular gift because a request to refund the payment related to the upgrade was made, and the money was returned. refunded = 0x200, + /// Only set for non-collectible gifts, if they can be upgraded to a collectible gift ». can_upgrade = 0x400, /// Field has a value has_saved_id = 0x800, + /// Whether this gift is pinned on top of the user's profile page. pinned_to_top = 0x1000, /// Field has a value has_can_transfer_at = 0x2000, @@ -20791,21 +21072,28 @@ namespace TL has_collection_id = 0x8000, /// Field has a value has_prepaid_upgrade_hash = 0x10000, + /// If set, someone already separately pre-paid for the upgrade of this gift. upgrade_separate = 0x20000, } } - /// See + /// Represents a list of gifts. See [TLDef(0x95F389B1)] public sealed partial class Payments_SavedStarGifts : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Total number of results (can be less than the returned gifts, in which case next_offset will be set). public int count; + /// Ternary value: can be not set, set&true, set&false.
Can only be set for channels we own: the value indicates whether we
enabled gift notifications for this channel.
[IfFlag(1)] public bool chat_notifications_enabled; + /// Gifts public SavedStarGift[] gifts; + /// Offset to pass to Payments_GetSavedStarGifts to fetch the next page of results. [IfFlag(0)] public string next_offset; + /// Channels mentioned in gifts public Dictionary chats; + /// Users mentioned in gifts public Dictionary users; [Flags] public enum Flags : uint @@ -20819,9 +21107,9 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See Derived classes: , , + /// Points to a gift ». See Derived classes: , , public abstract partial class InputSavedStarGift : IObject { } - /// A gift received in a private chat with another user. See + /// A gift received in a private chat with another user. See [TLDef(0x69279795)] public sealed partial class InputSavedStarGiftUser : InputSavedStarGift { @@ -20837,30 +21125,33 @@ namespace TL /// ID of the gift, must be the saved_id of a /. public long saved_id; } - /// See + /// Points to a collectible gift obtained from a collectible gift link ». See [TLDef(0x2085C238)] public sealed partial class InputSavedStarGiftSlug : InputSavedStarGift { + /// Slug from the link. public string slug; } - /// See + /// A URL that can be used to import the exported NFT on Fragment. See [TLDef(0x84AA3A9C)] public sealed partial class Payments_StarGiftWithdrawalUrl : IObject { + /// The URL to open. public string url; } - /// See Derived classes: , + /// Paid reaction privacy settings » See Derived classes: , /// a value means paidReactionPrivacyDefault public abstract partial class PaidReactionPrivacy : IObject { } - /// See + /// Send paid reactions anonymously. See [TLDef(0x1F0C1AD9)] public sealed partial class PaidReactionPrivacyAnonymous : PaidReactionPrivacy { } - /// See + /// Send paid reactions as the specified peer, fetched using Channels_GetSendAs. See [TLDef(0xDC6CFCF0)] public sealed partial class PaidReactionPrivacyPeer : PaidReactionPrivacy { + /// The peer to send reactions as. public InputPeer peer; } @@ -20886,7 +21177,7 @@ namespace TL public long stars_amount; } - /// See + /// Business bot rights. See [TLDef(0xA0624CF7)] public sealed partial class BusinessBotRights : IObject { @@ -20895,24 +21186,38 @@ namespace TL [Flags] public enum Flags : uint { + /// Whether the bot can send and edit messages in private chats that had incoming messages in the last 24 hours. reply = 0x1, + /// Whether the bot can mark incoming private messages as read. read_messages = 0x2, + /// Whether the bot can delete messages sent by the bot. delete_sent_messages = 0x4, + /// Whether the bot can delete received private messages in managed chats. delete_received_messages = 0x8, + /// Whether the bot can edit the first and last name of the business account. edit_name = 0x10, + /// Whether the bot can edit the bio of the business account. edit_bio = 0x20, + /// Whether the bot can edit the profile photo of the business account. edit_profile_photo = 0x40, + /// Whether the bot can edit the username of the business account. edit_username = 0x80, + /// Whether the bot can view gifts and the amount of Telegram Stars owned by the business account. view_gifts = 0x100, + /// Whether the bot can convert regular gifts owned by the business account to Telegram Stars. sell_gifts = 0x200, + /// Whether the bot can change the privacy settings pertaining to gifts for the business account. change_gift_settings = 0x400, + /// Whether the bot can transfer and upgrade gifts owned by the business account. transfer_and_upgrade_gifts = 0x800, + /// Whether the bot can transfer Telegram Stars received by the business account to its own account, or use them to upgrade and transfer gifts. transfer_stars = 0x1000, + /// Whether the bot can post, edit and delete stories on behalf of the business account. manage_stories = 0x2000, } } - /// See + /// Disallow the reception of specific gift types. See [TLDef(0x71F276C4)] public sealed partial class DisallowedGiftsSettings : IObject { @@ -20921,22 +21226,30 @@ namespace TL [Flags] public enum Flags : uint { + /// Disallow the reception of gifts with an unlimited supply (those with the .limited flag not set). disallow_unlimited_stargifts = 0x1, + /// Disallow the reception of limited-supply gifts (those with the .limited flag set). disallow_limited_stargifts = 0x2, + /// Disallow the reception of collectible gifts ». disallow_unique_stargifts = 0x4, + /// Disallow the reception of gifted Telegram Premium subscriptions ». disallow_premium_gifts = 0x8, } } - /// See + /// A sponsored peer. See [TLDef(0xC69708D3)] public sealed partial class SponsoredPeer : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// ID of the sponsored peer, to be passed to Messages_ViewSponsoredMessage, Messages_ClickSponsoredMessage or Messages_ReportSponsoredMessage (the same methods used for sponsored messages &raquo). public byte[] random_id; + /// The sponsored peer. public Peer peer; + /// If set, contains additional information about the sponsor to be shown along with the peer. [IfFlag(0)] public string sponsor_info; + /// If set, contains additional information about the sponsored message to be shown along with the peer. [IfFlag(1)] public string additional_info; [Flags] public enum Flags : uint @@ -20948,60 +21261,75 @@ namespace TL } } - /// See + /// Sponsored peers. See /// a value means contacts.sponsoredPeersEmpty [TLDef(0xEB032884)] public sealed partial class Contacts_SponsoredPeers : IObject, IPeerResolver { + /// Sponsored peers. public SponsoredPeer[] peers; + /// Info about sponsored chats and channels public Dictionary chats; + /// Info about sponsored users public Dictionary users; /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See Derived classes: , , + /// Represents the identifier of a collectible gift attribute. See Derived classes: , , public abstract partial class StarGiftAttributeId : IObject { } - /// See + /// The ID of a model of a collectible gift ». See [TLDef(0x48AAAE3C)] public sealed partial class StarGiftAttributeIdModel : StarGiftAttributeId { + /// The sticker representing the upgraded gift public long document_id; } - /// See + /// The ID of a pattern of a collectible gift ». See [TLDef(0x4A162433)] public sealed partial class StarGiftAttributeIdPattern : StarGiftAttributeId { + /// The sticker representing the symbol public long document_id; } - /// See + /// The ID of a backdrop of a collectible gift ». See [TLDef(0x1F01C757)] public sealed partial class StarGiftAttributeIdBackdrop : StarGiftAttributeId { + /// Unique ID of the backdrop. public int backdrop_id; } - /// See + /// Indicates the total number of gifts that have the specified attribute. See [TLDef(0x2EB1B658)] public sealed partial class StarGiftAttributeCounter : IObject { + /// The attribute (just the ID, without the attribute itself). public StarGiftAttributeId attribute; + /// Total number of gifts with this attribute. public int count; } - /// See + /// List of gifts currently on resale ». See [TLDef(0x947A12DF)] public sealed partial class Payments_ResaleStarGifts : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Total number of results. public int count; + /// Collectible gifts on resale (may be less than count, in which case next_offset will be set). public StarGiftBase[] gifts; + /// Offset for pagination, pass this to Payments_GetResaleStarGifts.offset to fetch the next results. [IfFlag(0)] public string next_offset; + /// Possible gift attributes. [IfFlag(1)] public StarGiftAttribute[] attributes; + /// Hash of the attributes field, pass this to Payments_GetResaleStarGifts.attributes_hash to avoid returning any attributes (flag not set) if they haven't changed. [IfFlag(1)] public long attributes_hash; + /// Chats mentioned in the attributes. public Dictionary chats; [IfFlag(2)] public StarGiftAttributeCounter[] counters; + /// Users mentioned in the attributes. public Dictionary users; [Flags] public enum Flags : uint @@ -21017,85 +21345,107 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// Contains the number of available active story slots (equal to the value of the story_expiring_limit_* client configuration parameter minus the number of currently active stories). See [TLDef(0xC387C04E)] public sealed partial class Stories_CanSendStoryCount : IObject { + /// Remaining active story slots. public int count_remains; } - /// See + /// Represents a custom pending suggestion ». See [TLDef(0xE7E82E12)] public sealed partial class PendingSuggestion : IObject { + /// The suggestion ID, can be passed to Help_DismissSuggestion. public string suggestion; + /// Title of the suggestion. public TextWithEntities title; + /// Body of the suggestion. public TextWithEntities description; + /// URL to open when the user clicks on the suggestion. public string url; } - /// See + /// An item of a todo list ». See [TLDef(0xCBA9A52F)] public sealed partial class TodoItem : IObject { + /// ID of the item, a positive (non-zero) integer unique within the current list. public int id; + /// Text of the item, maximum length equal to todo_item_length_max ». public TextWithEntities title; } - /// See + /// Represents a todo list ». See [TLDef(0x49B92A26)] public sealed partial class TodoList : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Title of the todo list, maximum length equal to todo_title_length_max ». public TextWithEntities title; + /// Items of the list. public TodoItem[] list; [Flags] public enum Flags : uint { + /// If set, users different from the creator of the list can append items to the list. others_can_append = 0x1, + /// If set, users different from the creator of the list can complete items in the list. others_can_complete = 0x2, } } - /// See + /// A completed todo list » item. See [TLDef(0x4CC120B7)] public sealed partial class TodoCompletion : IObject { + /// The ID of the completed item. public int id; + /// ID of the user that completed the item. public long completed_by; + /// When was the item completed. public DateTime date; } - /// See + /// Contains info about a suggested post ». See [TLDef(0x0E8E37E5)] public sealed partial class SuggestedPost : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Price of the suggested post. [IfFlag(3)] public StarsAmountBase price; + /// Scheduling date. [IfFlag(0)] public DateTime schedule_date; [Flags] public enum Flags : uint { /// Field has a value has_schedule_date = 0x1, + /// Whether the suggested post was accepted. accepted = 0x2, + /// Whether the suggested post was rejected. rejected = 0x4, /// Field has a value has_price = 0x8, } } - /// See + /// Represents the profile's star rating, see here » for more info. See [TLDef(0x1B0E4F07)] public sealed partial class StarsRating : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The current level, may be negative. public int level; + /// The numerical value of the rating required for the current level. public long current_level_stars; + /// Numerical value of the current rating. public long stars; + /// The numerical value of the rating required for the next level. [IfFlag(0)] public long next_level_stars; [Flags] public enum Flags : uint @@ -21105,16 +21455,21 @@ namespace TL } } - /// See + /// Represents a star gift collection ». See [TLDef(0x9D6B13B0)] public sealed partial class StarGiftCollection : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The ID of the collection. public int collection_id; + /// Title of the collection. public string title; + /// Optional icon for the collection, taken from the first gift in the collection. [IfFlag(0)] public DocumentBase icon; + /// Number of gifts in the collection. public int gifts_count; + /// Field to use instead of collection_id when generating the hash to pass to Payments_GetStarGiftCollections. public long hash; [Flags] public enum Flags : uint @@ -21124,23 +21479,28 @@ namespace TL } } - /// See + /// Represents a list of star gift collections ». See /// a value means payments.starGiftCollectionsNotModified [TLDef(0x8A2932F3)] public sealed partial class Payments_StarGiftCollections : IObject { + /// Star gift collections. public StarGiftCollection[] collections; } - /// See + /// Represents a story album ». See [TLDef(0x9325705A)] public sealed partial class StoryAlbum : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// ID of the album. public int album_id; + /// Name of the album. public string title; + /// Photo from the first story of the album, if it's a photo. [IfFlag(0)] public PhotoBase icon_photo; + /// Video from the first story of the album, if it's a video. [IfFlag(1)] public DocumentBase icon_video; [Flags] public enum Flags : uint @@ -21152,134 +21512,168 @@ namespace TL } } - /// See + /// Story albums ». See /// a value means stories.albumsNotModified [TLDef(0xC3987A3A)] public sealed partial class Stories_Albums : IObject { + /// Hash to pass to Stories_GetAlbums to avoid returning any results if they haven't changed. public long hash; + /// The albums. public StoryAlbum[] albums; } - /// See + /// Indicates if the specified global post search » requires payment. See [TLDef(0x3E0B5B6A)] public sealed partial class SearchPostsFlood : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Total number of daily free search slots. public int total_daily; + /// Remaining number of free search slots. public int remains; + /// If there are no more search slots, specifies the unixtime when more search slots will be available. [IfFlag(1)] public int wait_till; + /// The number of Telegram Stars to pay for each non-free search. public long stars_amount; [Flags] public enum Flags : uint { + /// The specified query is free (and it will not use up free search slots). query_is_free = 0x1, /// Field has a value has_wait_till = 0x2, } } - /// See + /// Information about the value of a collectible gift ». See [TLDef(0x512FE446)] public sealed partial class Payments_UniqueStarGiftValueInfo : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Three-letter ISO 4217 currency code (a localized fiat currency used to represent prices and price estimations in this constructor). public string currency; + /// Estimated value of the gift, in the smallest unit of the currency specified in currency. public long value; + /// Initial purchase date of the gift. public DateTime initial_sale_date; + /// Initial purchase price in Stars. public long initial_sale_stars; + /// Initial purchase price in the smallest unit of the currency specified in currency (automatically converted from initial_sale_stars). public long initial_sale_price; + /// Last resale date of the gift. [IfFlag(0)] public DateTime last_sale_date; + /// Last resale price, in the smallest unit of the currency specified in currency. [IfFlag(0)] public long last_sale_price; + /// The current minimum price of collectible gifts of the same type, in the smallest unit of the currency specified in currency. [IfFlag(2)] public long floor_price; + /// The current average sale price of collectible gifts of the same type, in the smallest unit of the currency specified in currency. [IfFlag(3)] public long average_price; + /// Number of gifts of the same type currently being resold on Telegram. [IfFlag(4)] public int listed_count; + /// Number of gifts of the same type currently being resold on fragment. [IfFlag(5)] public int fragment_listed_count; + /// Fragment link to the listing of gifts of the same type currently being resold on fragment. [IfFlag(5)] public string fragment_listed_url; [Flags] public enum Flags : uint { + /// Fields and have a value has_last_sale_date = 0x1, + /// If set, the last sale was completed on Fragment. last_sale_on_fragment = 0x2, + /// Field has a value has_floor_price = 0x4, + /// Field has a value has_average_price = 0x8, + /// Field has a value has_listed_count = 0x10, + /// Fields and have a value has_fragment_listed_count = 0x20, + /// If set, the value is calculated from the average value of sold gifts of the same type. Otherwise, it is based on the sale price of the gift. value_is_average = 0x40, } } - /// See + /// Represents a tab of a profile page ». See public enum ProfileTab : uint { - ///See + ///Represents the stories tab of a profile page. Posts = 0xB98CD696, - ///See + ///Represents the gifts tab of a profile page. Gifts = 0x4D4BD46A, - ///See + ///Represents the media tab of a profile page. Media = 0x72C64955, - ///See + ///Represents the shared files tab of a profile. Files = 0xAB339C00, - ///See + ///Represents the music tab of a profile page. Music = 0x9F27D26E, - ///See + ///Represents the voice messages tab of a profile page. Voice = 0xE477092E, - ///See + ///Represents the shared links tab of a profile page. Links = 0xD3656499, - ///See + ///Represents the gifs tab of a profile page. Gifs = 0xA2C0F695, } - /// See + /// List of songs (.ids) currently pinned on a user's profile, see here » for more info. See Derived classes: , public abstract partial class Users_SavedMusicBase : IObject { } - /// See + /// This subset of the songs currently pinned on a user's profile hasn't changed, see here » for more info. See [TLDef(0xE3878AA4)] public sealed partial class Users_SavedMusicNotModified : Users_SavedMusicBase { + /// Total number of songs on the user's profile. public int count; } - /// See + /// List of songs currently pinned on a user's profile, see here » for more info. See [TLDef(0x34A2F297)] public sealed partial class Users_SavedMusic : Users_SavedMusicBase { + /// Total number of songs (can be bigger than documents depending on the passed limit, and the default maximum limit in which case pagination is required). public int count; + /// Songs. public DocumentBase[] documents; } - /// See + /// List of IDs of songs (.ids) currently pinned on our profile, see here » for more info. See /// a value means account.savedMusicIdsNotModified [TLDef(0x998D6636)] public sealed partial class Account_SavedMusicIds : IObject { + /// Full list of .ids public long[] ids; } - /// See + /// Specifies if a gift can or cannot be sent. See Derived classes: , public abstract partial class Payments_CheckCanSendGiftResult : IObject { } - /// See + /// The specified gift can be sent. See [TLDef(0x374FA7AD)] public sealed partial class Payments_CheckCanSendGiftResultOk : Payments_CheckCanSendGiftResult { } - /// See + /// The specified gift cannot be sent yet for the specified reason. See [TLDef(0xD5E58274)] public sealed partial class Payments_CheckCanSendGiftResultFail : Payments_CheckCanSendGiftResult { + /// The reason why it can't be sent yet. public TextWithEntities reason; } - /// See + /// Specifies a chat theme ». See Derived classes: , /// a value means inputChatThemeEmpty public abstract partial class InputChatThemeBase : IObject { } - /// See + /// Set an emoji-based chat theme, returned by Account_GetChatThemes. See [TLDef(0xC93DE95C)] public sealed partial class InputChatTheme : InputChatThemeBase { + /// The emoji. public string emoticon; } - /// See + /// Set a theme based on an owned collectible gift », returned by Account_GetUniqueGiftChatThemes. See [TLDef(0x87E5DFE4)] public sealed partial class InputChatThemeUniqueGift : InputChatThemeBase { + /// The slug from .slug. public string slug; } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 804263a..ce2d58b 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -7,7 +7,7 @@ namespace TL { public static class SchemaExtensions { - /// Invokes a query after successful completion of one of the previous queries. See + /// Invokes a query after successful completion of one of the previous queries. See [bots: ✓] /// Message identifier on which a current query depends /// The query itself public static Task InvokeAfterMsg(this Client client, long msg_id, IMethod query) @@ -17,7 +17,7 @@ namespace TL query = query, }); - /// Invokes a query after a successful completion of previous queries See + /// Invokes a query after a successful completion of previous queries See [bots: ✓] /// List of messages on which a current query depends /// The query itself public static Task InvokeAfterMsgs(this Client client, long[] msg_ids, IMethod query) @@ -27,7 +27,7 @@ namespace TL query = query, }); - /// Initialize connection See Possible codes: 400 (details) + /// Initialize connection See [bots: ✓] Possible codes: 400 (details) /// Application identifier (see. App configuration) /// Device model /// Operation system version @@ -54,7 +54,7 @@ namespace TL query = query, }); - /// Invoke the specified query using the specified API layer See Possible codes: -504,400,403,406 (details) + /// Invoke the specified query using the specified API layer See [bots: ✓] Possible codes: 400,403,406 (details) /// The layer to use /// The query public static Task InvokeWithLayer(this Client client, int layer, IMethod query) @@ -64,7 +64,7 @@ namespace TL query = query, }); - /// Invoke a request without subscribing the used connection for updates (this is enabled by default for file queries). See + /// Invoke a request without subscribing the used connection for updates (this is enabled by default for file queries). See [bots: ✓] /// The query public static Task InvokeWithoutUpdates(this Client client, IMethod query) => client.Invoke(new InvokeWithoutUpdates @@ -72,7 +72,7 @@ namespace TL query = query, }); - /// Invoke with the given message range See + /// Invoke with the given message range See [bots: ✓] /// Message range /// Query public static Task InvokeWithMessagesRange(this Client client, MessageRange range, IMethod query) @@ -82,7 +82,7 @@ namespace TL query = query, }); - /// Invoke a method within a takeout session, see here » for more info. See + /// Invoke a method within a takeout session, see here » for more info. See [bots: ✓] /// Takeout session ID » /// Query public static Task InvokeWithTakeout(this Client client, long takeout_id, IMethod query) @@ -92,7 +92,7 @@ namespace TL query = query, }); - /// Invoke a method using a Telegram Business Bot connection, see here » for more info, including a list of the methods that can be wrapped in this constructor. See + /// Invoke a method using a Telegram Business Bot connection, see here » for more info, including a list of the methods that can be wrapped in this constructor. See [bots: ✓] /// Business connection ID. /// The actual query. public static Task InvokeWithBusinessConnection(this Client client, string connection_id, IMethod query) @@ -102,7 +102,7 @@ namespace TL query = query, }); - /// Official clients only, invoke with Google Play Integrity token. See + /// Official clients only, invoke with Google Play Integrity token. See [bots: ✓] /// Nonce. /// Token. /// Query. @@ -114,7 +114,7 @@ namespace TL query = query, }); - /// Official clients only, invoke with Apple push verification. See + /// Official clients only, invoke with Apple push verification. See [bots: ✓] /// Nonce. /// Secret. /// Query. @@ -126,7 +126,9 @@ namespace TL query = query, }); - /// See + /// Official clients only: re-execute a method call that required reCAPTCHA verification via a RECAPTCHA_CHECK_%s__%s, where the first placeholder is the action, and the second one is the reCAPTCHA key ID. See [bots: ✓] + /// reCAPTCHA token received after verification. + /// The original method call. public static Task InvokeWithReCaptcha(this Client client, string token, IMethod query) => client.Invoke(new InvokeWithReCaptcha { @@ -212,7 +214,7 @@ namespace TL bytes = bytes, }); - /// Binds a temporary authorization key temp_auth_key_id to the permanent authorization key perm_auth_key_id. Each permanent key may only be bound to one temporary key at a time, binding a new temporary key overwrites the previous one. See [bots: ✓] Possible codes: -504,400 (details) + /// Binds a temporary authorization key temp_auth_key_id to the permanent authorization key perm_auth_key_id. Each permanent key may only be bound to one temporary key at a time, binding a new temporary key overwrites the previous one. See [bots: ✓] Possible codes: 400 (details) /// Permanent auth_key_id to bind to /// Random long from Binding message contents /// Unix timestamp to invalidate temporary key, see Binding message contents @@ -298,7 +300,7 @@ namespace TL except_auth_keys = except_auth_keys, }); - /// Generate a login token, for login via QR code.
The generated login token should be encoded using base64url, then shown as a tg://login?token=base64encodedtoken deep link » in the QR code. See Possible codes: -504,400 (details)
+ /// Generate a login token, for login via QR code.
The generated login token should be encoded using base64url, then shown as a tg://login?token=base64encodedtoken deep link » in the QR code. See Possible codes: 400 (details)
/// Application identifier (see. App configuration) /// Application identifier hash (see. App configuration) /// List of already logged-in user IDs, to prevent logging in twice with the same user @@ -452,7 +454,7 @@ namespace TL about = about, }); - /// Updates online user status. See Possible codes: -504 (details) + /// Updates online user status. See /// If is transmitted, user status will change to . public static Task Account_UpdateStatus(this Client client, bool offline) => client.Invoke(new Account_UpdateStatus @@ -1292,8 +1294,9 @@ namespace TL message = message, }); - /// Connect a business bot » to the current account, or to change the current connection settings. See Possible codes: 400,403 (details) + /// Connect a business bot » to the current account, or to change the current connection settings. See Possible codes: 400,403 (details) /// Whether to fully disconnect the bot from the current account. + /// Business bot rights. /// The bot to connect or disconnect /// Configuration for the business connection public static Task Account_UpdateConnectedBot(this Client client, InputUserBase bot, InputBusinessBotRecipients recipients, BusinessBotRights rights = null, bool deleted = false) @@ -1305,14 +1308,14 @@ namespace TL recipients = recipients, }); - /// List all currently connected business bots » See + /// List all currently connected business bots » See public static Task Account_GetConnectedBots(this Client client) => client.Invoke(new Account_GetConnectedBots { }); - /// Bots may invoke this method to re-fetch the associated with a specific business connection_id, see here » for more info on connected business bots.
This is needed for example for freshly logged in bots that are receiving some , etc. updates because some users have already connected to the bot before it could login.
In this case, the bot is receiving messages from the business connection, but it hasn't cached the associated with info about the connection (can it reply to messages? etc.) yet, and cannot receive the old ones because they were sent when the bot wasn't logged into the session yet.
This method can be used to fetch info about a not-yet-cached business connection, and should not be invoked if the info is already cached or to fetch changes, as eventual changes will automatically be sent as new updates to the bot using the usual update delivery methods ». See [bots: ✓] Possible codes: 400 (details)
- /// Business connection ID ». + /// Bots may invoke this method to re-fetch the associated with a specific business connection_id, see here » for more info on connected business bots.
This is needed for example for freshly logged in bots that are receiving some , etc. updates because some users have already connected to the bot before it could login.
In this case, the bot is receiving messages from the business connection, but it hasn't cached the associated with info about the connection (can it reply to messages? etc.) yet, and cannot receive the old ones because they were sent when the bot wasn't logged into the session yet.
This method can be used to fetch info about a not-yet-cached business connection, and should not be invoked if the info is already cached or to fetch changes, as eventual changes will automatically be sent as new updates to the bot using the usual update delivery methods ». See [bots: ✓] Possible codes: 400 (details)
+ /// Business connection ID ». public static Task Account_GetBotBusinessConnection(this Client client, string connection_id) => client.Invoke(new Account_GetBotBusinessConnection { @@ -1328,7 +1331,7 @@ namespace TL intro = intro, }); - /// Pause or unpause a specific chat, temporarily disconnecting it from all business bots ». See Possible codes: 400 (details) + /// Pause or unpause a specific chat, temporarily disconnecting it from all business bots ». See Possible codes: 400 (details) /// The chat to pause /// Whether to pause or unpause the chat public static Task Account_ToggleConnectedBotPaused(this Client client, InputPeer peer, bool paused) @@ -1338,7 +1341,7 @@ namespace TL paused = paused, }); - /// Permanently disconnect a specific chat from all business bots » (equivalent to specifying it in recipients.exclude_users during initial configuration with Account_UpdateConnectedBot); to reconnect of a chat disconnected using this method the user must reconnect the entire bot by invoking Account_UpdateConnectedBot. See Possible codes: 400 (details) + /// Permanently disconnect a specific chat from all business bots » (equivalent to specifying it in recipients.exclude_users during initial configuration with Account_UpdateConnectedBot); to reconnect of a chat disconnected using this method the user must reconnect the entire bot by invoking Account_UpdateConnectedBot. See Possible codes: 400 (details) /// The chat to disconnect public static Task Account_DisablePeerConnectedBot(this Client client, InputPeer peer) => client.Invoke(new Account_DisablePeerConnectedBot @@ -1425,7 +1428,8 @@ namespace TL settings = settings, }); - /// See + /// Obtain a list of emoji statuses » for owned collectible gifts. See + /// Hash for pagination /// a null value means account.emojiStatusesNotModified public static Task Account_GetCollectibleEmojiStatuses(this Client client, long hash = default) => client.Invoke(new Account_GetCollectibleEmojiStatuses @@ -1434,7 +1438,7 @@ namespace TL }); /// 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 Possible codes: 400 (details) - /// 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. + /// 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 @@ -1447,7 +1451,7 @@ namespace TL /// Allow a user to send us messages without paying if paid messages » are enabled. See Possible codes: 400 (details) /// 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). /// If set, requires the user to pay in order to send us messages.
Can only be set by monoforums, not users, i.e. parent_peer must be set if this flag is set; users must instead use the privacy setting to remove a previously added exemption.
If not set, allows the user to send us messages without paying (can be unset by both monoforums and users). - /// If set, applies the setting within the monoforum aka direct messages » (pass the ID of the monoforum, not the ID of the associated channel). + /// 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 @@ -1457,14 +1461,18 @@ namespace TL user_id = user_id, }); - /// See + /// Changes the main profile tab of the current user, see here » for more info. See + /// The tab to set as main tab. public static Task Account_SetMainProfileTab(this Client client, ProfileTab tab) => client.Invoke(new Account_SetMainProfileTab { tab = tab, }); - /// See + /// Adds or removes a song from the current user's profile see here » for more info on the music tab of the profile page. See Possible codes: 400 (details) + /// If set, removes the song. + /// The song to add or remove; can be an already added song when reordering songs with after_id. Adding an already added song will never re-add it, only move it to the top of the song list (or after the song passed in after_id). + /// If set, the song will be added after the passed song (must be already pinned on the profile). public static Task Account_SaveMusic(this Client client, InputDocument id, InputDocument after_id = null, bool unsave = false) => client.Invoke(new Account_SaveMusic { @@ -1473,7 +1481,8 @@ namespace TL after_id = after_id, }); - /// See + /// Fetch the full list of only the IDs of songs currently added to the profile, see here » for more info. See + /// Hash generated » from the previously returned list of IDs. /// a null value means account.savedMusicIdsNotModified public static Task Account_GetSavedMusicIds(this Client client, long hash = default) => client.Invoke(new Account_GetSavedMusicIds @@ -1481,7 +1490,10 @@ namespace TL hash = hash, }); - /// See + /// Obtain all chat themes » associated to owned collectible gifts ». See + /// Offset for pagination. + /// Maximum number of results to return, see pagination + /// Hash from a previously returned , to avoid returning any result if the theme list hasn't changed. /// a null value means account.chatThemesNotModified public static Task Account_GetUniqueGiftChatThemes(this Client client, int offset = default, int limit = int.MaxValue, long hash = default) => client.Invoke(new Account_GetUniqueGiftChatThemes @@ -1491,7 +1503,7 @@ namespace TL hash = hash, }); - /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: -504,400 (details) + /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, params InputUserBase[] id) => client.Invoke(new Users_GetUsers @@ -1499,7 +1511,7 @@ namespace TL id = id, }); - /// Returns extended user info by ID. See [bots: ✓] Possible codes: -504,400 (details) + /// Returns extended user info by ID. See [bots: ✓] Possible codes: 400 (details) /// User ID public static Task Users_GetFullUser(this Client client, InputUserBase id) => client.Invoke(new Users_GetFullUser @@ -1507,7 +1519,7 @@ namespace TL id = id, }); - /// Notify the user that the sent passport data contains some errors The user will not be able to re-submit their Passport data to you until the errors are fixed (the contents of the field for which you returned the error must change). See [bots: ✓] Possible codes: 400,403 (details) + /// Notify the user that the sent passport data contains some errors The user will not be able to re-submit their Passport data to you until the errors are fixed (the contents of the field for which you returned the error must change). See [bots: ✓ users: ✗] Possible codes: 400 (details) /// The user /// Errors public static Task Users_SetSecureValueErrors(this Client client, InputUserBase id, params SecureValueErrorBase[] errors) @@ -1525,7 +1537,11 @@ namespace TL id = id, }); - /// See + /// Get songs pinned to the user's profile, see here » for more info. See Possible codes: 400 (details) + /// The ID of the user. + /// Offset for pagination. + /// Maximum number of results to return, see pagination + /// Hash » of the IDs of previously added songs, to avoid returning any result if there was no change. public static Task Users_GetSavedMusic(this Client client, InputUserBase id, int offset = default, int limit = int.MaxValue, long hash = default) => client.Invoke(new Users_GetSavedMusic { @@ -1535,7 +1551,9 @@ namespace TL hash = hash, }); - /// See + /// Check if the passed songs are still pinned to the user's profile, or refresh the file references of songs pinned on a user's profile see here » for more info. See Possible codes: 400 (details) + /// The ID of the user. + /// The songs (here, file_reference can be empty to refresh file references). public static Task Users_GetSavedMusicByID(this Client client, InputUserBase id, params InputDocument[] documents) => client.Invoke(new Users_GetSavedMusicByID { @@ -1632,7 +1650,7 @@ namespace TL limit = limit, }); - /// Resolve a @username to get peer info See [bots: ✓] Possible codes: -504,400 (details) + /// Resolve a @username to get peer info See [bots: ✓] Possible codes: 400 (details) /// @username to resolve /// Referrer ID from referral links ». public static Task Contacts_ResolveUsername(this Client client, string username, string referer = null) @@ -1792,7 +1810,8 @@ namespace TL { }); - /// See Possible codes: 400 (details) + /// Obtain a list of sponsored peer search results for a given query See Possible codes: 400 (details) + /// The query /// a null value means contacts.sponsoredPeersEmpty public static Task Contacts_GetSponsoredPeers(this Client client, string q) => client.Invoke(new Contacts_GetSponsoredPeers @@ -1800,7 +1819,7 @@ namespace TL q = q, }); - /// This method is only for basic Chat. See Terminology in the README to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Returns the list of messages by their IDs. See [bots: ✓] Possible codes: -504 (details)
+ /// This method is only for basic Chat. See Terminology in the README to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Returns the list of messages by their IDs. See [bots: ✓]
/// Message ID list public static Task Messages_GetMessages(this Client client, params InputMessage[] id) => client.Invoke(new Messages_GetMessages @@ -1808,7 +1827,7 @@ namespace TL id = id, }); - /// Returns the current user dialog list. See Possible codes: -504,400,403 (details) + /// Returns the current user dialog list. See Possible codes: 400,403 (details) /// Exclude pinned dialogs /// Peer folder ID, for more info click here /// Offsets for pagination, for more info click here @@ -1828,7 +1847,7 @@ namespace TL hash = hash, }); - /// Returns the conversation history with one interlocutor / within a chat See Possible codes: -504,400,406 (details) + /// Returns the conversation history with one interlocutor / within a chat See Possible codes: 400,406 (details) /// Target peer /// Only return messages starting from the specified message ID /// Only return messages sent before the specified date @@ -1932,7 +1951,7 @@ namespace TL max_id = max_id, }); - /// Sends a current user typing event (see for all event types) to a conversation partner or group. See [bots: ✓] Possible codes: -504,400,403,406 (details) + /// Sends a current user typing event (see for all event types) to a conversation partner or group. See [bots: ✓] Possible codes: 400,403,406 (details) /// Target user or group /// Topic ID /// Type of action @@ -1945,7 +1964,7 @@ namespace TL action = action, }); - /// Sends a message to a chat See [bots: ✓] Possible codes: -504,400,403,404,406,420,500 (details) + /// Sends a message to a chat See [bots: ✓] Possible codes: 400,403,404,406,420,500 (details) /// Set this flag to disable generation of the webpage preview /// Send this message silently (no notifications for the receivers) /// Send this message as background message @@ -1965,6 +1984,7 @@ namespace TL /// Add the message to the specified quick reply shortcut », instead. /// Specifies a message effect » to use for the message. /// For paid messages », specifies the amount of Telegram Stars the user has agreed to pay in order to send the message. + /// Used to suggest a post to a channel, see here » for more info on the full flow. public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, SuggestedPost suggested_post = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_SendMessage { @@ -1983,7 +2003,7 @@ namespace TL suggested_post = suggested_post, }); - /// Send a media See [bots: ✓] Possible codes: -504,400,403,406,420,500 (details) + /// Send a media See [bots: ✓] Possible codes: 400,403,406,420,500 (details) /// Send message silently (no notification should be triggered) /// Send message in background /// Clear the draft @@ -2003,6 +2023,7 @@ namespace TL /// Add the message to the specified quick reply shortcut », instead. /// Specifies a message effect » to use for the message. /// For paid messages », specifies the amount of Telegram Stars the user has agreed to pay in order to send the message. + /// Used to suggest a post to a channel, see here » for more info on the full flow. public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, SuggestedPost suggested_post = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_SendMedia { @@ -2035,10 +2056,13 @@ namespace TL /// Random ID to prevent resending of messages You can use /// Destination peer /// Destination forum topic + /// Can only contain an , to forward messages to a monoforum topic (mutually exclusive with top_msg_id). /// Scheduled message date for scheduled messages /// Forward the messages as the specified peer /// Add the messages to the specified quick reply shortcut », instead. + /// Start playing the video at the specified timestamp (seconds). /// For paid messages », specifies the amount of Telegram Stars the user has agreed to pay in order to send the message. + /// Used to suggest a post to a channel, see here » for more info on the full flow. public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, int? video_timestamp = null, long? allow_paid_stars = null, InputReplyTo reply_to = null, SuggestedPost suggested_post = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_ForwardMessages { @@ -2282,7 +2306,7 @@ namespace TL peer = peer, }); - /// This method is only for basic Chat. See Terminology in the README to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Notifies the sender about the recipient having listened a voice message or watched a video. See
+ /// This method is only for basic Chat. See Terminology in the README to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Notifies the sender about the recipient having listened a voice message or watched a video, emitting an . See
/// Message ID list public static Task Messages_ReadMessageContents(this Client client, params int[] id) => client.InvokeAffected(new Messages_ReadMessageContents @@ -2340,7 +2364,7 @@ namespace TL subscription_pricing = subscription_pricing, }); - /// Check the validity of a chat invite link and get basic info about it See Possible codes: -504,400,406 (details) + /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400,406 (details) /// Invite hash from chat invite deep link ». public static Task Messages_CheckChatInvite(this Client client, string hash) => client.Invoke(new Messages_CheckChatInvite @@ -2399,7 +2423,7 @@ namespace TL start_param = start_param, }); - /// Get and increase the view counter of a message sent or forwarded from a channel See Possible codes: -504,400,406 (details) + /// Get and increase the view counter of a message sent or forwarded from a channel See Possible codes: 400,406 (details) /// Peer where the message was found /// ID of message /// Whether to mark the message as viewed and increment the view counter @@ -2440,7 +2464,7 @@ namespace TL /// Global search filter /// If a positive value was specified, the method will return only messages with date bigger than min_date /// If a positive value was transferred, the method will return only messages with date smaller than max_date - /// Initially 0, then set to the next_rate parameter of messages.messagesSlice + /// Initially 0, then set to the next_rate parameter of messages.messagesSlice, or if that is absent, the date of the last returned message. /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here @@ -2518,7 +2542,7 @@ namespace TL offset = offset, }); - /// Answer an inline query, for bots only See [bots: ✓] Possible codes: 400,403 (details) + /// Answer an inline query, for bots only See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Set this flag if the results are composed of media files /// Set this flag if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query /// Unique identifier for the answered query @@ -2638,7 +2662,7 @@ namespace TL password = password, }); - /// Set the callback answer to a user button press (bots only) See [bots: ✓] Possible codes: 400 (details) + /// Set the callback answer to a user button press (bots only) See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Whether to show the message as a popup instead of a toast notification /// Query ID /// Popup to show @@ -2654,7 +2678,7 @@ namespace TL cache_time = cache_time, }); - /// Get dialog info of specified peers See Possible codes: -504,400,406 (details) + /// Get dialog info of specified peers See Possible codes: 400,406 (details) /// Peers public static Task Messages_GetPeerDialogs(this Client client, params InputDialogPeerBase[] peers) => client.Invoke(new Messages_GetPeerDialogs @@ -2671,6 +2695,7 @@ namespace TL /// Message entities for styled text /// Attached media /// Specifies a message effect » to use for the message. + /// Used to suggest a post to a channel, see here » for more info on the full flow. public static Task Messages_SaveDraft(this Client client, InputPeer peer, string message, MessageEntity[] entities = null, InputReplyTo reply_to = null, InputMedia media = null, long? effect = null, SuggestedPost suggested_post = null, bool no_webpage = false, bool invert_media = false) => client.Invoke(new Messages_SaveDraft { @@ -2767,7 +2792,7 @@ namespace TL media = media, }); - /// Use this method to set the score of the specified user in a game sent as a normal message (bots only). See [bots: ✓] Possible codes: 400 (details) + /// Use this method to set the score of the specified user in a game sent as a normal message (bots only). See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Set this flag if the game message should be automatically edited to include the current scoreboard /// Set this flag if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters /// Unique identifier of target chat @@ -2784,7 +2809,7 @@ namespace TL score = score, }); - /// Use this method to set the score of the specified user in a game sent as an inline message (bots only). See [bots: ✓] Possible codes: 400 (details) + /// Use this method to set the score of the specified user in a game sent as an inline message (bots only). See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Set this flag if the game message should be automatically edited to include the current scoreboard /// Set this flag if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters /// ID of the inline message @@ -2799,7 +2824,7 @@ namespace TL score = score, }); - /// Get highscores of a game See [bots: ✓] Possible codes: 400 (details) + /// Get highscores of a game See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Where was the game sent /// ID of message with game media attachment /// Get high scores made by a certain user @@ -2811,7 +2836,7 @@ namespace TL user_id = user_id, }); - /// Get highscores of a game sent using an inline bot See [bots: ✓] Possible codes: 400 (details) + /// Get highscores of a game sent using an inline bot See [bots: ✓ users: ✗] Possible codes: 400 (details) /// ID of inline message /// Get high scores of a certain user public static Task Messages_GetInlineGameHighScores(this Client client, InputBotInlineMessageIDBase id, InputUserBase user_id) @@ -2873,7 +2898,7 @@ namespace TL folder_id = folder_id, }); - /// If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the bot will receive an update. Use this method to reply to shipping queries. See [bots: ✓] Possible codes: 400 (details) + /// If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the bot will receive an update. Use this method to reply to shipping queries. See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Unique identifier for the query to be answered /// Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable"). Telegram will display this message to the user. /// A vector of available shipping options. @@ -2886,7 +2911,7 @@ namespace TL shipping_options = shipping_options, }); - /// Once the user has confirmed their payment and shipping details, the bot receives an update.
Use this method to respond to such pre-checkout queries.
Note: Telegram must receive an answer within 10 seconds after the pre-checkout query was sent. See [bots: ✓] Possible codes: 400 (details)
+ /// Once the user has confirmed their payment and shipping details, the bot receives an update.
Use this method to respond to such pre-checkout queries.
Note: Telegram must receive an answer within 10 seconds after the pre-checkout query was sent. See [bots: ✓ users: ✗] Possible codes: 400 (details)
/// Set this flag if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order, otherwise do not set it, and set the error field, instead /// Unique identifier for the query to be answered /// Required if the success isn't set. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user. @@ -2898,8 +2923,8 @@ namespace TL error = error, }); - /// Upload a file and associate it to a chat (without actually sending it to the chat) See [bots: ✓] Possible codes: -504,400,403 (details) - /// Whether the media will be used only in the specified business connection », and not directly by the bot. + /// Upload a file and associate it to a chat (without actually sending it to the chat) See [bots: ✓] Possible codes: 400,403 (details) + /// Whether the media will be used only in the specified business connection », and not directly by the bot. /// The chat, can be for bots and for users. /// File uploaded in chunks as described in files » /// a null value means messageMediaEmpty @@ -2943,7 +2968,7 @@ namespace TL unfave = unfave, }); - /// Get unread messages where we were mentioned See Possible codes: -504,400 (details) + /// Get unread messages where we were mentioned See Possible codes: 400 (details) /// Peer where to look for mentions /// If set, considers only messages within the specified forum topic /// Offsets for pagination, for more info click here @@ -2964,7 +2989,7 @@ namespace TL min_id = min_id, }); - /// Mark mentions as read See Possible codes: -504,400 (details) + /// Mark mentions as read See Possible codes: 400 (details) /// Dialog /// Mark as read only mentions within the specified forum topic public static Task Messages_ReadMentions(this Client client, InputPeer peer, int? top_msg_id = null) @@ -3017,7 +3042,7 @@ namespace TL allow_paid_stars = allow_paid_stars ?? default, }); - /// Upload encrypted file and associate it to a secret chat See Possible codes: 400 (details) + /// Upload encrypted file and associate it to a secret chat (without actually sending it to the chat). See Possible codes: 400 (details) /// The secret chat to associate the file to /// The file /// a null value means encryptedFileEmpty @@ -3049,6 +3074,7 @@ namespace TL /// Manually mark dialog as unread See Possible codes: 400 (details) /// Mark as unread/read + /// If set, must be equal to the ID of a monoforum, and will affect the monoforum topic passed in peer. /// Dialog public static Task Messages_MarkDialogUnread(this Client client, InputDialogPeerBase peer, InputPeer parent_peer = null, bool unread = false) => client.Invoke(new Messages_MarkDialogUnread @@ -3059,6 +3085,7 @@ namespace TL }); /// Get dialogs manually marked as unread See + /// Can be equal to the ID of a monoforum, to fetch monoforum topics manually marked as unread. public static Task Messages_GetDialogUnreadMarks(this Client client, InputPeer parent_peer = null) => client.Invoke(new Messages_GetDialogUnreadMarks { @@ -3228,7 +3255,7 @@ namespace TL /// Get scheduled messages See Possible codes: 400 (details) /// Peer - /// Hash used for caching, for more info click here.
To generate the hash, populate the ids array with the id, date and edit_date (in this order) of the previously returned messages (in order, i.e. ids = [id1, date1, edit_date1, id2, date2, edit_date2, ...]). + /// Hash used for caching, for more info click here.
To generate the hash, populate the ids array with the id, edit_date (0 if unedited) and date (in this order) of the previously returned messages (in order, i.e. ids = [id1, (edit_date1 ?? 0), date1, id2, (edit_date2 ?? 0), date2, ...]). public static Task Messages_GetScheduledHistory(this Client client, InputPeer peer, long hash = default) => client.Invoke(new Messages_GetScheduledHistory { @@ -3387,6 +3414,7 @@ namespace TL /// Unpin all pinned messages See [bots: ✓] Possible codes: 400 (details) /// Chat where to unpin /// Forum topic where to unpin + /// If set, must be equal to the ID of a monoforum topic, and will unpin all messages pinned in the passed monoforum topic. public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer, int? top_msg_id = null, InputPeer saved_peer_id = null) => client.InvokeAffected(new Messages_UnpinAllMessages { @@ -3572,8 +3600,9 @@ namespace TL peer = peer, }); - /// Change the chat theme of a certain chat See Possible codes: 400 (details) + /// Change the chat theme of a certain chat, see here » for more info. See Possible codes: 400 (details) /// Private chat where to change theme + /// The theme to set. public static Task Messages_SetChatTheme(this Client client, InputPeer peer, InputChatThemeBase theme) => client.Invoke(new Messages_SetChatTheme { @@ -3669,12 +3698,12 @@ namespace TL send_as = send_as, }); - /// React to message. See Possible codes: 400,403 (details) + /// React to message. See [bots: ✓] Possible codes: 400,403 (details) /// Whether a bigger and longer reaction should be shown /// Whether to add this reaction to the recent reactions list ». /// Peer /// Message ID to react to - /// A list of reactions + /// A list of reactions (doesn't accept s, use Messages_SendPaidReaction to send paid reactions, instead). public static Task Messages_SendReaction(this Client client, InputPeer peer, int msg_id, Reaction[] reaction = null, bool big = false, bool add_to_recent = false) => client.Invoke(new Messages_SendReaction { @@ -3761,6 +3790,7 @@ namespace TL /// Get unread reactions to messages you sent See Possible codes: 400 (details) /// Peer /// If set, considers only reactions to messages within the specified forum topic + /// If set, must be equal to the ID of a monoforum topic: will affect that topic in the monoforum passed in peer. /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination @@ -3783,6 +3813,7 @@ namespace TL /// Mark message reactions » as read See Possible codes: 400 (details) /// Peer /// Mark as read only reactions to messages within the specified forum topic + /// If set, must be equal to the ID of a monoforum topic: will affect that topic in the monoforum passed in peer. public static Task Messages_ReadReactions(this Client client, InputPeer peer, int? top_msg_id = null, InputPeer saved_peer_id = null) => client.InvokeAffected(new Messages_ReadReactions { @@ -3899,7 +3930,7 @@ namespace TL platform = platform, }); - /// This method is only for basic Chat. See Terminology in the README to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Terminate webview interaction started with Messages_RequestWebView, sending the specified message to the chat on behalf of the user. See [bots: ✓] Possible codes: 400 (details)
+ /// This method is only for basic Chat. See Terminology in the README to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Terminate webview interaction started with Messages_RequestWebView, sending the specified message to the chat on behalf of the user. See [bots: ✓ users: ✗] Possible codes: 400 (details)
/// Webview interaction ID obtained from Messages_RequestWebView /// Message to send public static Task Messages_SendWebViewResultMessage(this Client client, string bot_query_id, InputBotInlineResultBase result) @@ -4158,8 +4189,9 @@ namespace TL hash = hash, }); - /// Returns the current saved dialog list, see here » for more info. See + /// Returns the current saved dialog list » or monoforum topic list ». See /// Exclude pinned dialogs + /// If set, fetches the topic list of the passed monoforum, otherwise fetches the saved dialog list. /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here (top_message ID used for pagination) /// Offset peer for pagination @@ -4177,8 +4209,9 @@ namespace TL hash = hash, }); - /// Returns saved messages » forwarded from a specific peer See Possible codes: 400 (details) - /// Target peer + /// Fetch saved messages » forwarded from a specific peer, or fetch messages from a monoforum topic ». See Possible codes: 400 (details) + /// If set, fetches messages from the specified monoforum, otherwise fetches from saved messages. + /// Target peer (or topic) /// Only return messages starting from the specified message ID /// Only return messages sent before the specified date /// Number of list elements to be skipped, negative values are also accepted. @@ -4201,8 +4234,9 @@ namespace TL hash = hash, }); - /// Deletes messages forwarded from a specific peer to saved messages ». See Possible codes: 400 (details) - /// Peer, whose messages will be deleted from saved messages » + /// Deletes messages from a monoforum topic », or deletes messages forwarded from a specific peer to saved messages ». See Possible codes: 400 (details) + /// If set, affects the messages of the passed monoforum topic », otherwise affects saved messages ». + /// Peer, whose messages will be deleted from saved messages », or the ID of the topic. /// Maximum ID of message to delete /// Delete all messages newer than this UNIX timestamp /// Delete all messages older than this UNIX timestamp @@ -4331,7 +4365,7 @@ namespace TL /// This method is only for basic Chat. See Terminology in the README to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Fetch (a subset or all) messages in a quick reply shortcut ». See Possible codes: 400 (details)
/// Quick reply shortcut ID. /// IDs of the messages to fetch, if empty fetches all of them. - /// Hash used for caching, for more info click here + /// Hash for pagination, generated as specified here » (not the usual algorithm used for hash generation). public static Task Messages_GetQuickReplyMessages(this Client client, int shortcut_id, long hash = default, int[] id = null) => client.Invoke(new Messages_GetQuickReplyMessages { @@ -4452,12 +4486,12 @@ namespace TL platform = platform, }); - /// Sends one or more paid Telegram Star reactions », transferring Telegram Stars » to a channel's balance. See Possible codes: 400 (details) + /// Sends one or more paid Telegram Star reactions », transferring Telegram Stars » to a channel's balance. See Possible codes: 400,403 (details) /// The channel /// The message to react to /// The number of stars to send (each will increment the reaction counter by one). - /// Unique client message ID required to prevent message resending You can use - /// Each post with star reactions has a leaderboard with the top senders, but users can opt out of appearing there if they prefer more privacy.
If the user explicitly chose to make their paid reaction(s) private, pass to Messages_SendPaidReaction.private.
If the user explicitly chose to make their paid reaction(s) not private, pass to Messages_SendPaidReaction.private.
If the user did not make any explicit choice about the privacy of their paid reaction(s) (i.e. when reacting by clicking on an existing star reaction on a message), do not populate the Messages_SendPaidReaction.private flag. + /// Unique client message ID required to prevent message resending.
Note: this argument must be composed of a 64-bit integer where the first 32 bits are random, and the remaining 32 bits are equal to the current unixtime, i.e. uint64_t random_id = (time() << 32) | ((uint64_t)random_uint32_t()): this differs from the random_id format of all other methods in the API, which just take 64 random bits. You can use + /// Each post with star reactions has a leaderboard with the top senders, but users can opt out of appearing there if they prefer more privacy. Not populating this field will use the default reaction privacy, stored on the server and synced to clients using (see here for more info). public static Task Messages_SendPaidReaction(this Client client, InputPeer peer, int msg_id, int count, long random_id, PaidReactionPrivacy private_ = null) => client.Invoke(new Messages_SendPaidReaction { @@ -4487,7 +4521,7 @@ namespace TL { }); - /// Mark a specific sponsored message » as read See Possible codes: -504 (details) + /// Mark a specific sponsored message » as read See /// The ad's unique ID. public static Task Messages_ViewSponsoredMessage(this Client client, byte[] random_id) => client.Invoke(new Messages_ViewSponsoredMessage @@ -4518,6 +4552,7 @@ namespace TL /// Get a list of sponsored messages for a peer, see here » for more info. See Possible codes: 400 (details) /// The currently open channel/bot. + /// Must be set when fetching sponsored messages to show on channel videos ». /// a null value means messages.sponsoredMessagesEmpty public static Task Messages_GetSponsoredMessages(this Client client, InputPeer peer, int? msg_id = null) => client.Invoke(new Messages_GetSponsoredMessages @@ -4527,7 +4562,7 @@ namespace TL msg_id = msg_id ?? default, }); - /// Save a prepared inline message, to be shared by the user of the mini app using a web_app_send_prepared_message event See [bots: ✓] Possible codes: 400 (details) + /// Save a prepared inline message, to be shared by the user of the mini app using a web_app_send_prepared_message event See [bots: ✓ users: ✗] Possible codes: 400 (details) /// The message /// The user to whom the web_app_send_prepared_message event event will be sent /// Types of chats where this message can be sent @@ -4571,7 +4606,9 @@ namespace TL }); /// Used for Telegram Gateway verification messages »: indicate to the server that one or more s were received by the client, if requested by the .report_delivery_until_date flag or the equivalent flag in push notifications. See Possible codes: 400 (details) - /// If set, + /// Must be set if the messages were received from a push notification. + /// The peer where the messages were received. + /// The IDs of the received messages. public static Task Messages_ReportMessagesDelivery(this Client client, InputPeer peer, int[] id, bool push = false) => client.Invoke(new Messages_ReportMessagesDelivery { @@ -4580,7 +4617,9 @@ namespace TL id = id, }); - /// See + /// Obtain information about specific saved message dialogs » or monoforum topics ». See + /// If set, fetches monoforum topics », otherwise fetches saved message dialogs ». + /// IDs of dialogs (topics) to fetch. public static Task Messages_GetSavedDialogsByID(this Client client, InputPeer[] ids, InputPeer parent_peer = null) => client.Invoke(new Messages_GetSavedDialogsByID { @@ -4589,7 +4628,10 @@ namespace TL ids = ids, }); - /// See Possible codes: 400 (details) + /// Mark messages as read in a monoforum topic ». See Possible codes: 400 (details) + /// ID of the monoforum group. + /// ID of the topic. + /// If a positive value is passed, only messages with identifiers less or equal than the given one will be read. public static Task Messages_ReadSavedHistory(this Client client, InputPeer parent_peer, InputPeer peer, int max_id = default) => client.Invoke(new Messages_ReadSavedHistory { @@ -4598,7 +4640,11 @@ namespace TL max_id = max_id, }); - /// See Possible codes: 400 (details) + /// Mark one or more items of a todo list » as completed or not completed. See Possible codes: 400 (details) + /// Peer where the todo list was posted. + /// ID of the message with the todo list. + /// Items to mark as completed. + /// Items to mark as not completed. public static Task Messages_ToggleTodoCompleted(this Client client, InputPeer peer, int msg_id, int[] completed, params int[] incompleted) => client.Invoke(new Messages_ToggleTodoCompleted { @@ -4608,7 +4654,10 @@ namespace TL incompleted = incompleted, }); - /// See Possible codes: 400 (details) + /// Appends one or more items to a todo list ». See Possible codes: 400 (details) + /// Peer where the todo list was posted. + /// ID of the message with the todo list. + /// Items to append. public static Task Messages_AppendTodoList(this Client client, InputPeer peer, int msg_id, params TodoItem[] list) => client.Invoke(new Messages_AppendTodoList { @@ -4617,7 +4666,12 @@ namespace TL list = list, }); - /// See Possible codes: 400 (details) + /// Approve or reject a suggested post ». See [bots: ✓] Possible codes: 400 (details) + /// Reject the suggested post. + /// Both for users and channels, must contain the ID of the direct messages monoforum » (for channels, the topic ID is extracted automatically from the msg_id). + /// ID of the suggestion message. + /// Custom scheduling date. + /// Optional comment for rejections (can only be used if reject is set). public static Task Messages_ToggleSuggestedPostApproval(this Client client, InputPeer peer, int msg_id, DateTime? schedule_date = null, string reject_comment = null, bool reject = false) => client.Invoke(new Messages_ToggleSuggestedPostApproval { @@ -4628,13 +4682,13 @@ namespace TL reject_comment = reject_comment, }); - /// Returns a current state of updates. See [bots: ✓] Possible codes: -504 (details) + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState { }); - /// Get new updates. See [bots: ✓] Possible codes: -504,400,403,500 (details) + /// Get new updates. See [bots: ✓] Possible codes: 400,403,500 (details) /// PTS, see updates. /// PTS limit /// For fast updating: if provided and pts + pts_total_limit < remote pts, will be returned.
Simply tells the server to not return the difference if it is bigger than pts_total_limit
If the remote pts is too big (> ~4000000), this field will default to 1000000 @@ -4653,7 +4707,7 @@ namespace TL qts_limit = qts_limit ?? default, }); - /// Returns the difference between the current state of updates of a certain channel and transmitted. See [bots: ✓] Possible codes: -504,400,403,406,500 (details) + /// Returns the difference between the current state of updates of a certain channel and transmitted. See [bots: ✓] Possible codes: 400,403,406,500 (details) /// Set to true to skip some possibly unneeded updates and reduce server-side load /// The channel /// Messsage filter @@ -4710,7 +4764,7 @@ namespace TL /// Returns the list of user photos. See [bots: ✓] Possible codes: 400 (details) /// User ID /// Number of list elements to be skipped - /// If a positive value was transferred, the method will return only photos with IDs less than the set one. This parameter is often useful when refetching file references », as in conjuction with limit=1 and offset=-1 the object with the id specified in max_id can be fetched. + /// If a positive value was transferred, the method will return only photos with IDs less than the set one. This parameter is often useful when refetching file references », as in conjuction with limit=1 and offset=-1 the object with the id specified in max_id can be fetched. /// Number of list elements to be returned public static Task Photos_GetUserPhotos(this Client client, InputUserBase user_id, int offset = default, long max_id = default, int limit = int.MaxValue) => client.Invoke(new Photos_GetUserPhotos @@ -4815,7 +4869,7 @@ namespace TL request_token = request_token, }); - /// Get SHA256 hashes for verifying downloaded CDN files See [bots: ✓] Possible codes: -504,400 (details) + /// Get SHA256 hashes for verifying downloaded CDN files See [bots: ✓] Possible codes: 400 (details) /// File /// Offset from which to start getting hashes public static Task Upload_GetCdnFileHashes(this Client client, byte[] file_token, long offset = default) @@ -4835,7 +4889,7 @@ namespace TL offset = offset, }); - /// Returns current configuration, including data center configuration. See [bots: ✓] Possible codes: -504,400,403 (details) + /// Returns current configuration, including data center configuration. See [bots: ✓] Possible codes: 400,403 (details) public static Task Help_GetConfig(this Client client) => client.Invoke(new Help_GetConfig { @@ -4868,7 +4922,7 @@ namespace TL { }); - /// Informs the server about the number of pending bot updates if they haven't been processed for a long time; for bots only See [bots: ✓] Possible codes: 400 (details) + /// Informs the server about the number of pending bot updates if they haven't been processed for a long time; for bots only See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Number of pending updates /// Error message, if present public static Task Help_SetBotUpdatesStatus(this Client client, int pending_updates_count, string message) @@ -4878,7 +4932,7 @@ namespace TL message = message, }); - /// Get configuration for CDN file downloads. See [bots: ✓] Possible codes: -504 (details) + /// Get configuration for CDN file downloads. See [bots: ✓] public static Task Help_GetCdnConfig(this Client client) => client.Invoke(new Help_GetCdnConfig { @@ -4969,7 +5023,7 @@ namespace TL entities = entities, }); - /// Get MTProxy/Public Service Announcement information See + /// Returns a set of useful suggestions and PSA/MTProxy sponsored peers, see here » for more info. See public static Task Help_GetPromoData(this Client client) => client.Invoke(new Help_GetPromoData { @@ -5037,7 +5091,7 @@ namespace TL hash = hash, }); - /// Mark channel/supergroup history as read See Possible codes: -504,400,406 (details) + /// Mark channel/supergroup history as read See Possible codes: 400,406 (details) /// Channel/supergroup /// ID of message up to which messages should be marked as read public static Task Channels_ReadHistory(this Client client, InputChannelBase channel, int max_id = default) @@ -5069,7 +5123,7 @@ namespace TL id = id, }); - /// Get channel/supergroup messages See [bots: ✓] Possible codes: -504,400,406 (details) + /// Get channel/supergroup messages See [bots: ✓] Possible codes: 400,406 (details) /// Channel/supergroup /// IDs of messages to get public static Task Channels_GetMessages(this Client client, InputChannelBase channel, params InputMessage[] id) @@ -5079,7 +5133,7 @@ namespace TL id = id, }); - /// Get the participants of a supergroup/channel See [bots: ✓] Possible codes: -504,400,403,406 (details) + /// Get the participants of a supergroup/channel See [bots: ✓] Possible codes: 400,403,406 (details) /// Channel /// Which participant types to fetch /// Offset @@ -5106,7 +5160,7 @@ namespace TL participant = participant, }); - /// Get info about channels/supergroups See [bots: ✓] Possible codes: -504,400,406 (details) + /// Get info about channels/supergroups See [bots: ✓] Possible codes: 400,406 (details) /// IDs of channels/supergroups to get info about public static Task Channels_GetChannels(this Client client, params InputChannelBase[] id) => client.Invoke(new Channels_GetChannels @@ -5114,7 +5168,7 @@ namespace TL id = id, }); - /// Get full info about a supergroup, gigagroup or channel See [bots: ✓] Possible codes: -504,400,403,406 (details) + /// Get full info about a supergroup, gigagroup or channel See [bots: ✓] Possible codes: 400,403,406 (details) /// The channel, supergroup or gigagroup to get info about public static Task Channels_GetFullChannel(this Client client, InputChannelBase channel) => client.Invoke(new Channels_GetFullChannel @@ -5197,7 +5251,7 @@ namespace TL username = username, }); - /// Join a channel/supergroup See Possible codes: -504,400,406,420 (details) + /// Join a channel/supergroup See Possible codes: 400,406,420 (details) /// Channel/supergroup to join public static Task Channels_JoinChannel(this Client client, InputChannelBase channel) => client.Invoke(new Channels_JoinChannel @@ -5308,7 +5362,7 @@ namespace TL stickerset = stickerset, }); - /// Mark channel/supergroup message contents as read See Possible codes: 400,406 (details) + /// Mark channel/supergroup message contents as read, emitting an . See Possible codes: 400,406 (details) /// Channel/supergroup /// IDs of messages whose contents should be marked as read public static Task Channels_ReadMessageContents(this Client client, InputChannelBase channel, params int[] id) @@ -5413,6 +5467,7 @@ namespace TL }); /// Obtains a list of peers that can be used to send messages in a specific group See Possible codes: 400 (details) + /// If set, fetches the list of peers that can be used to send paid reactions to messages of a specific peer. /// The group where we intend to send messages public static Task Channels_GetSendAs(this Client client, InputPeer peer, bool for_paid_reactions = false) => client.Invoke(new Channels_GetSendAs @@ -5484,6 +5539,7 @@ namespace TL /// Enable or disable forum functionality in a supergroup. See Possible codes: 400 (details) /// Supergroup ID /// Enable or disable forum functionality + /// If true enables the tabbed forum UI, otherwise enables the list-based forum UI. public static Task Channels_ToggleForum(this Client client, InputChannelBase channel, bool enabled, bool tabs) => client.Invoke(new Channels_ToggleForum { @@ -5647,7 +5703,7 @@ namespace TL enabled = enabled, }); - /// Obtain a list of similarly themed public channels, selected based on similarities in their subscriber bases. See Possible codes: -504,400 (details) + /// Obtain a list of similarly themed public channels, selected based on similarities in their subscriber bases. See Possible codes: 400 (details) /// The method will return channels related to the passed channel. If not set, the method will returns channels related to channels the user has joined. public static Task Channels_GetChannelRecommendations(this Client client, InputChannelBase channel = null) => client.Invoke(new Channels_GetChannelRecommendations @@ -5696,12 +5752,14 @@ namespace TL restricted = restricted, }); - /// Globally search for posts from public channels » (including those we aren't a member of) containing a specific hashtag. See Possible codes: 420 (details) + /// Globally search for posts from public channels » (including those we aren't a member of) containing either a specific hashtag, or a full text query. See Possible codes: 420 (details) /// The hashtag to search, without the # character. - /// Initially 0, then set to the next_rate parameter of messages.messagesSlice + /// The full text query: each user has a limited amount of free full text search slots, after which payment is required, see here » for more info on the full flow. + /// Initially 0, then set to the next_rate parameter of messages.messagesSlice, or if that is absent, the date of the last returned message. /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination + /// For full text post searches (query), allows payment of the specified amount of Stars for the search, see here » for more info on the full flow. public static Task Channels_SearchPosts(this Client client, int offset_rate = default, InputPeer offset_peer = null, int offset_id = default, int limit = int.MaxValue, string hashtag = null, string query = null, long? allow_paid_stars = null) => client.Invoke(new Channels_SearchPosts { @@ -5715,8 +5773,8 @@ namespace TL allow_paid_stars = allow_paid_stars ?? default, }); - /// Enable or disable paid messages » in this supergroup or monoforum. See Possible codes: 400 (details) - /// Only usable for channels, enables or disables the associated monoforum aka direct messages. + /// Enable or disable paid messages » in this supergroup or monoforum. See Possible codes: 400 (details) + /// 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) @@ -5727,7 +5785,9 @@ namespace TL send_paid_messages_stars = send_paid_messages_stars, }); - /// See Possible codes: 400 (details) + /// Toggle autotranslation in a channel, for all users: see here » for more info. See Possible codes: 400 (details) + /// The channel where to toggle autotranslation. + /// Whether to enable or disable autotranslation. public static Task Channels_ToggleAutotranslation(this Client client, InputChannelBase channel, bool enabled) => client.Invoke(new Channels_ToggleAutotranslation { @@ -5735,7 +5795,9 @@ namespace TL enabled = enabled, }); - /// See Possible codes: 400 (details) + /// Can only be invoked by non-bot admins of a monoforum », obtains the original sender of a message sent by other monoforum admins to the monoforum, on behalf of the channel associated to the monoforum. See Possible codes: 400 (details) + /// ID of the monoforum. + /// ID of the message sent by a monoforum admin. public static Task Channels_GetMessageAuthor(this Client client, InputChannelBase channel, int id) => client.Invoke(new Channels_GetMessageAuthor { @@ -5743,7 +5805,8 @@ namespace TL id = id, }); - /// See + /// Check if the specified global post search » requires payment. See + /// The query. public static Task Channels_CheckSearchPostsFlood(this Client client, string query = null) => client.Invoke(new Channels_CheckSearchPostsFlood { @@ -5751,7 +5814,9 @@ namespace TL query = query, }); - /// See + /// Changes the main profile tab of a channel, see here » for more info. See Possible codes: 400 (details) + /// The channel. + /// The tab to set as main tab. public static Task Channels_SetMainProfileTab(this Client client, InputChannelBase channel, ProfileTab tab) => client.Invoke(new Channels_SetMainProfileTab { @@ -5759,7 +5824,7 @@ namespace TL tab = tab, }); - /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) + /// Sends a custom request; for bots only See [bots: ✓ users: ✗] Possible codes: 400 (details) /// The method name /// JSON-serialized method parameters public static Task Bots_SendCustomRequest(this Client client, string custom_method, DataJSON params_) @@ -5769,7 +5834,7 @@ namespace TL params_ = params_, }); - /// Answers a custom query; for bots only See [bots: ✓] Possible codes: 400,403 (details) + /// Answers a custom query; for bots only See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Identifier of a custom query /// JSON-serialized answer to the query public static Task Bots_AnswerWebhookJSONQuery(this Client client, long query_id, DataJSON data) @@ -5779,7 +5844,7 @@ namespace TL data = data, }); - /// Set bot command list See [bots: ✓] Possible codes: 400 (details) + /// Set bot command list See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Command scope /// Language code /// Bot commands @@ -5791,7 +5856,7 @@ namespace TL commands = commands, }); - /// Clear bot commands for the specified bot scope and language code See [bots: ✓] Possible codes: 400 (details) + /// Clear bot commands for the specified bot scope and language code See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Command scope /// Language code public static Task Bots_ResetBotCommands(this Client client, BotCommandScope scope, string lang_code) @@ -5801,7 +5866,7 @@ namespace TL lang_code = lang_code, }); - /// Obtain a list of bot commands for the specified bot scope and language code See [bots: ✓] Possible codes: 400 (details) + /// Obtain a list of bot commands for the specified bot scope and language code See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Command scope /// Language code public static Task Bots_GetBotCommands(this Client client, BotCommandScope scope, string lang_code) @@ -5811,7 +5876,7 @@ namespace TL lang_code = lang_code, }); - /// Sets the menu button action » for a given user or for all users See [bots: ✓] Possible codes: 400 (details) + /// Sets the menu button action » for a given user or for all users See [bots: ✓ users: ✗] Possible codes: 400 (details) /// User ID /// Bot menu button action public static Task Bots_SetBotMenuButton(this Client client, InputUserBase user_id, BotMenuButtonBase button) @@ -5821,7 +5886,7 @@ namespace TL button = button, }); - /// Gets the menu button action for a given user or for all users, previously set using Bots_SetBotMenuButton; users can see this information in the . See [bots: ✓] Possible codes: 400 (details) + /// Gets the menu button action for a given user or for all users, previously set using Bots_SetBotMenuButton; users can see this information in the . See [bots: ✓ users: ✗] Possible codes: 400 (details) /// User ID or empty for the default menu button. /// a null value means botMenuButtonDefault public static Task Bots_GetBotMenuButton(this Client client, InputUserBase user_id) @@ -5830,7 +5895,7 @@ namespace TL user_id = user_id, }); - /// Set the default suggested admin rights for bots being added as admins to channels, see here for more info on how to handle them ». See [bots: ✓] Possible codes: 400 (details) + /// Set the default suggested admin rights for bots being added as admins to channels, see here for more info on how to handle them ». See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Admin rights public static Task Bots_SetBotBroadcastDefaultAdminRights(this Client client, ChatAdminRights admin_rights) => client.Invoke(new Bots_SetBotBroadcastDefaultAdminRights @@ -5838,7 +5903,7 @@ namespace TL admin_rights = admin_rights, }); - /// Set the default suggested admin rights for bots being added as admins to groups, see here for more info on how to handle them ». See [bots: ✓] Possible codes: 400 (details) + /// Set the default suggested admin rights for bots being added as admins to groups, see here for more info on how to handle them ». See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Admin rights public static Task Bots_SetBotGroupDefaultAdminRights(this Client client, ChatAdminRights admin_rights) => client.Invoke(new Bots_SetBotGroupDefaultAdminRights @@ -6002,7 +6067,7 @@ namespace TL bot = bot, }); - /// Change the emoji status of a user (invoked by bots, see here » for more info on the full flow) See [bots: ✓] Possible codes: 400 (details) + /// Change the emoji status of a user (invoked by bots, see here » for more info on the full flow) See [bots: ✓ users: ✗] Possible codes: 400,403 (details) /// The user whose emoji status should be changed /// The emoji status public static Task Bots_UpdateUserEmojiStatus(this Client client, InputUserBase user_id, EmojiStatusBase emoji_status) @@ -6053,7 +6118,7 @@ namespace TL duration_months = duration_months ?? default, }); - /// Verify a user or chat on behalf of an organization ». See [bots: ✓] Possible codes: 400 (details) + /// Verify a user or chat on behalf of an organization ». See [bots: ✓] Possible codes: 400,403 (details) /// If set, adds the verification; otherwise removes verification. /// Must not be set if invoked by a bot, must be set to the ID of an owned bot if invoked by a user. /// The peer to verify @@ -6075,7 +6140,7 @@ namespace TL bot = bot, }); - /// Get a payment form See Possible codes: 400,403,406 (details) + /// Get a payment form See [bots: ✓] Possible codes: 400,403,406 (details) /// Invoice /// Theme parameters » public static Task Payments_GetPaymentForm(this Client client, InputInvoice invoice, DataJSON theme_params = null) @@ -6150,7 +6215,7 @@ namespace TL number = number, }); - /// Generate an invoice deep link See [bots: ✓] Possible codes: 400 (details) + /// Generate an invoice deep link See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Invoice public static Task Payments_ExportInvoice(this Client client, InputMedia invoice_media) => client.Invoke(new Payments_ExportInvoice @@ -6232,6 +6297,7 @@ namespace TL }); /// Get the current Telegram Stars balance of the current account (with peer=), or the stars balance of the bot specified in peer. See Possible codes: 400,403 (details) + /// If set, returns the channel/ad revenue balance in nanotons. /// Peer of which to get the balance. public static Task Payments_GetStarsStatus(this Client client, InputPeer peer, bool ton = false) => client.Invoke(new Payments_GetStarsStatus @@ -6244,6 +6310,7 @@ namespace TL /// If set, fetches only incoming transactions. /// If set, fetches only outgoing transactions. /// Return transactions in ascending order by date (instead of descending order by date). + /// If set, returns the channel/ad revenue transactions in nanotons, instead. /// If set, fetches only transactions for the specified Telegram Star subscription ». /// Fetch the transaction history of the peer ( or a bot we own). /// Offset for pagination, obtained from the returned next_offset, initially an empty string ». @@ -6258,7 +6325,7 @@ namespace TL limit = limit, }); - /// Make a payment using Telegram Stars, see here » for more info. See Possible codes: 400,403,406 (details) + /// Make a payment using Telegram Stars, see here » for more info. See [bots: ✓] Possible codes: 400,403,406 (details) /// Payment form ID /// Invoice public static Task Payments_SendStarsForm(this Client client, long form_id, InputInvoice invoice) @@ -6268,7 +6335,7 @@ namespace TL invoice = invoice, }); - /// Refund a Telegram Stars transaction, see here » for more info. See [bots: ✓] Possible codes: 400 (details) + /// Refund a Telegram Stars transaction, see here » for more info. See [bots: ✓ users: ✗] Possible codes: 400 (details) /// User to refund. /// Transaction ID. public static Task Payments_RefundStarsCharge(this Client client, InputUserBase user_id, string charge_id) @@ -6280,6 +6347,7 @@ namespace TL /// Get Telegram Star revenue statistics ». See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors + /// If set, fetches channel/bot ad revenue statistics in TON. /// Get statistics for the specified bot, channel or ourselves (). public static Task Payments_GetStarsRevenueStats(this Client client, InputPeer peer, bool dark = false, bool ton = false) => client.Invoke(new Payments_GetStarsRevenueStats @@ -6288,8 +6356,10 @@ namespace TL peer = peer, }); - /// Withdraw funds from a channel or bot's star balance ». See Possible codes: 400 (details) + /// Withdraw funds from a channel or bot's star balance ». See Possible codes: 400 (details) + /// If set, withdraws channel/ad revenue in TON. /// Channel or bot from which to withdraw funds. + /// The amount of stars or nanotons to withdraw. /// 2FA password, see here » for more info. public static Task Payments_GetStarsRevenueWithdrawalUrl(this Client client, InputPeer peer, InputCheckPasswordSRP password, long? amount = null, bool ton = false) => client.Invoke(new Payments_GetStarsRevenueWithdrawalUrl @@ -6309,6 +6379,7 @@ namespace TL }); /// Obtain info about Telegram Star transactions » using specific transaction IDs. See Possible codes: 400 (details) + /// If set, returns channel/bot ad revenue transactions in nanotons. /// Channel or bot. /// Transaction IDs. public static Task Payments_GetStarsTransactionsByID(this Client client, InputPeer peer, InputStarsTransaction[] id, bool ton = false) @@ -6369,7 +6440,7 @@ namespace TL { }); - /// Get a list of available gifts, see here » for more info. See + /// Get a list of available gifts, see here » for more info. See [bots: ✓] /// Hash used for caching, for more info click here.
The hash may be generated locally by using the ids of the returned or stored sticker s. /// a null value means payments.starGiftsNotModified public static Task Payments_GetStarGifts(this Client client, int hash = default) @@ -6380,6 +6451,7 @@ namespace TL /// Display or remove a received gift » from our profile. See Possible codes: 400 (details) /// If set, hides the gift from our profile. + /// The gift to display or remove. public static Task Payments_SaveStarGift(this Client client, InputSavedStarGift stargift, bool unsave = false) => client.Invoke(new Payments_SaveStarGift { @@ -6388,6 +6460,7 @@ namespace TL }); /// Convert a received gift » into Telegram Stars: this will permanently destroy the gift, converting it into .convert_stars Telegram Stars, added to the user's balance. See Possible codes: 400 (details) + /// The gift to convert. public static Task Payments_ConvertStarGift(this Client client, InputSavedStarGift stargift) => client.Invoke(new Payments_ConvertStarGift { @@ -6476,7 +6549,9 @@ namespace TL gift_id = gift_id, }); - /// See Possible codes: 400 (details) + /// Upgrade a gift to a collectible gift: can only be used if the upgrade was already paid by the gift sender; see here » for more info on the full flow (including the different flow to use in case the upgrade was not paid by the gift sender). See Possible codes: 400 (details) + /// Set this flag to keep the original gift text, sender and receiver in the upgraded gift as a attribute. + /// The gift to upgrade public static Task Payments_UpgradeStarGift(this Client client, InputSavedStarGift stargift, bool keep_original_details = false) => client.Invoke(new Payments_UpgradeStarGift { @@ -6484,7 +6559,9 @@ namespace TL stargift = stargift, }); - /// See Possible codes: 400 (details) + /// Transfer a collectible gift to another user or channel: can only be used if transfer is free (i.e. .transfer_stars is not set); see here » for more info on the full flow (including the different flow to use in case the transfer isn't free). See Possible codes: 400 (details) + /// The gift to transfer. + /// Destination peer. public static Task Payments_TransferStarGift(this Client client, InputSavedStarGift stargift, InputPeer to_id) => client.Invoke(new Payments_TransferStarGift { @@ -6492,14 +6569,25 @@ namespace TL to_id = to_id, }); - /// See Possible codes: 400 (details) + /// Obtain info about a collectible gift » using a slug obtained from a collectible gift link ». See Possible codes: 400 (details) + /// The slug. public static Task Payments_GetUniqueStarGift(this Client client, string slug) => client.Invoke(new Payments_GetUniqueStarGift { slug = slug, }); - /// See Possible codes: 400 (details) + /// Fetch the full list of gifts owned by a peer. See Possible codes: 400 (details) + /// Exclude gifts not pinned on the profile. + /// Exclude gifts pinned on the profile. + /// Exclude gifts that do not have the .limited flag set. + /// Exclude collectible gifts ». + /// If set, sorts the gifts by price instead of reception date. + /// Exclude gifts that can be upgraded to collectible gifts ». + /// Exclude gifts that cannot be upgraded to collectible gifts ». + /// Fetch only gifts owned by the specified peer, such as: a user, with peer=; a channel, with peer=; a connected business user (when executing the method as a bot, over the business connection), with peer=. + /// Only returns gifts within the specified collection ». + /// Offset for pagination. /// Maximum number of results to return, see pagination 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_unique = false, bool sort_by_value = false, bool exclude_upgradable = false, bool exclude_unupgradable = false) => client.Invoke(new Payments_GetSavedStarGifts @@ -6511,14 +6599,17 @@ namespace TL limit = limit, }); - /// See Possible codes: 400 (details) + /// Fetch info about specific gifts owned by a peer we control. See Possible codes: 400 (details) + /// List of gifts to fetch info about. public static Task Payments_GetSavedStarGift(this Client client, params InputSavedStarGift[] stargift) => client.Invoke(new Payments_GetSavedStarGift { stargift = stargift, }); - /// See Possible codes: 400 (details) + /// Convert a collectible gift » to an NFT on the TON blockchain. See Possible codes: 400 (details) + /// The collectible gift to export. + /// The current user's 2FA password, passed as specified here ». public static Task Payments_GetStarGiftWithdrawalUrl(this Client client, InputSavedStarGift stargift, InputCheckPasswordSRP password) => client.Invoke(new Payments_GetStarGiftWithdrawalUrl { @@ -6526,7 +6617,9 @@ namespace TL password = password, }); - /// See Possible codes: 400 (details) + /// Enables or disables the reception of notifications every time a gift » is received by the specified channel, can only be invoked by admins with post_messages admin rights. See Possible codes: 400 (details) + /// Whether to enable or disable reception of notifications in the form of and service messages from the channel. + /// The channel for which to receive or not receive notifications. public static Task Payments_ToggleChatStarGiftNotifications(this Client client, InputPeer peer, bool enabled = false) => client.Invoke(new Payments_ToggleChatStarGiftNotifications { @@ -6534,7 +6627,9 @@ namespace TL peer = peer, }); - /// See Possible codes: 400 (details) + /// Pins a received gift on top of the profile of the user or owned channels by using Payments_ToggleStarGiftsPinnedToTop. See Possible codes: 400 (details) + /// The peer where to pin the gift. + /// The gift to pin. public static Task Payments_ToggleStarGiftsPinnedToTop(this Client client, InputPeer peer, params InputSavedStarGift[] stargift) => client.Invoke(new Payments_ToggleStarGiftsPinnedToTop { @@ -6542,14 +6637,21 @@ namespace TL stargift = stargift, }); - /// See Possible codes: 406 (details) + /// Checks whether a purchase is possible. Must be called before in-store purchase, official apps only. See Possible codes: 400,406 (details) + /// Payment purpose. public static Task Payments_CanPurchaseStore(this Client client, InputStorePaymentPurpose purpose) => client.Invoke(new Payments_CanPurchaseStore { purpose = purpose, }); - /// See Possible codes: -504,400 (details) + /// Get collectible gifts of a specific type currently on resale, see here » for more info. See Possible codes: 400 (details) + /// Sort gifts by price (ascending). + /// Sort gifts by number (ascending). + /// If a previous call to the method was made and .attributes_hash was set, pass it here to avoid returning any results if they haven't changed. + /// Mandatory identifier of the base gift from which the collectible gift was upgraded. + /// Optionally filter gifts with the specified attributes. If no attributes of a specific type are specified, all attributes of that type are allowed. + /// Offset for pagination. /// Maximum number of results to return, see pagination public static Task Payments_GetResaleStarGifts(this Client client, long gift_id, string offset, int limit = int.MaxValue, long? attributes_hash = null, StarGiftAttributeId[] attributes = null, bool sort_by_price = false, bool sort_by_num = false) => client.Invoke(new Payments_GetResaleStarGifts @@ -6562,7 +6664,9 @@ namespace TL limit = limit, }); - /// See Possible codes: 400 (details) + /// A collectible gift we own » can be put up for sale on the gift marketplace » with this method, see here » for more info. See Possible codes: 400 (details) + /// The gift to resell. + /// Resale price of the gift. public static Task Payments_UpdateStarGiftPrice(this Client client, InputSavedStarGift stargift, StarsAmountBase resell_amount) => client.Invoke(new Payments_UpdateStarGiftPrice { @@ -6570,7 +6674,10 @@ namespace TL resell_amount = resell_amount, }); - /// See Possible codes: 400 (details) + /// Create a star gift collection ». See Possible codes: 400 (details) + /// Peer where to create the collection. + /// Title of the collection. + /// Gifts added to the collection. public static Task Payments_CreateStarGiftCollection(this Client client, InputPeer peer, string title, params InputSavedStarGift[] stargift) => client.Invoke(new Payments_CreateStarGiftCollection { @@ -6579,7 +6686,13 @@ namespace TL stargift = stargift, }); - /// See Possible codes: 400 (details) + /// Add or remove gifts from a star gift collection », or rename the collection. See Possible codes: 400 (details) + /// Peer that owns the collection. + /// Collection ID. + /// Title of the collection, to rename the collection. + /// Can contain a list of gifts to remove from the collection. + /// Can contain a list of gifts to add to the collection. + /// Can contain the new gift order. 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 { @@ -6592,7 +6705,9 @@ namespace TL order = order, }); - /// See Possible codes: 400 (details) + /// Reorder the star gift collections » on an owned peer's profile. See Possible codes: 400 (details) + /// The owned peer. + /// New collection order. public static Task Payments_ReorderStarGiftCollections(this Client client, InputPeer peer, params int[] order) => client.Invoke(new Payments_ReorderStarGiftCollections { @@ -6600,7 +6715,9 @@ namespace TL order = order, }); - /// See Possible codes: 400 (details) + /// Delete a star gift collection ». See Possible codes: 400 (details) + /// Peer that owns the collection. + /// ID of the collection. public static Task Payments_DeleteStarGiftCollection(this Client client, InputPeer peer, int collection_id) => client.Invoke(new Payments_DeleteStarGiftCollection { @@ -6608,7 +6725,9 @@ namespace TL collection_id = collection_id, }); - /// See Possible codes: 400 (details) + /// Fetches all star gift collections » of a peer. See Possible codes: 400 (details) + /// The peer. + /// Hash (generated as specified here ») using the .hash field (not the collection_id field) of all collections returned by a previous method call, to avoid refetching the result if it hasn't changed. /// a null value means payments.starGiftCollectionsNotModified public static Task Payments_GetStarGiftCollections(this Client client, InputPeer peer, long hash = default) => client.Invoke(new Payments_GetStarGiftCollections @@ -6617,14 +6736,16 @@ namespace TL hash = hash, }); - /// See + /// Get information about the value of a collectible gift ». See Possible codes: 400 (details) + /// slug from a . public static Task Payments_GetUniqueStarGiftValueInfo(this Client client, string slug) => client.Invoke(new Payments_GetUniqueStarGiftValueInfo { slug = slug, }); - /// See + /// Check if the specified gift » can be sent. See Possible codes: 400 (details) + /// Gift ID. public static Task Payments_CheckCanSendGift(this Client client, long gift_id) => client.Invoke(new Payments_CheckCanSendGift { @@ -6767,7 +6888,7 @@ namespace TL { }); - /// Start a telegram phone call See Possible codes: 400,403,500 (details) + /// Start a telegram phone call See Possible codes: 400,403 (details) /// Whether to start a video call /// Destination of the phone call /// Random ID to avoid resending the same object @@ -6889,6 +7010,8 @@ namespace TL /// The group call /// Join the group call, presenting yourself as the specified user/channel /// The invitation hash from the invite link », if provided allows speaking in a livestream or muted group chat. + /// For conference calls, your public key. + /// The block containing an appropriate e2e.chain.changeSetGroupState event. /// WebRTC parameters public static Task Phone_JoinGroupCall(this Client client, InputGroupCallBase call, InputPeer join_as, DataJSON params_, string invite_hash = null, Int256? public_key = null, byte[] block = null, bool muted = false, bool video_stopped = false) => client.Invoke(new Phone_JoinGroupCall @@ -7136,7 +7259,12 @@ namespace TL params_ = params_, }); - /// See Possible codes: 400 (details) + /// Remove participants from a conference call. See Possible codes: 400 (details) + /// Whether this is a removal of members that already left the conference call. + /// Whether this is a forced removal of active members in a conference call. + /// The conference call. + /// IDs of users to remove. + /// The block containing an appropriate e2e.chain.changeSetGroupState event public static Task Phone_DeleteConferenceCallParticipants(this Client client, InputGroupCallBase call, long[] ids, byte[] block, bool only_left = false, bool kick = false) => client.Invoke(new Phone_DeleteConferenceCallParticipants { @@ -7146,7 +7274,9 @@ namespace TL block = block, }); - /// See Possible codes: 400 (details) + /// Broadcast a blockchain block to all members of a conference call, see here » for more info. See Possible codes: 400 (details) + /// The conference where to broadcast the block. + /// The block to broadcast. public static Task Phone_SendConferenceCallBroadcast(this Client client, InputGroupCallBase call, byte[] block) => client.Invoke(new Phone_SendConferenceCallBroadcast { @@ -7154,7 +7284,10 @@ namespace TL block = block, }); - /// See Possible codes: 400 (details) + /// Invite a user to a conference call. See Possible codes: 400 (details) + /// Invite the user to also turn on their video feed. + /// The conference call. + /// The user to invite. public static Task Phone_InviteConferenceCallParticipant(this Client client, InputGroupCallBase call, InputUserBase user_id, bool video = false) => client.Invoke(new Phone_InviteConferenceCallParticipant { @@ -7163,15 +7296,19 @@ namespace TL user_id = user_id, }); - /// See Possible codes: 400 (details) + /// Declines a conference call invite. See Possible codes: 400 (details) + /// The ID of the to decline. public static Task Phone_DeclineConferenceCallInvite(this Client client, int msg_id) => client.Invoke(new Phone_DeclineConferenceCallInvite { msg_id = msg_id, }); - /// See Possible codes: 400 (details) - /// Maximum number of results to return, see pagination + /// Fetch the blocks of a conference blockchain ». See Possible codes: 400 (details) + /// The conference. + /// Subchain ID. + /// Offset for pagination. + /// Maximum number of blocks to return in this call, see pagination public static Task Phone_GetGroupCallChainBlocks(this Client client, InputGroupCallBase call, int sub_chain_id, int offset = default, int limit = int.MaxValue) => client.Invoke(new Phone_GetGroupCallChainBlocks { @@ -7439,7 +7576,7 @@ namespace TL peer = peer, }); - /// Uploads a Telegram Story. See Possible codes: 400 (details) + /// Uploads a Telegram Story. See [bots: ✓] Possible codes: 400,403 (details) /// Whether to add the story to the profile automatically upon expiration. If not set, the story will only be added to the archive, see here » for more info. /// If set, disables forwards, screenshots, and downloads. /// Set this flag when reposting stories with fwd_from_id+fwd_from_id, if the media was modified before reposting. @@ -7453,6 +7590,7 @@ namespace TL /// Period after which the story is moved to archive (and to the profile if pinned is set), in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise. /// If set, indicates that this story is a repost of story with ID fwd_from_story posted by the peer in fwd_from_id. /// If set, indicates that this story is a repost of story with ID fwd_from_story posted by the peer in fwd_from_id. + /// If set, adds the story to the specified albums. public static Task Stories_SendStory(this Client client, InputPeer peer, InputMedia media, InputPrivacyRule[] privacy_rules, long random_id, string caption = null, MessageEntity[] entities = null, int? period = null, MediaArea[] media_areas = null, InputPeer fwd_from_id = null, int? fwd_from_story = null, int[] albums = null, bool pinned = false, bool noforwards = false, bool fwd_modified = false) => client.Invoke(new Stories_SendStory { @@ -7470,7 +7608,7 @@ namespace TL albums = albums, }); - /// Edit an uploaded story See Possible codes: 400 (details) + /// Edit an uploaded story See [bots: ✓] Possible codes: 400 (details) /// Peer where the story was posted. /// ID of story to edit. /// If specified, replaces the story media. @@ -7606,7 +7744,7 @@ namespace TL limit = limit, }); - /// Obtain info about the view count, forward count, reactions and recent viewers of one or more stories. See Possible codes: -504,400 (details) + /// Obtain info about the view count, forward count, reactions and recent viewers of one or more stories. See Possible codes: 400 (details) /// Peer whose stories should be fetched /// Story IDs public static Task Stories_GetStoriesViews(this Client client, InputPeer peer, params int[] id) @@ -7746,7 +7884,10 @@ namespace TL limit = limit, }); - /// See Possible codes: 400 (details) + /// Creates a story album. See Possible codes: 400 (details) + /// The owned peer where to create the album. + /// Album name. + /// Stories to add to the album. public static Task Stories_CreateAlbum(this Client client, InputPeer peer, string title, params int[] stories) => client.Invoke(new Stories_CreateAlbum { @@ -7755,7 +7896,13 @@ namespace TL stories = stories, }); - /// See Possible codes: 400 (details) + /// Rename a story albums », or add, delete or reorder stories in it. See Possible codes: 400 (details) + /// Peer where the album is posted. + /// Album ID. + /// New album title. + /// If set, deletes the specified stories from the album. + /// If set, adds the specified stories to the album. + /// If set, reorders the stories in the album by their IDs. public static Task Stories_UpdateAlbum(this Client client, InputPeer peer, int album_id, string title = null, int[] delete_stories = null, int[] add_stories = null, int[] order = null) => client.Invoke(new Stories_UpdateAlbum { @@ -7768,7 +7915,9 @@ namespace TL order = order, }); - /// See Possible codes: 400 (details) + /// Reorder story albums on a profile ». See Possible codes: 400 (details) + /// Peer where the albums are located. + /// New order of the albums. public static Task Stories_ReorderAlbums(this Client client, InputPeer peer, params int[] order) => client.Invoke(new Stories_ReorderAlbums { @@ -7776,7 +7925,9 @@ namespace TL order = order, }); - /// See Possible codes: 400 (details) + /// Delete a story album. See Possible codes: 400 (details) + /// Owned peer where the album is located. + /// ID of the album to delete. public static Task Stories_DeleteAlbum(this Client client, InputPeer peer, int album_id) => client.Invoke(new Stories_DeleteAlbum { @@ -7784,7 +7935,9 @@ namespace TL album_id = album_id, }); - /// See Possible codes: 400 (details) + /// Get story albums created by a peer. See Possible codes: 400 (details) + /// The peer. + /// The hash from a previously returned , to avoid returning any results if they haven't changed. /// a null value means stories.albumsNotModified public static Task Stories_GetAlbums(this Client client, InputPeer peer, long hash = default) => client.Invoke(new Stories_GetAlbums @@ -7793,7 +7946,10 @@ namespace TL hash = hash, }); - /// See Possible codes: 400 (details) + /// Get stories in a story album ». See Possible codes: 400 (details) + /// Peer where the album is posted. + /// ID of the album. + /// Offset for pagination. /// Maximum number of results to return, see pagination public static Task Stories_GetAlbumStories(this Client client, InputPeer peer, int album_id, int offset = default, int limit = int.MaxValue) => client.Invoke(new Stories_GetAlbumStories @@ -7835,7 +7991,7 @@ namespace TL peer = peer, }); - /// Gets the current number of boosts of a channel/supergroup. See Possible codes: -504,400 (details) + /// Gets the current number of boosts of a channel/supergroup. See Possible codes: 400 (details) /// The peer. public static Task Premium_GetBoostsStatus(this Client client, InputPeer peer) => client.Invoke(new Premium_GetBoostsStatus diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index a9a9c11..0bc2a97 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -3,7 +3,7 @@ namespace TL { #pragma warning disable IDE1006, CS1574 - /// Object describes the contents of an encrypted message. See + /// Object describes the contents of an encrypted message. See Derived classes: , public abstract partial class DecryptedMessageBase : IObject { /// Flags, see TL conditional fields (added in layer 45) @@ -24,11 +24,12 @@ namespace TL public virtual long ReplyToRandom => default; /// Random group ID, assigned by the author of message.
Multiple encrypted messages with a photo attached and with the same group ID indicate an album or grouped media (parameter added in layer 45)
public virtual long Grouped => default; + /// Random bytes, removed in layer 17. public virtual byte[] RandomBytes => default; public virtual DecryptedMessageAction Action => default; } - /// Object describes media contents of an encrypted message. See + /// Object describes media contents of an encrypted message. See Derived classes: , , , , , , , , /// a value means decryptedMessageMediaEmpty public abstract partial class DecryptedMessageMedia : IObject { @@ -36,14 +37,17 @@ namespace TL internal virtual (long size, byte[] key, byte[] iv) SizeKeyIV { get => default; set => throw new WTelegram.WTException("Incompatible DecryptedMessageMedia"); } } - /// Object describes the action to which a service message is linked. See + /// Object describes the action to which a service message is linked. See Derived classes: , , , , , , , , , , , , public abstract partial class DecryptedMessageAction : IObject { } - /// Indicates the location of a photo, will be deprecated soon See + /// Indicates the location of a photo, will be deprecated soon See Derived classes: , public abstract partial class FileLocationBase : IObject { + /// Volume ID public virtual long VolumeId => default; + /// Local ID public virtual int LocalId => default; + /// Secret public virtual long Secret => default; } @@ -55,6 +59,7 @@ namespace TL { /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public long random_id; + /// Random bytes, removed in layer 17. public byte[] random_bytes; /// Message text public string message; @@ -67,6 +72,7 @@ namespace TL public override string Message => message; /// Media content public override DecryptedMessageMedia Media => media; + /// Random bytes, removed in layer 17. public override byte[] RandomBytes => random_bytes; } ///
Contents of an encrypted service message. See @@ -75,12 +81,14 @@ namespace TL { /// Random message ID, assigned by the message author.
Must be equal to the ID passed to the sending method.
public long random_id; + /// Random bytes, removed in Layer 17. public byte[] random_bytes; /// Action relevant to the service message public DecryptedMessageAction action; /// Random message ID, assigned by the message author.
Must be equal to the ID passed to the sending method.
public override long RandomId => random_id; + /// Random bytes, removed in Layer 17. public override byte[] RandomBytes => random_bytes; /// Action relevant to the service message public override DecryptedMessageAction Action => action; @@ -167,6 +175,7 @@ namespace TL public int thumb_w; /// Thumbnail height public int thumb_h; + /// File name, moved to attributes in Layer 45. public string file_name; /// File MIME-type public string mime_type; @@ -498,25 +507,38 @@ namespace TL [TLDef(0x7C596B46)] public sealed partial class FileLocationUnavailable : FileLocationBase { + /// Volume ID public long volume_id; + /// Local ID public int local_id; + /// Secret public long secret; + /// Volume ID public override long VolumeId => volume_id; + /// Local ID public override int LocalId => local_id; + /// Secret public override long Secret => secret; } ///
File location. See [TLDef(0x53D69076)] public sealed partial class FileLocation : FileLocationBase { + /// DC ID public int dc_id; + /// Volume ID public long volume_id; + /// Local ID public int local_id; + /// Secret public long secret; + /// Volume ID public override long VolumeId => volume_id; + /// Local ID public override int LocalId => local_id; + /// Secret public override long Secret => secret; } } @@ -775,7 +797,6 @@ namespace TL { /// Field has a value has_reply_to_random_id = 0x8, - /// Whether this is a silent message (no notification triggered) silent = 0x20, /// Field has a value has_entities = 0x80, From 48d005b60587ad66dcdedec35bec850935aa11d0 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 10 Oct 2025 20:27:42 +0200 Subject: [PATCH 28/54] Encryption class public + Methods table --- generator/MTProtoGenerator.cs | 16 +++++++++++++--- src/Client.cs | 10 +++------- src/Encryption.cs | 12 +++++++----- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/generator/MTProtoGenerator.cs b/generator/MTProtoGenerator.cs index 4fd169d..26011b6 100644 --- a/generator/MTProtoGenerator.cs +++ b/generator/MTProtoGenerator.cs @@ -32,6 +32,7 @@ public class MTProtoGenerator : IIncrementalGenerator var nullables = LoadNullables(layer); var namespaces = new Dictionary>(); // namespace,class,methods var tableTL = new StringBuilder(); + var methodsTL = new StringBuilder(); var source = new StringBuilder(); source .AppendLine("using System;") @@ -46,6 +47,9 @@ public class MTProtoGenerator : IIncrementalGenerator tableTL .AppendLine("\t\tpublic static readonly Dictionary> Table = new()") .AppendLine("\t\t{"); + methodsTL + .AppendLine("\t\tpublic static readonly Dictionary> Methods = new()") + .AppendLine("\t\t{"); foreach (var classDecl in unit.classes) { @@ -86,8 +90,13 @@ public class MTProtoGenerator : IIncrementalGenerator } if (id == 0x3072CFA1) // GzipPacked tableTL.AppendLine($"\t\t\t[0x{id:X8}] = reader => (IObject)reader.ReadTLGzipped(typeof(IObject)),"); - else if (name != "Null" && (ns != "TL.Methods" || name == "Ping")) - tableTL.AppendLine($"\t\t\t[0x{id:X8}] = {(ns == "TL" ? "" : ns + '.')}{name}.ReadTL,"); + else if (name != "Null") + { + if (ns == "TL.Methods") + methodsTL.AppendLine($"\t\t\t[0x{id:X8}] = {(ns == "TL" ? "" : ns + '.')}{name}{(symbol.IsGenericType ? "" : "")}.ReadTL,"); + if (ns != "TL.Methods" || name == "Ping") + tableTL.AppendLine($"\t\t\t[0x{id:X8}] = {(ns == "TL" ? "" : ns + '.')}{name}.ReadTL,"); + } var override_ = symbol.BaseType == object_ ? "" : "override "; if (name == "Messages_AffectedMessages") override_ = "virtual "; //if (symbol.Constructors[0].IsImplicitlyDeclared) @@ -213,7 +222,8 @@ public class MTProtoGenerator : IIncrementalGenerator foreach (var nullable in nullables) tableTL.AppendLine($"\t\t\t[0x{nullable.Value:X8}] = null,"); tableTL.AppendLine("\t\t};"); - namespaces["TL"]["Layer"] = tableTL.ToString(); + methodsTL.AppendLine("\t\t};"); + namespaces["TL"]["Layer"] = tableTL.ToString() + methodsTL.ToString(); foreach (var namesp in namespaces) { source.Append("namespace ").AppendLine(namesp.Key).Append('{'); diff --git a/src/Client.cs b/src/Client.cs index 08b6207..be24bf3 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -185,10 +185,6 @@ namespace WTelegram return Console.ReadLine(); } - /// Load a specific Telegram server public key - /// A string starting with -----BEGIN RSA PUBLIC KEY----- - public static void LoadPublicKey(string pem) => Encryption.LoadPublicKey(pem); - /// Builds a structure that is used to validate a 2FA password /// Password validation configuration. You can obtain this via Account_GetPassword or through OnOther as part of the login process /// The password to validate @@ -358,7 +354,7 @@ namespace WTelegram if (await stream.FullReadAsync(data, 4, ct) != 4) throw new WTException(ConnectionShutDown); #if OBFUSCATION - _recvCtr.EncryptDecrypt(data, 4); + _recvCtr.EncryptDecrypt(data.AsSpan(0, 4)); #endif int payloadLen = BinaryPrimitives.ReadInt32LittleEndian(data); if (payloadLen <= 0) @@ -370,7 +366,7 @@ namespace WTelegram if (await stream.FullReadAsync(data, payloadLen, ct) != payloadLen) throw new WTException("Could not read frame data : Connection shut down"); #if OBFUSCATION - _recvCtr.EncryptDecrypt(data, payloadLen); + _recvCtr.EncryptDecrypt(data.AsSpan(0, payloadLen)); #endif obj = ReadFrame(data, payloadLen); } @@ -1526,7 +1522,7 @@ namespace WTelegram int frameLength = (int)memStream.Length; BinaryPrimitives.WriteInt32LittleEndian(buffer, frameLength - 4); // patch payload_len with correct value #if OBFUSCATION - _sendCtr?.EncryptDecrypt(buffer, frameLength); + _sendCtr?.EncryptDecrypt(buffer.AsSpan(0, frameLength)); #endif if (_networkStream != null) await _networkStream.WriteAsync(buffer, 0, frameLength); diff --git a/src/Encryption.cs b/src/Encryption.cs index 957c537..09f6caa 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -13,7 +13,7 @@ using static WTelegram.Compat; namespace WTelegram { - internal static class Encryption + public static class Encryption { private static readonly Dictionary PublicKeys = []; internal static readonly RandomNumberGenerator RNG = RandomNumberGenerator.Create(); @@ -237,6 +237,8 @@ namespace WTelegram throw new WTException("g^a or g^b is not between 2^{2048-64} and dh_prime - 2^{2048-64}"); } + /// Load a specific Telegram server public key + /// A string starting with -----BEGIN RSA PUBLIC KEY----- public static void LoadPublicKey(string pem) { using var rsa = RSA.Create(); @@ -319,7 +321,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB } #if OBFUSCATION - internal sealed class AesCtr(byte[] key, byte[] ivec) : IDisposable + public sealed class AesCtr(byte[] key, byte[] ivec) : IDisposable { readonly ICryptoTransform _encryptor = AesECB.CreateEncryptor(key, null); readonly byte[] _ecount = new byte[16]; @@ -327,9 +329,9 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB public void Dispose() => _encryptor.Dispose(); - public void EncryptDecrypt(byte[] buffer, int length) + public void EncryptDecrypt(Span buffer) { - for (int i = 0; i < length; i++) + for (int i = 0; i < buffer.Length; i++) { if (_num == 0) { @@ -373,7 +375,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB var sendCtr = new AesCtr(sendKey, sendIV); var recvCtr = new AesCtr(recvKey, recvIV); var encrypted = (byte[])preamble.Clone(); - sendCtr.EncryptDecrypt(encrypted, 64); + sendCtr.EncryptDecrypt(encrypted); for (int i = 56; i < 64; i++) preamble[i] = encrypted[i]; return (sendCtr, recvCtr, preamble); From 2e95576be5700d32a36ae887ef6a9ea97c074ca4 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 31 Oct 2025 00:14:48 +0100 Subject: [PATCH 29/54] Encryption class public + TL Methods/Helpers --- generator/MTProtoGenerator.cs | 17 ++++++++++---- src/Encryption.cs | 44 +++++++++++++++++------------------ src/TL.cs | 40 ++++++++++++++++++++++++++++++- 3 files changed, 74 insertions(+), 27 deletions(-) diff --git a/generator/MTProtoGenerator.cs b/generator/MTProtoGenerator.cs index 26011b6..c9e71f0 100644 --- a/generator/MTProtoGenerator.cs +++ b/generator/MTProtoGenerator.cs @@ -83,7 +83,7 @@ public class MTProtoGenerator : IIncrementalGenerator ns = symbol.ContainingNamespace.ToString(); name = symbol.Name; if (!namespaces.TryGetValue(ns, out var classes)) namespaces[ns] = classes = []; - if (name is "_Message" or "RpcResult" or "MsgCopy") + if (name is "_Message" or "MsgCopy") { classes[name] = "\t\tpublic void WriteTL(BinaryWriter writer) => throw new NotSupportedException();"; continue; @@ -93,7 +93,7 @@ public class MTProtoGenerator : IIncrementalGenerator else if (name != "Null") { if (ns == "TL.Methods") - methodsTL.AppendLine($"\t\t\t[0x{id:X8}] = {(ns == "TL" ? "" : ns + '.')}{name}{(symbol.IsGenericType ? "" : "")}.ReadTL,"); + methodsTL.AppendLine($"\t\t\t[0x{id:X8}] = {(ns == "TL" ? "" : ns + '.')}{name}{(symbol.IsGenericType ? "" : "")}.ReadTL,"); if (ns != "TL.Methods" || name == "Ping") tableTL.AppendLine($"\t\t\t[0x{id:X8}] = {(ns == "TL" ? "" : ns + '.')}{name}.ReadTL,"); } @@ -176,7 +176,7 @@ public class MTProtoGenerator : IIncrementalGenerator writeTl.AppendLine($"writer.WriteTLMessages({member.Name});"); break; case "TL.IObject": case "TL.IMethod": - readTL.AppendLine($"r.{member.Name} = {(memberType == "TL.IObject" ? "" : $"({memberType})")}reader.ReadTLObject();"); + readTL.AppendLine($"r.{member.Name} = {(memberType == "TL.IObject" ? "reader.ReadTLObject()" : "reader.ReadTLMethod()")};"); writeTl.AppendLine($"{member.Name}.WriteTL(writer);"); break; case "System.Collections.Generic.Dictionary": @@ -187,14 +187,23 @@ public class MTProtoGenerator : IIncrementalGenerator readTL.AppendLine($"r.{member.Name} = reader.ReadTLDictionary();"); writeTl.AppendLine($"writer.WriteTLVector({member.Name}.Values.ToArray());"); break; + case "object": + readTL.AppendLine($"r.{member.Name} = reader.ReadTLObject();"); + writeTl.AppendLine($"writer.WriteTLValue({member.Name}, {member.Name}.GetType());"); + break; default: if (member.Type is IArrayTypeSymbol arrayType) { if (name is "FutureSalts") + { readTL.AppendLine($"r.{member.Name} = reader.ReadTLRawVector<{memberType.Substring(0, memberType.Length - 2)}>(0x0949D9DC).ToArray();"); + writeTl.AppendLine($"writer.WriteTLRawVector({member.Name}, 16);"); + } else + { readTL.AppendLine($"r.{member.Name} = reader.ReadTLVector<{memberType.Substring(0, memberType.Length - 2)}>();"); - writeTl.AppendLine($"writer.WriteTLVector({member.Name});"); + writeTl.AppendLine($"writer.WriteTLVector({member.Name});"); + } } else if (member.Type.BaseType.SpecialType == SpecialType.System_Enum) { diff --git a/src/Encryption.cs b/src/Encryption.cs index 09f6caa..4025d9e 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -94,7 +94,7 @@ namespace WTelegram if (serverDHparams is not ServerDHParamsOk serverDHparamsOk) throw new WTException("not server_DH_params_ok"); if (serverDHparamsOk.nonce != nonce) throw new WTException("Nonce mismatch"); if (serverDHparamsOk.server_nonce != resPQ.server_nonce) throw new WTException("Server Nonce mismatch"); - var (tmp_aes_key, tmp_aes_iv) = ConstructTmpAESKeyIV(resPQ.server_nonce, pqInnerData.new_nonce); + var (tmp_aes_key, tmp_aes_iv) = ConstructTmpAESKeyIV(sha1, resPQ.server_nonce, pqInnerData.new_nonce); var answer = AES_IGE_EncryptDecrypt(serverDHparamsOk.encrypted_answer, tmp_aes_key, tmp_aes_iv, false); using var answerReader = new BinaryReader(new MemoryStream(answer)); @@ -163,26 +163,26 @@ namespace WTelegram session.AuthKey = authKey; session.Salt = BinaryPrimitives.ReadInt64LittleEndian(pqInnerData.new_nonce.raw) ^ BinaryPrimitives.ReadInt64LittleEndian(resPQ.server_nonce.raw); session.OldSalt = session.Salt; + } - (byte[] key, byte[] iv) ConstructTmpAESKeyIV(TL.Int128 server_nonce, Int256 new_nonce) - { - byte[] tmp_aes_key = new byte[32], tmp_aes_iv = new byte[32]; - sha1.TransformBlock(new_nonce, 0, 32, null, 0); - sha1.TransformFinalBlock(server_nonce, 0, 16); - sha1.Hash.CopyTo(tmp_aes_key, 0); // tmp_aes_key := SHA1(new_nonce + server_nonce) - sha1.Initialize(); - sha1.TransformBlock(server_nonce, 0, 16, null, 0); - sha1.TransformFinalBlock(new_nonce, 0, 32); - Array.Copy(sha1.Hash, 0, tmp_aes_key, 20, 12); // + SHA1(server_nonce, new_nonce)[0:12] - Array.Copy(sha1.Hash, 12, tmp_aes_iv, 0, 8); // tmp_aes_iv != SHA1(server_nonce, new_nonce)[12:8] - sha1.Initialize(); - sha1.TransformBlock(new_nonce, 0, 32, null, 0); - sha1.TransformFinalBlock(new_nonce, 0, 32); - sha1.Hash.CopyTo(tmp_aes_iv, 8); // + SHA(new_nonce + new_nonce) - Array.Copy(new_nonce, 0, tmp_aes_iv, 28, 4); // + new_nonce[0:4] - sha1.Initialize(); - return (tmp_aes_key, tmp_aes_iv); - } + public static (byte[] key, byte[] iv) ConstructTmpAESKeyIV(SHA1 sha1, TL.Int128 server_nonce, Int256 new_nonce) + { + byte[] tmp_aes_key = new byte[32], tmp_aes_iv = new byte[32]; + sha1.TransformBlock(new_nonce, 0, 32, null, 0); + sha1.TransformFinalBlock(server_nonce, 0, 16); + sha1.Hash.CopyTo(tmp_aes_key, 0); // tmp_aes_key := SHA1(new_nonce + server_nonce) + sha1.Initialize(); + sha1.TransformBlock(server_nonce, 0, 16, null, 0); + sha1.TransformFinalBlock(new_nonce, 0, 32); + Array.Copy(sha1.Hash, 0, tmp_aes_key, 20, 12); // + SHA1(server_nonce, new_nonce)[0:12] + Array.Copy(sha1.Hash, 12, tmp_aes_iv, 0, 8); // tmp_aes_iv != SHA1(server_nonce, new_nonce)[12:8] + sha1.Initialize(); + sha1.TransformBlock(new_nonce, 0, 32, null, 0); + sha1.TransformFinalBlock(new_nonce, 0, 32); + sha1.Hash.CopyTo(tmp_aes_iv, 8); // + SHA(new_nonce + new_nonce) + Array.Copy(new_nonce, 0, tmp_aes_iv, 28, 4); // + new_nonce[0:4] + sha1.Initialize(); + return (tmp_aes_key, tmp_aes_iv); } internal static void CheckGoodPrime(BigInteger p, int g) @@ -278,7 +278,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB -----END RSA PUBLIC KEY-----"); } - internal static byte[] EncryptDecryptMessage(Span input, bool encrypt, int x, byte[] authKey, byte[] msgKey, int msgKeyOffset, SHA256 sha256) + public static byte[] EncryptDecryptMessage(Span input, bool encrypt, int x, byte[] authKey, byte[] msgKey, int msgKeyOffset, SHA256 sha256) { // first, construct AES key & IV byte[] aes_key = new byte[32], aes_iv = new byte[32]; @@ -299,7 +299,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB return AES_IGE_EncryptDecrypt(input, aes_key, aes_iv, encrypt); } - internal static byte[] AES_IGE_EncryptDecrypt(Span input, byte[] aes_key, byte[] aes_iv, bool encrypt) + public static byte[] AES_IGE_EncryptDecrypt(Span input, byte[] aes_key, byte[] aes_iv, bool encrypt) { if (input.Length % 16 != 0) throw new WTException("AES_IGE input size not divisible by 16"); diff --git a/src/TL.cs b/src/TL.cs index 67342ea..7c4b65d 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -16,7 +16,7 @@ namespace TL #else public interface IObject { } #endif - public interface IMethod : IObject { } + public interface IMethod : IObject { } public interface IPeerResolver { IPeerInfo UserOrChat(Peer peer); } [AttributeUsage(AttributeTargets.Class)] @@ -105,6 +105,17 @@ namespace TL #endif } + public static IMethod ReadTLMethod(this BinaryReader reader) + { + uint ctorNb = reader.ReadUInt32(); + if (!Layer.Methods.TryGetValue(ctorNb, out var ctor)) + throw new WTelegram.WTException($"Cannot find method for ctor #{ctorNb:x}"); + var method = ctor?.Invoke(reader); + if (method is IMethod && typeof(X) == typeof(object)) + method = new BoolMethod { query = method }; + return (IMethod)method; + } + internal static void WriteTLValue(this BinaryWriter writer, object value, Type valueType) { if (value == null) @@ -222,6 +233,21 @@ namespace TL writer.WriteTLValue(array.GetValue(i), elementType); } + internal static void WriteTLRawVector(this BinaryWriter writer, Array array, int elementSize) + { + var startPos = writer.BaseStream.Position; + int count = array.Length; + var elementType = array.GetType().GetElementType(); + for (int i = count - 1; i >= 0; i--) + { + writer.BaseStream.Position = startPos + i * elementSize; + writer.WriteTLValue(array.GetValue(i), elementType); + } + writer.BaseStream.Position = startPos; + writer.Write(count); + writer.BaseStream.Position = startPos + count * elementSize + 4; + } + internal static List ReadTLRawVector(this BinaryReader reader, uint ctorNb) { int count = reader.ReadInt32(); @@ -443,4 +469,16 @@ namespace TL [TLDef(0x3072CFA1)] //gzip_packed#3072cfa1 packed_data:bytes = Object public sealed partial class GzipPacked : IObject { public byte[] packed_data; } + + public sealed class Null : IObject + { + public readonly static Null Instance = new(); + public void WriteTL(BinaryWriter writer) => writer.WriteTLNull(typeof(X)); + } + + public sealed class BoolMethod : IMethod + { + public IObject query; + public void WriteTL(BinaryWriter writer) => query.WriteTL(writer); + } } From 4875f75774fcf073941953d72b92db1caa04b90c Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 31 Oct 2025 00:27:32 +0100 Subject: [PATCH 30/54] API Layer 216: topics methods/updates moved to prefix Messages_* (to support topics for bots), contact notes, groupcall comments, profile color, stargifts stuff --- README.md | 2 +- src/Client.Helpers.cs | 8 +- src/TL.Schema.cs | 264 ++++++++++++++----- src/TL.SchemaFuncs.cs | 515 +++++++++++++++++++++---------------- src/TL.Table.cs | 39 +-- src/WTelegramClient.csproj | 4 +- 6 files changed, 537 insertions(+), 295 deletions(-) diff --git a/README.md b/README.md index 5bf0849..895eedf 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-214-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-216-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/Client.Helpers.cs b/src/Client.Helpers.cs index e205579..6faa509 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -640,18 +640,18 @@ namespace WTelegram } /// Helper simplified method: Get all topics of a forum See Possible codes: 400 (details) - /// Supergroup + /// Supergroup or Bot peer /// Search query - public async Task Channels_GetAllForumTopics(InputChannelBase channel, string q = null) + public async Task Channels_GetAllForumTopics(InputPeer peer, string q = null) { - var result = await this.Channels_GetForumTopics(channel, offset_date: DateTime.MaxValue, q: q); + var result = await this.Messages_GetForumTopics(peer, offset_date: DateTime.MaxValue, q: q); if (result.topics.Length < result.count) { var topics = result.topics.ToList(); var messages = result.messages.ToList(); while (true) { - var more_topics = await this.Channels_GetForumTopics(channel, messages[^1].Date, messages[^1].ID, topics[^1].ID); + var more_topics = await this.Messages_GetForumTopics(peer, messages[^1].Date, messages[^1].ID, topics[^1].ID); if (more_topics.topics.Length == 0) break; topics.AddRange(more_topics.topics); messages.AddRange(more_topics.messages); diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 16411b9..45807d0 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -819,9 +819,9 @@ namespace TL /// 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; /// The user's accent color. - [IfFlag(40)] public PeerColor color; + [IfFlag(40)] public PeerColorBase color; /// The user's profile color. - [IfFlag(41)] public PeerColor profile_color; + [IfFlag(41)] public PeerColorBase profile_color; /// Monthly Active Users (MAU) of this bot (may be absent for small bots). [IfFlag(44)] public int bot_active_users; /// Describes a bot verification icon ». @@ -919,6 +919,7 @@ namespace TL has_bot_verification_icon = 0x4000, /// Field has a value has_send_paid_messages_stars = 0x8000, + bot_forum_view = 0x10000, } } @@ -1123,9 +1124,9 @@ namespace TL /// ID of the maximum read story. [IfFlag(36)] public int stories_max_id; /// The channel's accent color. - [IfFlag(39)] public PeerColor color; + [IfFlag(39)] public PeerColorBase color; /// The channel's profile color. - [IfFlag(40)] public PeerColor profile_color; + [IfFlag(40)] public PeerColorBase profile_color; /// Emoji status [IfFlag(41)] public EmojiStatusBase emoji_status; /// Boost level.
Changes to this flag should invalidate the local cache for this channel/supergroup ID, see here » for more info.
@@ -2744,6 +2745,7 @@ namespace TL { /// Field has a value has_icon_emoji_id = 0x1, + title_missing = 0x2, } } /// Forum topic information was edited. See @@ -2988,7 +2990,7 @@ namespace TL [IfFlag(12)] public long saved_id; /// Hash to prepay for a gift upgrade separately ». [IfFlag(14)] public string prepaid_upgrade_hash; - /// For separate upgrades, the identifier of the message with the gift whose upgrade was prepaid (valid for everyone, since all messages across all private chats with users share the same message ID sequence, and for channels the service message will already be sent to the channel, that will contain the service message with the original gift). + /// For separate upgrades, the identifier of the message with the gift whose upgrade was prepaid (only valid for the receiver of the service message). [IfFlag(15)] public int gift_msg_id; [Flags] public enum Flags : uint @@ -3026,7 +3028,7 @@ namespace TL } } /// A gift » was upgraded to a collectible gift ». See - [TLDef(0x34F762F3)] + [TLDef(0x95728543)] public sealed partial class MessageActionStarGiftUnique : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -3049,6 +3051,7 @@ namespace TL [IfFlag(9)] public DateTime can_transfer_at; /// If set, indicates that the current gift can't be resold » yet: the owner will be able to put it up for sale at the specified unixtime. [IfFlag(10)] public DateTime can_resell_at; + [IfFlag(12)] public long drop_original_details_stars; [Flags] public enum Flags : uint { @@ -3076,6 +3079,9 @@ namespace TL has_can_resell_at = 0x400, /// The sender has pre-paid for the upgrade of this gift to a collectible gift. prepaid_upgrade = 0x800, + /// Field has a value + has_drop_original_details_stars = 0x1000, + assigned = 0x2000, } } /// Sent from peer A to B, indicates that A refunded all stars B previously paid to send messages to A, see here » for more info on paid messages. See @@ -3215,6 +3221,12 @@ namespace TL has_transaction_id = 0x1, } } + /// See + [TLDef(0x2C8F2A25)] + public sealed partial class MessageActionSuggestBirthday : MessageAction + { + public Birthday birthday; + } /// Chat info. See Derived classes: , public abstract partial class DialogBase : IObject @@ -3495,7 +3507,7 @@ namespace TL public Auth_AuthorizationBase authorization; } /// Official apps may receive this constructor, indicating that due to the high cost of SMS verification codes for the user's country/provider, the user must purchase a Telegram Premium subscription in order to proceed with the login/signup. See - [TLDef(0xD7A2FCF9)] + [TLDef(0xE0955A3C)] public sealed partial class Auth_SentCodePaymentRequired : Auth_SentCodeBase { /// Store identifier of the Telegram Premium subscription. @@ -3506,6 +3518,8 @@ namespace TL public string support_email_address; /// The mandatory subject for the email. public string support_email_subject; + public string currency; + public long amount; } /// Object contains info on user authorization. See Derived classes: , @@ -3852,7 +3866,7 @@ namespace TL } /// Extended user info See - [TLDef(0xC577B5AD)] + [TLDef(0xA02BC13E)] public sealed partial class UserFull : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -3931,6 +3945,7 @@ namespace TL [IfFlag(52)] public ProfileTab main_tab; /// The first song on the music tab of the profile, see here » for more info on the music profile tab. [IfFlag(53)] public DocumentBase saved_music; + [IfFlag(54)] public TextWithEntities note; [Flags] public enum Flags : uint { @@ -4032,6 +4047,8 @@ namespace TL has_main_tab = 0x100000, /// Field has a value has_saved_music = 0x200000, + /// Field has a value + has_note = 0x400000, } } @@ -4165,15 +4182,17 @@ namespace TL { /// List of messages public virtual MessageBase[] Messages => default; + public virtual ForumTopicBase[] Topics => default; /// returns a or for the given Peer public abstract IPeerInfo UserOrChat(Peer peer); } /// Full list of messages with auxiliary data. See - [TLDef(0x8C718E87)] + [TLDef(0x1D73E7EA)] public partial class Messages_Messages : Messages_MessagesBase, IPeerResolver { /// List of messages public MessageBase[] messages; + public ForumTopicBase[] topics; /// List of chats mentioned in dialogs public Dictionary chats; /// List of users mentioned in messages and chats @@ -4181,11 +4200,12 @@ namespace TL /// List of messages public override MessageBase[] Messages => messages; + public override ForumTopicBase[] Topics => topics; /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Incomplete list of messages and auxiliary data. See - [TLDef(0x762B263D)] + [TLDef(0x5F206716)] public sealed partial class Messages_MessagesSlice : Messages_Messages, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -4242,6 +4262,8 @@ namespace TL /// Found messages public override MessageBase[] Messages => messages; + /// Forum topic information + public override ForumTopicBase[] Topics => topics; /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } @@ -4358,6 +4380,7 @@ namespace TL public abstract partial class Update : IObject { public virtual (long mbox_id, int pts, int pts_count) GetMBox() => default; + public virtual void SetPTS(int new_pts, int new_pts_count) { } } /// New message in a private chat or in a basic group. See [TLDef(0x1F2B0AFD)] @@ -4371,6 +4394,7 @@ namespace TL public int pts_count; public override (long, int, int) GetMBox() => (0, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// Sent message with random_id client identifier was assigned an identifier. See [TLDef(0x4E90BFD6)] @@ -4393,13 +4417,24 @@ namespace TL public int pts_count; public override (long, int, int) GetMBox() => (0, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// The user is preparing a message; typing, recording, uploading, etc. This update is valid for 6 seconds. If no further updates of this kind are received after 6 seconds, it should be considered that the user stopped doing whatever they were doing See - [TLDef(0xC01E857F, inheritBefore = true)] - public sealed partial class UpdateUserTyping : UpdateUser + [TLDef(0x2A17BF5C)] + public sealed partial class UpdateUserTyping : Update { + public Flags flags; + /// User id + public long user_id; + [IfFlag(0)] public int top_msg_id; /// Action type public SendMessageAction action; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_top_msg_id = 0x1, + } } /// The user is preparing a message in a group; typing, recording, uploading, etc. This update is valid for 6 seconds. If no further updates of this kind are received after 6 seconds, it should be considered that the user stopped doing whatever they were doing See [TLDef(0x83487AF0, inheritBefore = true)] @@ -4466,6 +4501,7 @@ namespace TL public int qts; public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// Interlocutor is typing a message in an encrypted chat. Update period is 6 second. If upon this time there is no repeated update, it shall be considered that the interlocutor stopped typing. See [TLDef(0x1710F156)] @@ -4576,7 +4612,7 @@ namespace TL public string phone; } /// Incoming messages were read See - [TLDef(0x9C974FDF)] + [TLDef(0x9E84BC99)] public sealed partial class UpdateReadHistoryInbox : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -4585,6 +4621,7 @@ namespace TL [IfFlag(0)] public int folder_id; /// Peer public Peer peer; + [IfFlag(1)] public int top_msg_id; /// Maximum ID of messages read public int max_id; /// Number of messages that are still unread @@ -4598,9 +4635,12 @@ namespace TL { /// Field has a value has_folder_id = 0x1, + /// Field has a value + has_top_msg_id = 0x2, } public override (long, int, int) GetMBox() => (0, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// Outgoing messages were read See [TLDef(0x2F2F21BF)] @@ -4616,6 +4656,7 @@ namespace TL public int pts_count; public override (long, int, int) GetMBox() => (0, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// An instant view webpage preview was generated See [TLDef(0x7F891213)] @@ -4629,6 +4670,7 @@ namespace TL public int pts_count; public override (long, int, int) GetMBox() => (0, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// Contents of messages in the common message box were read (emitted specifically for messages like voice messages or video, only once the media is watched and marked as read using Messages_ReadMessageContents). See [TLDef(0xF8227181)] @@ -4652,6 +4694,7 @@ namespace TL } public override (long, int, int) GetMBox() => (0, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// There are new updates in the specified channel, the client must fetch them.
If the difference is too long or if the channel isn't currently in the states, start fetching from the specified pts. See
[TLDef(0x108D941F)] @@ -4671,6 +4714,7 @@ namespace TL } public override (long, int, int) GetMBox() => (channel_id, pts, 0); + public override void SetPTS(int new_pts, int _) => pts = new_pts; } /// Channel/supergroup ( and/or ) information was updated. See [TLDef(0x635B4C09)] @@ -4684,6 +4728,7 @@ namespace TL public sealed partial class UpdateNewChannelMessage : UpdateNewMessage { public override (long, int, int) GetMBox() => (message.Peer is PeerChannel pc ? pc.channel_id : 0, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// Incoming messages in a channel/supergroup were read See [TLDef(0x922E6E10)] @@ -4709,6 +4754,7 @@ namespace TL } public override (long, int, int) GetMBox() => (channel_id, pts, 0); + public override void SetPTS(int new_pts, int _) => pts = new_pts; } /// Some messages in a supergroup/channel were deleted See [TLDef(0xC32D5B12)] @@ -4718,6 +4764,7 @@ namespace TL public long channel_id; public override (long, int, int) GetMBox() => (channel_id, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// The view counter of a message in a channel has changed See [TLDef(0xF226AC08, inheritBefore = true)] @@ -4838,6 +4885,7 @@ namespace TL public sealed partial class UpdateEditChannelMessage : UpdateEditMessage { public override (long, int, int) GetMBox() => (message.Peer is PeerChannel pc ? pc.channel_id : 0, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// A callback button was pressed, and the button data was sent to the bot that created the button See [TLDef(0xB9CFC48D)] @@ -4880,6 +4928,7 @@ namespace TL public int pts_count; public override (long, int, int) GetMBox() => (0, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// This notification is received by bots when a button is pressed See [TLDef(0x691E9052)] @@ -4960,6 +5009,7 @@ namespace TL public long channel_id; public override (long, int, int) GetMBox() => (channel_id, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// A dialog was pinned/unpinned See [TLDef(0x6E6FE51C)] @@ -5177,6 +5227,7 @@ namespace TL public int pts_count; public override (long, int, int) GetMBox() => (0, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// Settings of a certain peer have changed See [TLDef(0x6A7E7366)] @@ -5253,6 +5304,7 @@ namespace TL public int qts; public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// A new folder was added See [TLDef(0x26FFDE7D)] @@ -5393,6 +5445,7 @@ namespace TL } public override (long, int, int) GetMBox() => (0, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// Messages were pinned/unpinned in a channel/supergroup See [TLDef(0x5BB98608)] @@ -5416,6 +5469,7 @@ namespace TL } public override (long, int, int) GetMBox() => (channel_id, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// Chat ( and/or ) information was updated. See [TLDef(0xF89A6A4E)] @@ -5503,6 +5557,7 @@ namespace TL } public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// A participant has left, joined, was banned or admined in a channel or supergroup. See [TLDef(0x985D3ABB)] @@ -5540,6 +5595,7 @@ namespace TL } public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// A bot was stopped or re-started. See [TLDef(0xC4870A49)] @@ -5555,6 +5611,7 @@ namespace TL public int qts; public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// New WebRTC parameters See [TLDef(0x0B783982)] @@ -5611,6 +5668,7 @@ namespace TL public int qts; public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// New message reactions » are available See [TLDef(0x1E297BFA)] @@ -5724,40 +5782,6 @@ namespace TL /// Revealed media, contains only s. public MessageExtendedMediaBase[] extended_media; } - /// A forum topic » was pinned or unpinned. See - [TLDef(0x192EFBE3)] - public sealed partial class UpdateChannelPinnedTopic : Update - { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - /// The forum ID - public long channel_id; - /// The topic ID - public int topic_id; - - [Flags] public enum Flags : uint - { - /// Whether the topic was pinned or unpinned - pinned = 0x1, - } - } - /// The pinned topics of a forum have changed. See - [TLDef(0xFE198602)] - public sealed partial class UpdateChannelPinnedTopics : Update - { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - /// Forum ID. - public long channel_id; - /// Ordered list containing the IDs of all pinned topics. - [IfFlag(0)] public int[] order; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_order = 0x1, - } - } /// User ( and/or ) information was updated. See [TLDef(0x20529438)] public partial class UpdateUser : Update @@ -5825,6 +5849,7 @@ namespace TL public int qts; public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// Users may also choose to display messages from all topics as if they were sent to a normal group, using a "View as messages" setting in the local client.
This setting only affects the current account, and is synced to other logged in sessions using the Channels_ToggleViewForumAsMessages method; invoking this method will update the value of the view_forum_as_messages flag of or and emit an . See
[TLDef(0x07B68920, inheritBefore = true)] @@ -5872,6 +5897,7 @@ namespace TL public int qts; public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// Bots only: the number of reactions on a message with anonymous reactions has changed. See [TLDef(0x09CB7759)] @@ -5889,6 +5915,7 @@ namespace TL public int qts; public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// A saved message dialog was pinned/unpinned See [TLDef(0xAEAF9E74)] @@ -5975,6 +6002,7 @@ namespace TL public int qts; public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// A message was received via a connected business chat ». See [TLDef(0x9DDB347C)] @@ -5998,6 +6026,7 @@ namespace TL } public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// A message was edited in a connected business chat ». See [TLDef(0x07DF587C)] @@ -6021,6 +6050,7 @@ namespace TL } public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// A message was deleted in a connected business chat ». See [TLDef(0xA02A982E)] @@ -6036,6 +6066,7 @@ namespace TL public int qts; public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// Represents a new reaction to a story. See [TLDef(0x1824E40B)] @@ -6105,6 +6136,7 @@ namespace TL public int qts; public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// Contains the current default paid reaction privacy, see here » for more info. See [TLDef(0x8B725FCE)] @@ -6172,6 +6204,49 @@ namespace TL exception = 0x1, } } + /// See + [TLDef(0x78C314E0)] + public sealed partial class UpdateGroupCallMessage : Update + { + public InputGroupCallBase call; + public Peer from_id; + public long random_id; + public TextWithEntities message; + } + /// See + [TLDef(0xC957A766)] + public sealed partial class UpdateGroupCallEncryptedMessage : Update + { + public InputGroupCallBase call; + public Peer from_id; + public byte[] encrypted_message; + } + /// See + [TLDef(0x683B2C52)] + public sealed partial class UpdatePinnedForumTopic : Update + { + public Flags flags; + public Peer peer; + public int topic_id; + + [Flags] public enum Flags : uint + { + pinned = 0x1, + } + } + /// See + [TLDef(0xDEF143D0)] + public sealed partial class UpdatePinnedForumTopics : Update + { + public Flags flags; + public Peer peer; + [IfFlag(0)] public int[] order; + + [Flags] public enum Flags : uint + { + has_order = 0x1, + } + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -7270,6 +7345,13 @@ namespace TL /// Emoji public string emoticon; } + /// See + [TLDef(0x376D975C)] + public sealed partial class SendMessageTextDraftAction : SendMessageAction + { + public long random_id; + public TextWithEntities text; + } /// Users found by name substring and auxiliary data. See [TLDef(0xB3134D9D)] @@ -12436,9 +12518,9 @@ namespace TL public partial class ChannelAdminLogEventActionChangePeerColor : ChannelAdminLogEventAction { /// Previous accent palette - public PeerColor prev_value; + public PeerColorBase prev_value; /// New accent palette - public PeerColor new_value; + public PeerColorBase new_value; } /// The profile accent color was changed See [TLDef(0x5E477B25)] @@ -15253,6 +15335,9 @@ namespace TL creator = 0x8000, /// Field has a value has_invite_link = 0x10000, + messages_enabled = 0x20000, + can_change_messages_enabled = 0x40000, + min = 0x80000, } /// Group call ID @@ -15694,7 +15779,7 @@ namespace TL /// Available chat themes See /// a value means account.chatThemesNotModified - [TLDef(0x16484857)] + [TLDef(0xBE098173)] public sealed partial class Account_ChatThemes : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -15708,7 +15793,7 @@ namespace TL /// Users mentioned in the themes field. public Dictionary users; /// Next offset for pagination. - [IfFlag(0)] public int next_offset; + [IfFlag(0)] public string next_offset; [Flags] public enum Flags : uint { @@ -15740,7 +15825,7 @@ namespace TL /// If set, contains some media. [IfFlag(14)] public MessageMedia media; /// If set, the sponsored message should use the message accent color » specified in color. - [IfFlag(13)] public PeerColor color; + [IfFlag(13)] public PeerColorBase color; /// Label of the sponsored message button. public string button_text; /// If set, contains additional information about the sponsor to be shown along with the message. @@ -16456,6 +16541,18 @@ namespace TL /// The upgrade hash from .prepaid_upgrade_hash or .prepaid_upgrade_hash. public string hash; } + /// See + [TLDef(0x3E77F614)] + public sealed partial class InputInvoicePremiumAuthCode : InputInvoice + { + public InputStorePaymentPurpose purpose; + } + /// See + [TLDef(0x0923D8D1)] + public sealed partial class InputInvoiceStarGiftDropOriginalDetails : InputInvoice + { + public InputSavedStarGift stargift; + } /// Exported invoice deep link See [TLDef(0xAED0CBD9)] @@ -17040,7 +17137,7 @@ namespace TL public override int ID => id; } /// Represents a forum topic. See - [TLDef(0x71701DA9)] + [TLDef(0xCDFF0ECA)] public sealed partial class ForumTopic : ForumTopicBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -17049,6 +17146,7 @@ namespace TL public int id; /// Topic creation date public DateTime date; + public Peer peer; /// Topic title public string title; /// If no custom emoji icon is specified, specifies the color of the fallback topic icon (RGB), one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, or 0xFB6F5F. @@ -17090,6 +17188,7 @@ namespace TL short_ = 0x20, /// Whether the topic is hidden (only valid for the "General" topic, id=1) hidden = 0x40, + title_missing = 0x80, } /// Topic ID @@ -18709,9 +18808,11 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } + /// Represents a color palette ». See Derived classes: + public abstract partial class PeerColorBase : IObject { } /// Represents a color palette ». See [TLDef(0xB54B5ACF)] - public sealed partial class PeerColor : IObject + public sealed partial class PeerColor : PeerColorBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -18728,6 +18829,31 @@ namespace TL has_background_emoji_id = 0x2, } } + /// See + [TLDef(0xB9C0639A)] + public sealed partial class PeerColorCollectible : PeerColorBase + { + public Flags flags; + public long collectible_id; + public long gift_emoji_id; + public long background_emoji_id; + public int accent_color; + public int[] colors; + [IfFlag(0)] public int dark_accent_color; + [IfFlag(1)] public int[] dark_colors; + + [Flags] public enum Flags : uint + { + has_dark_accent_color = 0x1, + has_dark_colors = 0x2, + } + } + /// See + [TLDef(0xB8EA86A9)] + public sealed partial class InputPeerColorCollectible : PeerColorBase + { + public long collectible_id; + } /// Contains info about a color palette ». See Derived classes: , public abstract partial class Help_PeerColorSetBase : IObject { } @@ -20044,6 +20170,7 @@ namespace TL posts_search = 0x1000000, /// Represents payment for a separate prepaid upgrade of a gift. stargift_prepaid_upgrade = 0x2000000, + stargift_drop_original_details = 0x4000000, } } @@ -20488,6 +20615,7 @@ namespace TL limited_per_user = 0x100, /// Field has a value has_locked_until_date = 0x200, + peer_color_available = 0x400, } /// Identifier of the gift @@ -20500,7 +20628,7 @@ namespace TL public override Peer ReleasedBy => released_by; } /// Represents a collectible star gift, see here » for more info. See - [TLDef(0x1BEFE865)] + [TLDef(0xB0BF741B)] public sealed partial class StarGiftUnique : StarGiftBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -20539,6 +20667,8 @@ namespace TL [IfFlag(8)] public string value_currency; /// The current chat where the associated chat theme is installed, if any (gift-based themes can only be installed in one chat at a time). [IfFlag(10)] public Peer theme_peer; + [IfFlag(11)] public PeerColorBase peer_color; + [IfFlag(12)] public Peer host_id; [Flags] public enum Flags : uint { @@ -20564,6 +20694,10 @@ namespace TL theme_available = 0x200, /// Field has a value has_theme_peer = 0x400, + /// Field has a value + has_peer_color = 0x800, + /// Field has a value + has_host_id = 0x1000, } /// Identifier of the collectible gift. @@ -20951,11 +21085,13 @@ namespace TL } /// A preview of the possible attributes (chosen randomly) a gift » can receive after upgrading it to a collectible gift », see here » for more info. See - [TLDef(0x167BD90B)] + [TLDef(0x3DE1DFED)] public sealed partial class Payments_StarGiftUpgradePreview : IObject { /// Possible gift attributes public StarGiftAttribute[] sample_attributes; + public StarGiftUpgradePrice[] prices; + public StarGiftUpgradePrice[] next_prices; } /// Describes a list of users (or bots). See @@ -21002,7 +21138,7 @@ namespace TL } /// Represents a gift owned by a peer. See - [TLDef(0x19A9B572)] + [TLDef(0x8983A452)] public sealed partial class SavedStarGift : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -21035,6 +21171,7 @@ namespace TL [IfFlag(15)] public int[] collection_id; /// Hash to prepay for a gift upgrade separately ». [IfFlag(16)] public string prepaid_upgrade_hash; + [IfFlag(18)] public long drop_original_details_stars; [Flags] public enum Flags : uint { @@ -21074,6 +21211,8 @@ namespace TL has_prepaid_upgrade_hash = 0x10000, /// If set, someone already separately pre-paid for the upgrade of this gift. upgrade_separate = 0x20000, + /// Field has a value + has_drop_original_details_stars = 0x40000, } } @@ -21322,12 +21461,13 @@ namespace TL public StarGiftBase[] gifts; /// Offset for pagination, pass this to Payments_GetResaleStarGifts.offset to fetch the next results. [IfFlag(0)] public string next_offset; - /// Possible gift attributes. + /// Possible gift attributes, only set if Payments_GetResaleStarGifts.attributes_hash is set (on the first call, it must be equal to 0). [IfFlag(1)] public StarGiftAttribute[] attributes; /// Hash of the attributes field, pass this to Payments_GetResaleStarGifts.attributes_hash to avoid returning any attributes (flag not set) if they haven't changed. [IfFlag(1)] public long attributes_hash; /// Chats mentioned in the attributes. public Dictionary chats; + /// Indicates the total number of gifts that have a specific attribute, only set if Payments_GetResaleStarGifts.offset is empty (since this field is not related to the current result page but to all of them, it's only returned on the first page). [IfFlag(2)] public StarGiftAttributeCounter[] counters; /// Users mentioned in the attributes. public Dictionary users; @@ -21676,4 +21816,12 @@ namespace TL /// The slug from .slug. public string slug; } + + /// See + [TLDef(0x99EA331D)] + public sealed partial class StarGiftUpgradePrice : IObject + { + public DateTime date; + public long upgrade_stars; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index ce2d58b..95c6790 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -387,6 +387,15 @@ namespace TL mnc = mnc, }); + /// See + public static Task Auth_CheckPaidAuth(this Client client, string phone_number, string phone_code_hash, long form_id) + => client.Invoke(new Auth_CheckPaidAuth + { + phone_number = phone_number, + phone_code_hash = phone_code_hash, + form_id = form_id, + }); + /// Register device to receive PUSH notifications See Possible codes: 400 (details) /// Avoid receiving (silent and invisible background) notifications. Useful to save battery. /// Device token type, see PUSH updates for the possible values. @@ -1220,13 +1229,11 @@ namespace TL /// Update the accent color and background custom emoji » of the current account. See Possible codes: 400,403 (details) /// Whether to change the accent color emoji pattern of the profile page; otherwise, the accent color and emoji pattern of messages will be changed. /// ID of the accent color palette » to use (not RGB24, see here » for more info). - /// Custom emoji ID used in the accent color pattern. - public static Task Account_UpdateColor(this Client client, long? background_emoji_id = null, int? color = null, bool for_profile = false) + public static Task Account_UpdateColor(this Client client, PeerColorBase color = null, bool for_profile = false) => client.Invoke(new Account_UpdateColor { - flags = (Account_UpdateColor.Flags)((background_emoji_id != null ? 0x1 : 0) | (color != null ? 0x4 : 0) | (for_profile ? 0x2 : 0)), - color = color ?? default, - background_emoji_id = background_emoji_id ?? default, + flags = (Account_UpdateColor.Flags)((color != null ? 0x4 : 0) | (for_profile ? 0x2 : 0)), + color = color, }); /// Get a set of suggested custom emoji stickers that can be used in an accent color pattern. See @@ -1495,7 +1502,7 @@ namespace TL /// Maximum number of results to return, see pagination /// Hash from a previously returned , to avoid returning any result if the theme list hasn't changed. /// a null value means account.chatThemesNotModified - public static Task Account_GetUniqueGiftChatThemes(this Client client, int offset = default, int limit = int.MaxValue, long hash = default) + public static Task Account_GetUniqueGiftChatThemes(this Client client, string offset, int limit = int.MaxValue, long hash = default) => client.Invoke(new Account_GetUniqueGiftChatThemes { offset = offset, @@ -1561,6 +1568,14 @@ namespace TL documents = documents, }); + /// See + public static Task Users_SuggestBirthday(this Client client, InputUserBase id, Birthday birthday) + => client.Invoke(new Users_SuggestBirthday + { + id = id, + birthday = birthday, + }); + /// Get the telegram IDs of all contacts.
Returns an array of Telegram user IDs for all contacts (0 if a contact does not have an associated Telegram account or have hidden their account using privacy settings). See
/// Hash used for caching, for more info click here public static Task Contacts_GetContactIDs(this Client client, long hash = default) @@ -1720,14 +1735,15 @@ namespace TL /// First name /// Last name /// User's phone number, may be omitted to simply add the user to the contact list, without a phone number. - public static Task Contacts_AddContact(this Client client, InputUserBase id, string first_name, string last_name, string phone, bool add_phone_privacy_exception = false) + public static Task Contacts_AddContact(this Client client, InputUserBase id, string first_name, string last_name, string phone, TextWithEntities note = null, bool add_phone_privacy_exception = false) => client.Invoke(new Contacts_AddContact { - flags = (Contacts_AddContact.Flags)(add_phone_privacy_exception ? 0x1 : 0), + flags = (Contacts_AddContact.Flags)((note != null ? 0x2 : 0) | (add_phone_privacy_exception ? 0x1 : 0)), id = id, first_name = first_name, last_name = last_name, phone = phone, + note = note, }); /// If the add contact action bar is active, add that user as contact See Possible codes: 400 (details) @@ -1819,6 +1835,14 @@ namespace TL q = q, }); + /// See + public static Task Contacts_UpdateContactNote(this Client client, InputUserBase id, TextWithEntities note) + => client.Invoke(new Contacts_UpdateContactNote + { + id = id, + note = note, + }); + /// This method is only for basic Chat. See Terminology in the README to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Returns the list of messages by their IDs. See
[bots: ✓]
/// Message ID list public static Task Messages_GetMessages(this Client client, params InputMessage[] id) @@ -4490,7 +4514,7 @@ namespace TL /// The channel /// The message to react to /// The number of stars to send (each will increment the reaction counter by one). - /// Unique client message ID required to prevent message resending.
Note: this argument must be composed of a 64-bit integer where the first 32 bits are random, and the remaining 32 bits are equal to the current unixtime, i.e. uint64_t random_id = (time() << 32) | ((uint64_t)random_uint32_t()): this differs from the random_id format of all other methods in the API, which just take 64 random bits. You can use + /// Unique client message ID required to prevent message resending.
Note: this argument must be composed of a 64-bit integer where the lower 32 bits are random, and the higher 32 bits are equal to the current unixtime, i.e. uint64_t random_id = (time() << 32) | ((uint64_t)random_uint32_t()): this differs from the random_id format of all other methods in the API, which just take 64 random bits. You can use /// Each post with star reactions has a leaderboard with the top senders, but users can opt out of appearing there if they prefer more privacy. Not populating this field will use the default reaction privacy, stored on the server and synced to clients using (see here for more info). public static Task Messages_SendPaidReaction(this Client client, InputPeer peer, int msg_id, int count, long random_id, PaidReactionPrivacy private_ = null) => client.Invoke(new Messages_SendPaidReaction @@ -4682,6 +4706,108 @@ namespace TL reject_comment = reject_comment, }); + /// Get topics of a forum See Possible codes: 400 (details) + /// Peer + /// Search query + /// Offsets for pagination, for more info click here, date of the last message of the last found topic. Use 0 or any date in the future to get results from the last topic. + /// Offsets for pagination, for more info click here, ID of the last message of the last found topic (or initially 0). + /// Offsets for pagination, for more info click here, ID of the last found topic (or initially 0). + /// Maximum number of results to return, see pagination. For optimal performance, the number of returned topics is chosen by the server and can be smaller than the specified limit. + public static Task Messages_GetForumTopics(this Client client, InputPeer peer, DateTime offset_date = default, int offset_id = default, int offset_topic = default, int limit = int.MaxValue, string q = null) + => client.Invoke(new Messages_GetForumTopics + { + flags = (Messages_GetForumTopics.Flags)(q != null ? 0x1 : 0), + peer = peer, + q = q, + offset_date = offset_date, + offset_id = offset_id, + offset_topic = offset_topic, + limit = limit, + }); + + /// Get forum topics by their ID See Possible codes: 400 (details) + /// Peer + /// Topic IDs + public static Task Messages_GetForumTopicsByID(this Client client, InputPeer peer, params int[] topics) + => client.Invoke(new Messages_GetForumTopicsByID + { + peer = peer, + topics = topics, + }); + + /// Edit forum topic; requires manage_topics rights. See [bots: ✓] Possible codes: 400,403 (details) + /// Peer + /// Topic ID + /// If present, will update the topic title (maximum UTF-8 length: 128). + /// If present, updates the custom emoji used as topic icon. Telegram Premium users can use any custom emoji, other users can only use the custom emojis contained in the emoji pack. Pass 0 to switch to the fallback topic icon. + /// If present, will update the open/closed status of the topic. + /// If present, will hide/unhide the topic (only valid for the "General" topic, id=1). + public static Task Messages_EditForumTopic(this Client client, InputPeer peer, int topic_id, string title = null, long? icon_emoji_id = null, bool? closed = default, bool? hidden = default) + => client.Invoke(new Messages_EditForumTopic + { + flags = (Messages_EditForumTopic.Flags)((title != null ? 0x1 : 0) | (icon_emoji_id != null ? 0x2 : 0) | (closed != default ? 0x4 : 0) | (hidden != default ? 0x8 : 0)), + peer = peer, + topic_id = topic_id, + title = title, + icon_emoji_id = icon_emoji_id ?? default, + closed = closed ?? default, + hidden = hidden ?? default, + }); + + /// Pin or unpin forum topics See Possible codes: 400 (details) + /// Peer + /// Forum topic ID + /// Whether to pin or unpin the topic + public static Task Messages_UpdatePinnedForumTopic(this Client client, InputPeer peer, int topic_id, bool pinned) + => client.Invoke(new Messages_UpdatePinnedForumTopic + { + peer = peer, + topic_id = topic_id, + pinned = pinned, + }); + + /// Reorder pinned forum topics See Possible codes: 400 (details) + /// If not set, the order of only the topics present both server-side and in order will be changed (i.e. mentioning topics not pinned server-side in order will not pin them, and not mentioning topics pinned server-side will not unpin them).
If set, the entire server-side pinned topic list will be replaced with order (i.e. mentioning topics not pinned server-side in order will pin them, and not mentioning topics pinned server-side will unpin them) + /// Peer + /// Topic IDs » + public static Task Messages_ReorderPinnedForumTopics(this Client client, InputPeer peer, int[] order, bool force = false) + => client.Invoke(new Messages_ReorderPinnedForumTopics + { + flags = (Messages_ReorderPinnedForumTopics.Flags)(force ? 0x1 : 0), + peer = peer, + order = order, + }); + + /// Create a forum topic; requires manage_topics rights. See [bots: ✓] Possible codes: 400,403 (details) + /// Peer + /// Topic title (maximum UTF-8 length: 128) + /// If no custom emoji icon is specified, specifies the color of the fallback topic icon (RGB), one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, or 0xFB6F5F. + /// ID of the custom emoji used as topic icon. Telegram Premium users can use any custom emoji, other users can only use the custom emojis contained in the emoji pack. + /// Unique client message ID to prevent duplicate sending of the same event You can use + /// Create the topic as the specified peer + public static Task Messages_CreateForumTopic(this Client client, InputPeer peer, string title, long random_id, int? icon_color = null, InputPeer send_as = null, long? icon_emoji_id = null, bool title_missing = false) + => client.Invoke(new Messages_CreateForumTopic + { + flags = (Messages_CreateForumTopic.Flags)((icon_color != null ? 0x1 : 0) | (send_as != null ? 0x4 : 0) | (icon_emoji_id != null ? 0x8 : 0) | (title_missing ? 0x10 : 0)), + peer = peer, + title = title, + icon_color = icon_color ?? default, + icon_emoji_id = icon_emoji_id ?? default, + random_id = random_id, + send_as = send_as, + }); + + /// See + /// Delete message history of a forum topic See [bots: ✓] Possible codes: 400,403 (details) + /// Peer + /// Topic ID + public static Task Messages_DeleteTopicHistory(this Client client, InputPeer peer, int top_msg_id) + => client.InvokeAffected(new Messages_DeleteTopicHistory + { + peer = peer, + top_msg_id = top_msg_id, + }, peer is InputPeerChannel ipc ? ipc.channel_id : 0); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -5548,107 +5674,6 @@ namespace TL tabs = tabs, }); - /// Create a forum topic; requires manage_topics rights. See [bots: ✓] Possible codes: 400,403 (details) - /// The forum - /// Topic title (maximum UTF-8 length: 128) - /// If no custom emoji icon is specified, specifies the color of the fallback topic icon (RGB), one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, or 0xFB6F5F. - /// ID of the custom emoji used as topic icon. Telegram Premium users can use any custom emoji, other users can only use the custom emojis contained in the emoji pack. - /// Unique client message ID to prevent duplicate sending of the same event You can use - /// Create the topic as the specified peer - public static Task Channels_CreateForumTopic(this Client client, InputChannelBase channel, string title, long random_id, int? icon_color = null, InputPeer send_as = null, long? icon_emoji_id = null) - => client.Invoke(new Channels_CreateForumTopic - { - flags = (Channels_CreateForumTopic.Flags)((icon_color != null ? 0x1 : 0) | (send_as != null ? 0x4 : 0) | (icon_emoji_id != null ? 0x8 : 0)), - channel = channel, - title = title, - icon_color = icon_color ?? default, - icon_emoji_id = icon_emoji_id ?? default, - random_id = random_id, - send_as = send_as, - }); - - /// Get topics of a forum See Possible codes: 400 (details) - /// Supergroup - /// Search query - /// Offsets for pagination, for more info click here, date of the last message of the last found topic. Use 0 or any date in the future to get results from the last topic. - /// Offsets for pagination, for more info click here, ID of the last message of the last found topic (or initially 0). - /// Offsets for pagination, for more info click here, ID of the last found topic (or initially 0). - /// Maximum number of results to return, see pagination. For optimal performance, the number of returned topics is chosen by the server and can be smaller than the specified limit. - public static Task Channels_GetForumTopics(this Client client, InputChannelBase channel, DateTime offset_date = default, int offset_id = default, int offset_topic = default, int limit = int.MaxValue, string q = null) - => client.Invoke(new Channels_GetForumTopics - { - flags = (Channels_GetForumTopics.Flags)(q != null ? 0x1 : 0), - channel = channel, - q = q, - offset_date = offset_date, - offset_id = offset_id, - offset_topic = offset_topic, - limit = limit, - }); - - /// Get forum topics by their ID See Possible codes: 400 (details) - /// Forum - /// Topic IDs - public static Task Channels_GetForumTopicsByID(this Client client, InputChannelBase channel, params int[] topics) - => client.Invoke(new Channels_GetForumTopicsByID - { - channel = channel, - topics = topics, - }); - - /// Edit forum topic; requires manage_topics rights. See [bots: ✓] Possible codes: 400,403 (details) - /// Supergroup - /// Topic ID - /// If present, will update the topic title (maximum UTF-8 length: 128). - /// If present, updates the custom emoji used as topic icon. Telegram Premium users can use any custom emoji, other users can only use the custom emojis contained in the emoji pack. Pass 0 to switch to the fallback topic icon. - /// If present, will update the open/closed status of the topic. - /// If present, will hide/unhide the topic (only valid for the "General" topic, id=1). - public static Task Channels_EditForumTopic(this Client client, InputChannelBase channel, int topic_id, string title = null, long? icon_emoji_id = null, bool? closed = default, bool? hidden = default) - => client.Invoke(new Channels_EditForumTopic - { - flags = (Channels_EditForumTopic.Flags)((title != null ? 0x1 : 0) | (icon_emoji_id != null ? 0x2 : 0) | (closed != default ? 0x4 : 0) | (hidden != default ? 0x8 : 0)), - channel = channel, - topic_id = topic_id, - title = title, - icon_emoji_id = icon_emoji_id ?? default, - closed = closed ?? default, - hidden = hidden ?? default, - }); - - /// Pin or unpin forum topics See Possible codes: 400 (details) - /// Supergroup ID - /// Forum topic ID - /// Whether to pin or unpin the topic - public static Task Channels_UpdatePinnedForumTopic(this Client client, InputChannelBase channel, int topic_id, bool pinned) - => client.Invoke(new Channels_UpdatePinnedForumTopic - { - channel = channel, - topic_id = topic_id, - pinned = pinned, - }); - - /// Delete message history of a forum topic See [bots: ✓] Possible codes: 400,403 (details) - /// Forum - /// Topic ID - public static Task Channels_DeleteTopicHistory(this Client client, InputChannelBase channel, int top_msg_id) - => client.InvokeAffected(new Channels_DeleteTopicHistory - { - channel = channel, - top_msg_id = top_msg_id, - }, channel.ChannelId); - - /// Reorder pinned forum topics See Possible codes: 400 (details) - /// If not set, the order of only the topics present both server-side and in order will be changed (i.e. mentioning topics not pinned server-side in order will not pin them, and not mentioning topics pinned server-side will not unpin them).
If set, the entire server-side pinned topic list will be replaced with order (i.e. mentioning topics not pinned server-side in order will pin them, and not mentioning topics pinned server-side will unpin them) - /// Supergroup ID - /// Topic IDs » - public static Task Channels_ReorderPinnedForumTopics(this Client client, InputChannelBase channel, int[] order, bool force = false) - => client.Invoke(new Channels_ReorderPinnedForumTopics - { - flags = (Channels_ReorderPinnedForumTopics.Flags)(force ? 0x1 : 0), - channel = channel, - order = order, - }); - /// Enable or disable the native antispam system. See Possible codes: 400 (details) /// Supergroup ID. The specified supergroup must have at least telegram_antispam_group_size_min members to enable antispam functionality, as specified by the client configuration parameters. /// Enable or disable the native antispam system. @@ -6589,10 +6614,10 @@ namespace TL /// Only returns gifts within the specified collection ». /// Offset for pagination. /// Maximum number of results to return, see pagination - 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_unique = false, bool sort_by_value = false, bool exclude_upgradable = false, bool exclude_unupgradable = 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_unique = false, bool sort_by_value = false, bool exclude_upgradable = false, bool exclude_unupgradable = false, bool peer_color_available = false, bool exclude_hosted = false) => client.Invoke(new Payments_GetSavedStarGifts { - flags = (Payments_GetSavedStarGifts.Flags)((collection_id != null ? 0x40 : 0) | (exclude_unsaved ? 0x1 : 0) | (exclude_saved ? 0x2 : 0) | (exclude_unlimited ? 0x4 : 0) | (exclude_unique ? 0x10 : 0) | (sort_by_value ? 0x20 : 0) | (exclude_upgradable ? 0x80 : 0) | (exclude_unupgradable ? 0x100 : 0)), + flags = (Payments_GetSavedStarGifts.Flags)((collection_id != null ? 0x40 : 0) | (exclude_unsaved ? 0x1 : 0) | (exclude_saved ? 0x2 : 0) | (exclude_unlimited ? 0x4 : 0) | (exclude_unique ? 0x10 : 0) | (sort_by_value ? 0x20 : 0) | (exclude_upgradable ? 0x80 : 0) | (exclude_unupgradable ? 0x100 : 0) | (peer_color_available ? 0x200 : 0) | (exclude_hosted ? 0x400 : 0)), peer = peer, collection_id = collection_id ?? default, offset = offset, @@ -6648,10 +6673,10 @@ namespace TL /// Get collectible gifts of a specific type currently on resale, see here » for more info. See Possible codes: 400 (details) /// Sort gifts by price (ascending). /// Sort gifts by number (ascending). - /// If a previous call to the method was made and .attributes_hash was set, pass it here to avoid returning any results if they haven't changed. + /// If a previous call to the method was made and .attributes_hash was set, pass it here to avoid returning any results if they haven't changed.
Otherwise, set this flag and pass 0 to return .attributes_hash and .attributes, these two fields will not be set if this flag is not set. /// Mandatory identifier of the base gift from which the collectible gift was upgraded. /// Optionally filter gifts with the specified attributes. If no attributes of a specific type are specified, all attributes of that type are allowed. - /// Offset for pagination. + /// Offset for pagination. If not equal to an empty string, .counters will not be set to avoid returning the counters every time a new page is fetched. /// Maximum number of results to return, see pagination public static Task Payments_GetResaleStarGifts(this Client client, long gift_id, string offset, int limit = int.MaxValue, long? attributes_hash = null, StarGiftAttributeId[] attributes = null, bool sort_by_price = false, bool sort_by_num = false) => client.Invoke(new Payments_GetResaleStarGifts @@ -7057,12 +7082,13 @@ namespace TL /// Invalidate existing invite links /// Group call /// Whether all users will that join this group call are muted by default upon joining the group call - public static Task Phone_ToggleGroupCallSettings(this Client client, InputGroupCallBase call, bool? join_muted = default, bool reset_invite_hash = false) + public static Task Phone_ToggleGroupCallSettings(this Client client, InputGroupCallBase call, bool? join_muted = default, bool? messages_enabled = default, bool reset_invite_hash = false) => client.Invoke(new Phone_ToggleGroupCallSettings { - flags = (Phone_ToggleGroupCallSettings.Flags)((join_muted != default ? 0x1 : 0) | (reset_invite_hash ? 0x2 : 0)), + flags = (Phone_ToggleGroupCallSettings.Flags)((join_muted != default ? 0x1 : 0) | (messages_enabled != default ? 0x4 : 0) | (reset_invite_hash ? 0x2 : 0)), call = call, join_muted = join_muted ?? default, + messages_enabled = messages_enabled ?? default, }); /// Get info about a group call See Possible codes: 400,403 (details) @@ -7318,6 +7344,23 @@ namespace TL limit = limit, }); + /// See + public static Task Phone_SendGroupCallMessage(this Client client, InputGroupCallBase call, long random_id, TextWithEntities message) + => client.Invoke(new Phone_SendGroupCallMessage + { + call = call, + random_id = random_id, + message = message, + }); + + /// See + public static Task Phone_SendGroupCallEncryptedMessage(this Client client, InputGroupCallBase call, byte[] encrypted_message) + => client.Invoke(new Phone_SendGroupCallEncryptedMessage + { + call = call, + encrypted_message = encrypted_message, + }); + /// Get localization pack strings See Possible codes: 400 (details) /// Platform identifier (i.e. android, tdesktop, etc). /// Either an ISO 639-1 language code or a language pack name obtained from a language pack link. @@ -8359,6 +8402,14 @@ namespace TL.Methods public string mnc; } + [TLDef(0x56E59F9C)] + public sealed partial class Auth_CheckPaidAuth : IMethod + { + public string phone_number; + public string phone_code_hash; + public long form_id; + } + [TLDef(0xEC86017A)] public sealed partial class Account_RegisterDevice : IMethod { @@ -9003,16 +9054,14 @@ namespace TL.Methods public string[] codes; } - [TLDef(0x7CEFA15D)] + [TLDef(0x684D214E)] public sealed partial class Account_UpdateColor : IMethod { public Flags flags; - [IfFlag(2)] public int color; - [IfFlag(0)] public long background_emoji_id; + [IfFlag(2)] public PeerColorBase color; [Flags] public enum Flags : uint { - has_background_emoji_id = 0x1, for_profile = 0x2, has_color = 0x4, } @@ -9256,10 +9305,10 @@ namespace TL.Methods public long hash; } - [TLDef(0xFE74EF9F)] + [TLDef(0xE42CE9C9)] public sealed partial class Account_GetUniqueGiftChatThemes : IMethod { - public int offset; + public string offset; public int limit; public long hash; } @@ -9305,6 +9354,13 @@ namespace TL.Methods public InputDocument[] documents; } + [TLDef(0xFC533372)] + public sealed partial class Users_SuggestBirthday : IMethod + { + public InputUserBase id; + public Birthday birthday; + } + [TLDef(0x7ADC669D)] public sealed partial class Contacts_GetContactIDs : IMethod { @@ -9436,7 +9492,7 @@ namespace TL.Methods public bool enabled; } - [TLDef(0xE8F463D0)] + [TLDef(0xD9BA2E54)] public sealed partial class Contacts_AddContact : IMethod { public Flags flags; @@ -9444,10 +9500,12 @@ namespace TL.Methods public string first_name; public string last_name; public string phone; + [IfFlag(1)] public TextWithEntities note; [Flags] public enum Flags : uint { add_phone_privacy_exception = 0x1, + has_note = 0x2, } } @@ -9528,6 +9586,13 @@ namespace TL.Methods public string q; } + [TLDef(0x139F63FB)] + public sealed partial class Contacts_UpdateContactNote : IMethod + { + public InputUserBase id; + public TextWithEntities note; + } + [TLDef(0x63C66506)] public sealed partial class Messages_GetMessages : IMethod { @@ -11991,6 +12056,98 @@ namespace TL.Methods } } + [TLDef(0x3BA47BFF)] + public sealed partial class Messages_GetForumTopics : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(0)] public string q; + public DateTime offset_date; + public int offset_id; + public int offset_topic; + public int limit; + + [Flags] public enum Flags : uint + { + has_q = 0x1, + } + } + + [TLDef(0xAF0A4A08)] + public sealed partial class Messages_GetForumTopicsByID : IMethod + { + public InputPeer peer; + public int[] topics; + } + + [TLDef(0xCECC1134)] + public sealed partial class Messages_EditForumTopic : IMethod + { + public Flags flags; + public InputPeer peer; + public int topic_id; + [IfFlag(0)] public string title; + [IfFlag(1)] public long icon_emoji_id; + [IfFlag(2)] public bool closed; + [IfFlag(3)] public bool hidden; + + [Flags] public enum Flags : uint + { + has_title = 0x1, + has_icon_emoji_id = 0x2, + has_closed = 0x4, + has_hidden = 0x8, + } + } + + [TLDef(0x175DF251)] + public sealed partial class Messages_UpdatePinnedForumTopic : IMethod + { + public InputPeer peer; + public int topic_id; + public bool pinned; + } + + [TLDef(0x0E7841F0)] + public sealed partial class Messages_ReorderPinnedForumTopics : IMethod + { + public Flags flags; + public InputPeer peer; + public int[] order; + + [Flags] public enum Flags : uint + { + force = 0x1, + } + } + + [TLDef(0x2F98C3D5)] + public sealed partial class Messages_CreateForumTopic : IMethod + { + public Flags flags; + public InputPeer peer; + public string title; + [IfFlag(0)] public int icon_color; + [IfFlag(3)] public long icon_emoji_id; + public long random_id; + [IfFlag(2)] public InputPeer send_as; + + [Flags] public enum Flags : uint + { + has_icon_color = 0x1, + has_send_as = 0x4, + has_icon_emoji_id = 0x8, + title_missing = 0x10, + } + } + + [TLDef(0xD2816F10)] + public sealed partial class Messages_DeleteTopicHistory : IMethod + { + public InputPeer peer; + public int top_msg_id; + } + [TLDef(0xEDD4882A)] public sealed partial class Updates_GetState : IMethod { } @@ -12648,97 +12805,6 @@ namespace TL.Methods public bool tabs; } - [TLDef(0xF40C0224)] - public sealed partial class Channels_CreateForumTopic : IMethod - { - public Flags flags; - public InputChannelBase channel; - public string title; - [IfFlag(0)] public int icon_color; - [IfFlag(3)] public long icon_emoji_id; - public long random_id; - [IfFlag(2)] public InputPeer send_as; - - [Flags] public enum Flags : uint - { - has_icon_color = 0x1, - has_send_as = 0x4, - has_icon_emoji_id = 0x8, - } - } - - [TLDef(0x0DE560D1)] - public sealed partial class Channels_GetForumTopics : IMethod - { - public Flags flags; - public InputChannelBase channel; - [IfFlag(0)] public string q; - public DateTime offset_date; - public int offset_id; - public int offset_topic; - public int limit; - - [Flags] public enum Flags : uint - { - has_q = 0x1, - } - } - - [TLDef(0xB0831EB9)] - public sealed partial class Channels_GetForumTopicsByID : IMethod - { - public InputChannelBase channel; - public int[] topics; - } - - [TLDef(0xF4DFA185)] - public sealed partial class Channels_EditForumTopic : IMethod - { - public Flags flags; - public InputChannelBase channel; - public int topic_id; - [IfFlag(0)] public string title; - [IfFlag(1)] public long icon_emoji_id; - [IfFlag(2)] public bool closed; - [IfFlag(3)] public bool hidden; - - [Flags] public enum Flags : uint - { - has_title = 0x1, - has_icon_emoji_id = 0x2, - has_closed = 0x4, - has_hidden = 0x8, - } - } - - [TLDef(0x6C2D9026)] - public sealed partial class Channels_UpdatePinnedForumTopic : IMethod - { - public InputChannelBase channel; - public int topic_id; - public bool pinned; - } - - [TLDef(0x34435F2D)] - public sealed partial class Channels_DeleteTopicHistory : IMethod - { - public InputChannelBase channel; - public int top_msg_id; - } - - [TLDef(0x2950A18F)] - public sealed partial class Channels_ReorderPinnedForumTopics : IMethod - { - public Flags flags; - public InputChannelBase channel; - public int[] order; - - [Flags] public enum Flags : uint - { - force = 0x1, - } - } - [TLDef(0x68F3E4EB)] public sealed partial class Channels_ToggleAntiSpam : IMethod { @@ -13551,6 +13617,8 @@ namespace TL.Methods has_collection_id = 0x40, exclude_upgradable = 0x80, exclude_unupgradable = 0x100, + peer_color_available = 0x200, + exclude_hosted = 0x400, } } @@ -13925,17 +13993,19 @@ namespace TL.Methods public InputGroupCallBase call; } - [TLDef(0x74BBB43D)] + [TLDef(0xE9723804)] public sealed partial class Phone_ToggleGroupCallSettings : IMethod { public Flags flags; public InputGroupCallBase call; [IfFlag(0)] public bool join_muted; + [IfFlag(2)] public bool messages_enabled; [Flags] public enum Flags : uint { has_join_muted = 0x1, reset_invite_hash = 0x2, + has_messages_enabled = 0x4, } } @@ -14148,6 +14218,21 @@ namespace TL.Methods public int limit; } + [TLDef(0x87893014)] + public sealed partial class Phone_SendGroupCallMessage : IMethod + { + public InputGroupCallBase call; + public long random_id; + public TextWithEntities message; + } + + [TLDef(0xE5AFA56D)] + public sealed partial class Phone_SendGroupCallEncryptedMessage : IMethod + { + public InputGroupCallBase call; + public byte[] encrypted_message; + } + [TLDef(0xF2F2330A)] public sealed partial class Langpack_GetLangPack : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 00b0355..dec7eeb 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 = 214; // fetched 01/09/2025 11:20:56 + public const int Version = 216; // fetched 10/10/2025 20:01:17 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -216,7 +216,7 @@ namespace TL [0x45D5B021] = typeof(MessageActionGiftStars), [0xB00C47A2] = typeof(MessageActionPrizeStars), [0xF24DE7FA] = typeof(MessageActionStarGift), - [0x34F762F3] = typeof(MessageActionStarGiftUnique), + [0x95728543] = typeof(MessageActionStarGiftUnique), [0xAC1F1FCD] = typeof(MessageActionPaidMessagesRefunded), [0x84B88578] = typeof(MessageActionPaidMessagesPrice), [0x2FFE2F7A] = typeof(MessageActionConferenceCall), @@ -226,6 +226,7 @@ namespace TL [0x95DDCF69] = typeof(MessageActionSuggestedPostSuccess), [0x69F916F8] = typeof(MessageActionSuggestedPostRefund), [0xA8A3C699] = typeof(MessageActionGiftTon), + [0x2C8F2A25] = typeof(MessageActionSuggestBirthday), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -240,7 +241,7 @@ namespace TL [0xB2A2F663] = typeof(GeoPoint), [0x5E002502] = typeof(Auth_SentCode), [0x2390FE44] = typeof(Auth_SentCodeSuccess), - [0xD7A2FCF9] = typeof(Auth_SentCodePaymentRequired), + [0xE0955A3C] = typeof(Auth_SentCodePaymentRequired), [0x2EA2C0D4] = typeof(Auth_Authorization), [0x44747E9A] = typeof(Auth_AuthorizationSignUpRequired), [0xB434E2B8] = typeof(Auth_ExportedAuthorization), @@ -254,7 +255,7 @@ namespace TL [0xF47741F7] = typeof(PeerSettings), [0xA437C3ED] = typeof(WallPaper), [0xE0804116] = typeof(WallPaperNoFile), - [0xC577B5AD] = typeof(UserFull), + [0xA02BC13E] = typeof(UserFull), [0x145ADE0B] = typeof(Contact), [0xC13E3C50] = typeof(ImportedContact), [0x16D9703B] = typeof(ContactStatus), @@ -266,8 +267,8 @@ namespace TL [0x15BA6C40] = typeof(Messages_Dialogs), [0x71E094F3] = typeof(Messages_DialogsSlice), [0xF0E3E596] = typeof(Messages_DialogsNotModified), - [0x8C718E87] = typeof(Messages_Messages), - [0x762B263D] = typeof(Messages_MessagesSlice), + [0x1D73E7EA] = typeof(Messages_Messages), + [0x5F206716] = typeof(Messages_MessagesSlice), [0xC776BA4E] = typeof(Messages_ChannelMessages), [0x74535F21] = typeof(Messages_MessagesNotModified), [0x64FF9FD5] = typeof(Messages_Chats), @@ -294,7 +295,7 @@ namespace TL [0x1F2B0AFD] = typeof(UpdateNewMessage), [0x4E90BFD6] = typeof(UpdateMessageID), [0xA20DB0E5] = typeof(UpdateDeleteMessages), - [0xC01E857F] = typeof(UpdateUserTyping), + [0x2A17BF5C] = typeof(UpdateUserTyping), [0x83487AF0] = typeof(UpdateChatUserTyping), [0x07761198] = typeof(UpdateChatParticipants), [0xE5BDF8DE] = typeof(UpdateUserStatus), @@ -311,7 +312,7 @@ namespace TL [0xEBE46819] = typeof(UpdateServiceNotification), [0xEE3B272A] = typeof(UpdatePrivacy), [0x05492A13] = typeof(UpdateUserPhone), - [0x9C974FDF] = typeof(UpdateReadHistoryInbox), + [0x9E84BC99] = typeof(UpdateReadHistoryInbox), [0x2F2F21BF] = typeof(UpdateReadHistoryOutbox), [0x7F891213] = typeof(UpdateWebPage), [0xF8227181] = typeof(UpdateReadMessagesContents), @@ -398,8 +399,6 @@ namespace TL [0x6F7863F4] = typeof(UpdateRecentReactions), [0x86FCCF85] = typeof(UpdateMoveStickerSetToTop), [0xD5A41724] = typeof(UpdateMessageExtendedMedia), - [0x192EFBE3] = typeof(UpdateChannelPinnedTopic), - [0xFE198602] = typeof(UpdateChannelPinnedTopics), [0x20529438] = typeof(UpdateUser), [0xEC05B097] = typeof(UpdateAutoSaveSettings), [0x75B3B798] = typeof(UpdateStory), @@ -436,6 +435,10 @@ namespace TL [0x77B0E372] = typeof(UpdateReadMonoForumInbox), [0xA4A79376] = typeof(UpdateReadMonoForumOutbox), [0x9F812B08] = typeof(UpdateMonoForumNoPaidException), + [0x78C314E0] = typeof(UpdateGroupCallMessage), + [0xC957A766] = typeof(UpdateGroupCallEncryptedMessage), + [0x683B2C52] = typeof(UpdatePinnedForumTopic), + [0xDEF143D0] = typeof(UpdatePinnedForumTopics), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -505,6 +508,7 @@ namespace TL [0xB05AC6B1] = typeof(SendMessageChooseStickerAction), [0x25972BCB] = typeof(SendMessageEmojiInteraction), [0xB665902E] = typeof(SendMessageEmojiInteractionSeen), + [0x376D975C] = typeof(SendMessageTextDraftAction), [0xB3134D9D] = typeof(Contacts_Found), [0x0D09E07B] = typeof(InputPrivacyValueAllowContacts), [0x184B35CE] = typeof(InputPrivacyValueAllowAll), @@ -1082,7 +1086,7 @@ namespace TL [0xC3DFFC04] = typeof(ChatTheme), [0x3458F9C8] = typeof(ChatThemeUniqueGift), [0xE011E1C4] = null,//Account_ChatThemesNotModified - [0x16484857] = typeof(Account_ChatThemes), + [0xBE098173] = typeof(Account_ChatThemes), [0x7DBF8673] = typeof(SponsoredMessage), [0xFFDA656D] = typeof(Messages_SponsoredMessages), [0x1839490F] = null,//Messages_SponsoredMessagesEmpty @@ -1135,6 +1139,8 @@ namespace TL [0xF4997E42] = typeof(InputInvoiceBusinessBotTransferStars), [0xC39F5324] = typeof(InputInvoiceStarGiftResale), [0x9A0B48B8] = typeof(InputInvoiceStarGiftPrepaidUpgrade), + [0x3E77F614] = typeof(InputInvoicePremiumAuthCode), + [0x0923D8D1] = typeof(InputInvoiceStarGiftDropOriginalDetails), [0xAED0CBD9] = typeof(Payments_ExportedInvoice), [0xCFB9D957] = typeof(Messages_TranscribedAudio), [0x5334759C] = typeof(Help_PremiumPromo), @@ -1177,7 +1183,7 @@ namespace TL [0xFCFEB29C] = typeof(StickerKeyword), [0xB4073647] = typeof(Username), [0x023F109B] = typeof(ForumTopicDeleted), - [0x71701DA9] = typeof(ForumTopic), + [0xCDFF0ECA] = typeof(ForumTopic), [0x367617D3] = typeof(Messages_ForumTopics), [0x43B46B20] = typeof(DefaultHistoryTTL), [0x41BF109B] = typeof(ExportedContactToken), @@ -1265,6 +1271,8 @@ namespace TL [0xEDF3ADD0] = typeof(PublicForwardStory), [0x93037E20] = typeof(Stats_PublicForwards), [0xB54B5ACF] = typeof(PeerColor), + [0xB9C0639A] = typeof(PeerColorCollectible), + [0xB8EA86A9] = typeof(InputPeerColorCollectible), [0x26219A58] = typeof(Help_PeerColorSet), [0x767D61EB] = typeof(Help_PeerColorProfileSet), [0xADEC6EBE] = typeof(Help_PeerColorOption), @@ -1368,7 +1376,7 @@ namespace TL [0x94CE852A] = typeof(StarsGiveawayOption), [0x54236209] = typeof(StarsGiveawayWinnersOption), [0x80AC53C3] = typeof(StarGift), - [0x1BEFE865] = typeof(StarGiftUnique), + [0xB0BF741B] = typeof(StarGiftUnique), [0xA388A368] = null,//Payments_StarGiftsNotModified [0x2ED82995] = typeof(Payments_StarGifts), [0x7903E3D9] = typeof(MessageReportOption), @@ -1392,12 +1400,12 @@ namespace TL [0x13ACFF19] = typeof(StarGiftAttributePattern), [0xD93D859C] = typeof(StarGiftAttributeBackdrop), [0xE0BFF26C] = typeof(StarGiftAttributeOriginalDetails), - [0x167BD90B] = typeof(Payments_StarGiftUpgradePreview), + [0x3DE1DFED] = typeof(Payments_StarGiftUpgradePreview), [0x62D706B8] = typeof(Users_Users), [0x315A4974] = typeof(Users_UsersSlice), [0x416C56E8] = typeof(Payments_UniqueStarGift), [0x8C9A88AC] = typeof(Messages_WebPagePreview), - [0x19A9B572] = typeof(SavedStarGift), + [0x8983A452] = typeof(SavedStarGift), [0x95F389B1] = typeof(Payments_SavedStarGifts), [0x69279795] = typeof(InputSavedStarGiftUser), [0xF101AA7F] = typeof(InputSavedStarGiftChat), @@ -1444,6 +1452,7 @@ namespace TL [0x83268483] = null,//InputChatThemeEmpty [0xC93DE95C] = typeof(InputChatTheme), [0x87E5DFE4] = typeof(InputChatThemeUniqueGift), + [0x99EA331D] = typeof(StarGiftUpgradePrice), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 6fd580b..906cc13 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,8 +13,8 @@ WTelegramClient Wizou 0.0.0 - layer.214 - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 214 + layer.216 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 216 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From 40bcf69bfb609236c37eb5bca6c0b402172a0535 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 31 Oct 2025 00:30:02 +0100 Subject: [PATCH 31/54] Change UserStatusOffline.was_online to a DateTime --- src/TL.Schema.cs | 2 +- src/TL.Xtended.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 45807d0..dc0549c 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -963,7 +963,7 @@ namespace TL public sealed partial class UserStatusOffline : UserStatus { /// Time the user was last seen online - public int was_online; + public DateTime was_online; } /// Online status: last seen recently See [TLDef(0x7B197DC8)] diff --git a/src/TL.Xtended.cs b/src/TL.Xtended.cs index 630a370..9811d07 100644 --- a/src/TL.Xtended.cs +++ b/src/TL.Xtended.cs @@ -216,7 +216,7 @@ namespace TL /// a null value means userStatusEmpty = last seen a long time ago, more than a month (or blocked/deleted users) partial class UserStatus { internal abstract TimeSpan LastSeenAgo { get; } } partial class UserStatusOnline { internal override TimeSpan LastSeenAgo => TimeSpan.Zero; } - partial class UserStatusOffline { internal override TimeSpan LastSeenAgo => DateTime.UtcNow - new DateTime((was_online + 62135596800L) * 10000000, DateTimeKind.Utc); } + partial class UserStatusOffline { internal override TimeSpan LastSeenAgo => DateTime.UtcNow - was_online; } /// covers anything between 1 second and 2-3 days partial class UserStatusRecently { internal override TimeSpan LastSeenAgo => TimeSpan.FromDays(1); } /// between 2-3 and seven days @@ -690,8 +690,8 @@ namespace TL { System.Text.Json.JsonValueKind.True or System.Text.Json.JsonValueKind.False => new JsonBool { value = elem.GetBoolean() }, - System.Text.Json.JsonValueKind.Object => new JsonObject { value = elem.EnumerateObject().Select(FromJsonProperty).ToArray() }, - System.Text.Json.JsonValueKind.Array => new JsonArray { value = elem.EnumerateArray().Select(FromJsonElement).ToArray() }, + System.Text.Json.JsonValueKind.Object => new JsonObject { value = [.. elem.EnumerateObject().Select(FromJsonProperty)] }, + System.Text.Json.JsonValueKind.Array => new JsonArray { value = [.. elem.EnumerateArray().Select(FromJsonElement)] }, System.Text.Json.JsonValueKind.String => new JsonString { value = elem.GetString() }, System.Text.Json.JsonValueKind.Number => new JsonNumber { value = elem.GetDouble() }, _ => new JsonNull(), @@ -710,7 +710,7 @@ namespace TL sb.Append(i == 0 ? "" : ",").Append(value[i]); return sb.Append(']').ToString(); } - public object[] ToNativeArray() => value.Select(v => v.ToNative()).ToArray(); + public object[] ToNativeArray() => [.. value.Select(v => v.ToNative())]; public override object ToNative() { if (value.Length == 0) return Array.Empty(); From 9693037ef2023bfa08dcaf6dfa91933762eafc29 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 31 Oct 2025 00:31:30 +0100 Subject: [PATCH 32/54] Added missing DownloadFileAsync(doc, videoSize) --- src/Client.Helpers.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 6faa509..8a3768f 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -361,6 +361,18 @@ namespace WTelegram return thumbSize == null ? document.mime_type : "image/" + fileType; } + /// Download a document from Telegram into the outputStream + /// The document to download + /// Stream to write the file content to. This method does not close/dispose the stream + /// A specific size/version of the animated photo. Use photo.LargestVideoSize to download the largest version of the animated photo + /// (optional) Callback for tracking the progression of the transfer + /// MIME type of the document/thumbnail + public async Task DownloadFileAsync(Document document, Stream outputStream, VideoSize videoSize, ProgressCallback progress = null) + { + var fileLocation = document.ToFileLocation(videoSize); + return await DownloadFileAsync(fileLocation, outputStream, document.dc_id, videoSize.size, progress); + } + /// Download a file from Telegram into the outputStream /// Telegram file identifier, typically obtained with a .ToFileLocation() call /// Stream to write file content to. This method does not close/dispose the stream From 4ccfddd22e17b7f7178e20b04ade84881a575c43 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 31 Oct 2025 00:36:24 +0100 Subject: [PATCH 33/54] Collect: Fix Channel losing participants_count --- src/Services.cs | 7 ++++++- src/UpdateManager.cs | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Services.cs b/src/Services.cs index 4b8cd9d..a98c8fe 100644 --- a/src/Services.cs +++ b/src/Services.cs @@ -70,8 +70,13 @@ namespace TL foreach (var chat in chats) if (chat is not Channel channel) _chats[chat.ID] = chat; - else if (!channel.flags.HasFlag(Channel.Flags.min) || !_chats.TryGetValue(channel.id, out var prevChat) || prevChat is not Channel prevChannel || prevChannel.flags.HasFlag(Channel.Flags.min)) + else if (!_chats.TryGetValue(channel.id, out var prevChat) || prevChat is not Channel prevChannel) _chats[channel.id] = channel; + else if (!channel.flags.HasFlag(Channel.Flags.min) || prevChannel.flags.HasFlag(Channel.Flags.min)) + { + if (channel.participants_count == 0) channel.participants_count = prevChannel.participants_count; // non-min channel can lack this info + _chats[channel.id] = channel; + } else { // update previously full channel from min channel: const Channel.Flags updated_flags = (Channel.Flags)0x7FDC0BE0; diff --git a/src/UpdateManager.cs b/src/UpdateManager.cs index 1f7e328..9446054 100644 --- a/src/UpdateManager.cs +++ b/src/UpdateManager.cs @@ -566,7 +566,7 @@ namespace WTelegram /// Save the current state of the manager to JSON file /// File path to write - /// Note: This does not save the the content of collected Users/Chats dictionaries + /// Note: This does not save the content of collected Users/Chats dictionaries public void SaveState(string statePath) => System.IO.File.WriteAllText(statePath, System.Text.Json.JsonSerializer.Serialize(State, Helpers.JsonOptions)); public static Dictionary LoadState(string statePath) => !System.IO.File.Exists(statePath) ? null From 9ec2f31f72f603eac65882a3255fa8f50dcccd5e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 31 Oct 2025 18:21:11 +0100 Subject: [PATCH 34/54] Delete alt-session on AUTH_KEY_UNREGISTERED for renegociation --- .github/workflows/dev.yml | 31 +++++++++++++++++++++++-------- .github/workflows/release.yml | 23 ++++++++++++++++++++--- src/Client.cs | 4 ++-- src/WTelegramClient.csproj | 4 ++-- 4 files changed, 47 insertions(+), 15 deletions(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 222fc7a..de5e145 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -12,14 +12,16 @@ env: jobs: build: + permissions: + id-token: write # enable GitHub OIDC token issuance for this job runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: - fetch-depth: 100 + fetch-depth: 30 - name: Determine version run: | - git fetch --depth=100 --tags + git fetch --depth=30 --tags DESCR_TAG=$(git describe --tags) COMMITS=${DESCR_TAG#*-} COMMITS=${COMMITS%-*} @@ -29,19 +31,32 @@ jobs: if [[ "$RELEASE_VERSION" > "$NEXT_VERSION" ]] then VERSION=$RELEASE_VERSION; else VERSION=$NEXT_VERSION; fi echo Last tag: $LAST_TAG · Next version: $NEXT_VERSION · Release version: $RELEASE_VERSION · Build version: $VERSION echo "VERSION=$VERSION" >> $GITHUB_ENV - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.0.x + + # - name: Setup .NET + # uses: actions/setup-dotnet@v4 + # with: + # dotnet-version: 8.0.x - name: Pack - run: dotnet pack $PROJECT_PATH --configuration $CONFIGURATION -p:Version=$VERSION "-p:ReleaseNotes=\"$RELEASE_NOTES\"" --output packages + run: | + RELEASE_NOTES=${RELEASE_NOTES//$'\n'/%0A} + RELEASE_NOTES=${RELEASE_NOTES//\"/%22} + RELEASE_NOTES=${RELEASE_NOTES//,/%2C} + RELEASE_NOTES=${RELEASE_NOTES//;/%3B} + dotnet pack $PROJECT_PATH --configuration $CONFIGURATION -p:Version=$VERSION -p:ReleaseNotes="$RELEASE_NOTES" --output packages # - name: Upload artifact # uses: actions/upload-artifact@v4 # with: # name: packages # path: packages/*.nupkg + + - name: NuGet login (OIDC → temp API key) + uses: NuGet/login@v1 + id: login + with: + user: ${{ secrets.NUGET_USER }} - name: Nuget push - run: dotnet nuget push packages/*.nupkg --api-key ${{secrets.NUGETAPIKEY}} --skip-duplicate --source https://api.nuget.org/v3/index.json + run: dotnet nuget push packages/*.nupkg --api-key ${{steps.login.outputs.NUGET_API_KEY}} --skip-duplicate --source https://api.nuget.org/v3/index.json + - name: Deployment Notification env: JSON: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 052eafb..7bdbcd1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,7 +21,8 @@ jobs: build: runs-on: ubuntu-latest permissions: - contents: write # For git tag + contents: write # For git tag + id-token: write # enable GitHub OIDC token issuance for this job steps: - uses: actions/checkout@v4 with: @@ -37,19 +38,35 @@ jobs: if [[ "$RELEASE_VERSION" > "$NEXT_VERSION" ]] then VERSION=$RELEASE_VERSION; else VERSION=$NEXT_VERSION; fi echo Last tag: $LAST_TAG · Next version: $NEXT_VERSION · Release version: $RELEASE_VERSION · Build version: $VERSION echo "VERSION=$VERSION" >> $GITHUB_ENV + - name: Setup .NET uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x - name: Pack - run: dotnet pack $PROJECT_PATH --configuration $CONFIGURATION -p:Version=$VERSION "-p:ReleaseNotes=\"$RELEASE_NOTES\"" --output packages + run: | + RELEASE_NOTES=${RELEASE_NOTES//|/%0A} + RELEASE_NOTES=${RELEASE_NOTES// - /%0A- } + RELEASE_NOTES=${RELEASE_NOTES// /%0A%0A} + RELEASE_NOTES=${RELEASE_NOTES//$'\n'/%0A} + RELEASE_NOTES=${RELEASE_NOTES//\"/%22} + RELEASE_NOTES=${RELEASE_NOTES//,/%2C} + RELEASE_NOTES=${RELEASE_NOTES//;/%3B} + dotnet pack $PROJECT_PATH --configuration $CONFIGURATION -p:Version=$VERSION -p:ReleaseNotes="$RELEASE_NOTES" --output packages # - name: Upload artifact # uses: actions/upload-artifact@v4 # with: # name: packages # path: packages/*.nupkg + + - name: NuGet login (OIDC → temp API key) + uses: NuGet/login@v1 + id: login + with: + user: ${{ secrets.NUGET_USER }} - name: Nuget push - run: dotnet nuget push packages/*.nupkg --api-key ${{secrets.NUGETAPIKEY}} --skip-duplicate --source https://api.nuget.org/v3/index.json + run: dotnet nuget push packages/*.nupkg --api-key ${{steps.login.outputs.NUGET_API_KEY}} --skip-duplicate --source https://api.nuget.org/v3/index.json + - name: Git tag run: | git tag $VERSION diff --git a/src/Client.cs b/src/Client.cs index be24bf3..dc054e0 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1477,7 +1477,7 @@ namespace WTelegram writer.Write(0L); // int64 auth_key_id = 0 (Unencrypted) writer.Write(msgId); // int64 message_id writer.Write(0); // int32 message_data_length (to be patched) - Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name.TrimEnd('_')}..."); + Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name.TrimEnd('_')}"); writer.WriteTLObject(msg); // bytes message_data BinaryPrimitives.WriteInt32LittleEndian(memStream.GetBuffer().AsSpan(20), (int)memStream.Length - 24); // patch message_data_length } @@ -1629,7 +1629,7 @@ namespace WTelegram got503 = true; goto retry; } - else if (code == 401 && message == "SESSION_REVOKED" && !IsMainDC) // need to renegociate alt-DC auth + else if (code == 401 && !IsMainDC && message is "SESSION_REVOKED" or "AUTH_KEY_UNREGISTERED") // need to renegociate alt-DC auth { lock (_session) { diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 906cc13..bda3719 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -17,7 +17,7 @@ Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 216 Release Notes: -$(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) +$(ReleaseNotes) Copyright © Olivier Marcoux 2021-2025 MIT https://wiz0u.github.io/WTelegramClient @@ -27,7 +27,7 @@ $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "% git Telegram;MTProto;Client;Api;UserBot README.md - $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + $(ReleaseNotes) NETSDK1138;CS0419;CS1573;CS1591 TRACE;OBFUSCATION;MTPG From d6fdcab440f3c692724e95e4a85e4e5fdbd118de Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 5 Nov 2025 15:00:48 +0100 Subject: [PATCH 35/54] ToBytes TL.Serialization helper. Warning: do not use for long-term storage because TL structures can change in future layers and may not be deserializable --- generator/MTProtoGenerator.cs | 4 ++-- src/Client.cs | 2 +- src/Encryption.cs | 5 +---- src/TL.cs | 10 ++++++++++ 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/generator/MTProtoGenerator.cs b/generator/MTProtoGenerator.cs index c9e71f0..f326c13 100644 --- a/generator/MTProtoGenerator.cs +++ b/generator/MTProtoGenerator.cs @@ -181,11 +181,11 @@ public class MTProtoGenerator : IIncrementalGenerator break; case "System.Collections.Generic.Dictionary": readTL.AppendLine($"r.{member.Name} = reader.ReadTLDictionary();"); - writeTl.AppendLine($"writer.WriteTLVector({member.Name}.Values.ToArray());"); + writeTl.AppendLine($"writer.WriteTLVector({member.Name}?.Values.ToArray());"); break; case "System.Collections.Generic.Dictionary": readTL.AppendLine($"r.{member.Name} = reader.ReadTLDictionary();"); - writeTl.AppendLine($"writer.WriteTLVector({member.Name}.Values.ToArray());"); + writeTl.AppendLine($"writer.WriteTLVector({member.Name}?.Values.ToArray());"); break; case "object": readTL.AppendLine($"r.{member.Name} = reader.ReadTLObject();"); diff --git a/src/Client.cs b/src/Client.cs index dc054e0..47644e5 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1125,7 +1125,7 @@ namespace WTelegram { try { - var users = await this.Users_GetUsers(InputUser.Self); // this calls also reenable incoming Updates + var users = await this.Users_GetUsers(InputUser.Self); // this call also reenable incoming Updates var self = users[0] as User; if (self.id == long.Parse(botToken.Split(':')[0])) { diff --git a/src/Encryption.cs b/src/Encryption.cs index 4025d9e..501920b 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -247,10 +247,7 @@ namespace WTelegram var rsaParam = rsa.ExportParameters(false); if (rsaParam.Modulus[0] == 0) rsaParam.Modulus = rsaParam.Modulus[1..]; var publicKey = new RSAPublicKey { n = rsaParam.Modulus, e = rsaParam.Exponent }; - using var memStream = new MemoryStream(280); - using (var writer = new BinaryWriter(memStream)) - writer.WriteTLObject(publicKey); - var bareData = memStream.ToArray(); + var bareData = publicKey.ToBytes(); var fingerprint = BinaryPrimitives.ReadInt64LittleEndian(sha1.ComputeHash(bareData, 4, bareData.Length - 4).AsSpan(12)); // 64 lower-order bits of SHA1 PublicKeys[fingerprint] = publicKey; Helpers.Log(1, $"Loaded a public key with fingerprint {fingerprint:X}"); diff --git a/src/TL.cs b/src/TL.cs index 7c4b65d..b0e2f00 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.IO; using System.IO.Compression; using System.Linq; @@ -48,6 +49,15 @@ namespace TL public static class Serialization { + [EditorBrowsable(EditorBrowsableState.Never)] + public static byte[] ToBytes(this T obj) where T : IObject + { + using var ms = new MemoryStream(384); + using var writer = new BinaryWriter(ms); + writer.WriteTLObject(obj); + return ms.ToArray(); + } + public static void WriteTLObject(this BinaryWriter writer, T obj) where T : IObject { if (obj == null) { writer.WriteTLNull(typeof(T)); return; } From 30bc536ebc97ab6f7ff06d57be922ac6fb6bb61e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 9 Nov 2025 22:32:47 +0100 Subject: [PATCH 36/54] Removed annoying Peer implicit long operator (reverts #229) --- src/Client.cs | 4 ++-- src/TL.Xtended.cs | 1 - src/TL.cs | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 47644e5..18a9b29 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -589,7 +589,7 @@ namespace WTelegram { var msg = new _Message(reader.ReadInt64(), reader.ReadInt32(), null) { bytes = reader.ReadInt32() }; messages.Add(msg); - if ((msg.seq_no & 1) != 0) lock (_msgsToAck) _msgsToAck.Add(msg.msg_id); + if ((msg.seqno & 1) != 0) lock (_msgsToAck) _msgsToAck.Add(msg.msg_id); var pos = reader.BaseStream.Position; try { @@ -602,7 +602,7 @@ namespace WTelegram else { var obj = msg.body = reader.ReadTLObject(ctorNb); - Helpers.Log(1, $" → {obj.GetType().Name,-38} {MsgIdToStamp(msg.msg_id):u} {((msg.seq_no & 1) != 0 ? "" : "(svc)")} {((msg.msg_id & 2) == 0 ? "" : "NAR")}"); + Helpers.Log(1, $" → {obj.GetType().Name,-38} {MsgIdToStamp(msg.msg_id):u} {((msg.seqno & 1) != 0 ? "" : "(svc)")} {((msg.msg_id & 2) == 0 ? "" : "NAR")}"); } } catch (Exception ex) diff --git a/src/TL.Xtended.cs b/src/TL.Xtended.cs index 9811d07..e4ba9ad 100644 --- a/src/TL.Xtended.cs +++ b/src/TL.Xtended.cs @@ -148,7 +148,6 @@ namespace TL { public abstract long ID { get; } protected internal abstract IPeerInfo UserOrChat(Dictionary users, Dictionary chats); - public static implicit operator long(Peer peer) => peer.ID; } partial class PeerUser { diff --git a/src/TL.cs b/src/TL.cs index b0e2f00..135d972 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -218,10 +218,10 @@ namespace TL foreach (var msg in messages) { writer.Write(msg.msg_id); - writer.Write(msg.seq_no); + writer.Write(msg.seqno); var patchPos = writer.BaseStream.Position; writer.Write(0); // patched below - if ((msg.seq_no & 1) != 0) + if ((msg.seqno & 1) != 0) WTelegram.Helpers.Log(1, $" → {msg.body.GetType().Name.TrimEnd('_'),-38} #{(short)msg.msg_id.GetHashCode():X4}"); else WTelegram.Helpers.Log(1, $" → {msg.body.GetType().Name.TrimEnd('_'),-38}"); @@ -464,10 +464,10 @@ namespace TL } [TLDef(0x5BB8E511)] //message#5bb8e511 msg_id:long seqno:int bytes:int body:Object = Message - public sealed partial class _Message(long msgId, int seqNo, IObject obj) : IObject + public sealed partial class _Message(long msgId, int seqno, IObject obj) : IObject { public long msg_id = msgId; - public int seq_no = seqNo; + public int seqno = seqno; public int bytes; public IObject body = obj; } From 4ad2f0a212f35a0954738b39c5826b506323b603 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 13 Nov 2025 07:45:57 +0100 Subject: [PATCH 37/54] Fix incorrect bare type for DestroyAuthKey, RpcDropAnswer, DestroySession --- src/TL.MTProto.cs | 22 ++++++++++------------ src/TL.Table.cs | 5 ++++- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index 86d6e90..4b6e052 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -109,15 +109,13 @@ namespace TL public Int128 new_nonce_hash3; } - public enum DestroyAuthKeyRes : uint - { - ///See - Ok = 0xF660E1D4, - ///See - None = 0x0A9F2259, - ///See - Fail = 0xEA109B13, - } + public abstract partial class DestroyAuthKeyRes : IObject { } + [TLDef(0xF660E1D4)] //destroy_auth_key_ok#f660e1d4 = DestroyAuthKeyRes + public sealed partial class DestroyAuthKeyOk : DestroyAuthKeyRes { } + [TLDef(0x0A9F2259)] //destroy_auth_key_none#0a9f2259 = DestroyAuthKeyRes + public sealed partial class DestroyAuthKeyNone : DestroyAuthKeyRes { } + [TLDef(0xEA109B13)] //destroy_auth_key_fail#ea109b13 = DestroyAuthKeyRes + public sealed partial class DestroyAuthKeyFail : DestroyAuthKeyRes { } [TLDef(0x62D6B459)] //msgs_ack#62d6b459 msg_ids:Vector = MsgsAck public sealed partial class MsgsAck : IObject @@ -327,12 +325,12 @@ namespace TL }); public static Task DestroyAuthKey(this Client client) - => client.InvokeBare(new DestroyAuthKey + => client.Invoke(new DestroyAuthKey { }); public static Task RpcDropAnswer(this Client client, long req_msg_id) - => client.InvokeBare(new Methods.RpcDropAnswer + => client.Invoke(new Methods.RpcDropAnswer { req_msg_id = req_msg_id, }); @@ -357,7 +355,7 @@ namespace TL }); public static Task DestroySession(this Client client, long session_id) - => client.InvokeBare(new DestroySession + => client.Invoke(new DestroySession { session_id = session_id, }); diff --git a/src/TL.Table.cs b/src/TL.Table.cs index dec7eeb..de3f2d5 100644 --- a/src/TL.Table.cs +++ b/src/TL.Table.cs @@ -41,7 +41,9 @@ namespace TL [0x3BCBF734] = typeof(DhGenOk), [0x46DC1FB9] = typeof(DhGenRetry), [0xA69DAE02] = typeof(DhGenFail), - [0x7ABE77EC] = typeof(Methods.Ping), + [0xF660E1D4] = typeof(DestroyAuthKeyOk), + [0x0A9F2259] = typeof(DestroyAuthKeyNone), + [0xEA109B13] = typeof(DestroyAuthKeyFail), [0x62D6B459] = typeof(MsgsAck), [0xA7EFF811] = typeof(BadMsgNotification), [0xEDAB447B] = typeof(BadServerSalt), @@ -66,6 +68,7 @@ namespace TL [0x37982646] = typeof(IpPortSecret), [0x4679B65F] = typeof(AccessPointRule), [0x5A592A6C] = typeof(Help_ConfigSimple), + [0x7ABE77EC] = typeof(Methods.Ping), // from TL.SchemaExtensions: [0x3FEDD339] = typeof(True), [0xC4B9F9BB] = typeof(Error), From e923d65d535307ad733ced4c45dc82eca4259093 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 15 Nov 2025 18:21:15 +0100 Subject: [PATCH 38/54] Clamp TL stamps to 0..int.MaxValue, mapping edge to DateTime.Min/MaxValueaa --- src/TL.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/TL.cs b/src/TL.cs index 135d972..0bb4583 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -325,13 +325,14 @@ namespace TL } internal static void WriteTLStamp(this BinaryWriter writer, DateTime datetime) - => writer.Write(datetime == DateTime.MaxValue ? int.MaxValue : (int)(datetime.ToUniversalTime().Ticks / 10000000 - 62135596800L)); + => writer.Write((int)Math.Min(Math.Max(datetime.ToUniversalTime().Ticks / 10000000 - 62135596800L, 0), int.MaxValue)); - internal static DateTime ReadTLStamp(this BinaryReader reader) + internal static DateTime ReadTLStamp(this BinaryReader reader) => reader.ReadInt32() switch { - int unixstamp = reader.ReadInt32(); - return unixstamp == int.MaxValue ? DateTime.MaxValue : new((unixstamp + 62135596800L) * 10000000, DateTimeKind.Utc); - } + <= 0 => default, + int.MaxValue => DateTime.MaxValue, + int unixstamp => new((unixstamp + 62135596800L) * 10000000, DateTimeKind.Utc) + }; internal static void WriteTLString(this BinaryWriter writer, string str) { From bfc8e0e1b5f21c34572080479534cb1272262065 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 15 Nov 2025 19:39:10 +0100 Subject: [PATCH 39/54] .NET 10 compatibility --- src/Encryption.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Encryption.cs b/src/Encryption.cs index 501920b..c24845e 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -304,8 +304,8 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB var output = new byte[input.Length]; var prevBytes = (byte[])aes_iv.Clone(); var span = MemoryMarshal.Cast(input); - var sout = MemoryMarshal.Cast(output); - var prev = MemoryMarshal.Cast(prevBytes); + var sout = MemoryMarshal.Cast(output.AsSpan()); + var prev = MemoryMarshal.Cast(prevBytes.AsSpan()); if (!encrypt) { (prev[2], prev[0]) = (prev[0], prev[2]); (prev[3], prev[1]) = (prev[1], prev[3]); } for (int i = 0, count = input.Length / 8; i < count;) { @@ -556,7 +556,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB { count = count + 15 & ~15; var span = MemoryMarshal.Cast(buffer.AsSpan(offset, count)); - var prev = MemoryMarshal.Cast(_prevBytes); + var prev = MemoryMarshal.Cast(_prevBytes.AsSpan()); for (offset = 0, count /= 8; offset < count;) { prev[0] ^= span[offset]; prev[1] ^= span[offset + 1]; From 208ab626c1a1037275e3f4a5c5594d667df44ee7 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 15 Nov 2025 22:45:36 +0100 Subject: [PATCH 40/54] API Layer 218: Stargift auctions, Story Live broadcast, Paid messages in Live/group calls, Message schedule_repeat_period, Saved Music privacy key, and more... --- README.md | 2 +- src/Services.cs | 2 +- src/TL.Schema.cs | 350 +++++++++++++++++++++++++++++++++---- src/TL.SchemaFuncs.cs | 237 ++++++++++++++++++++++--- src/TL.Table.cs | 55 ++++-- src/WTelegramClient.csproj | 4 +- 6 files changed, 576 insertions(+), 74 deletions(-) diff --git a/README.md b/README.md index 895eedf..85bfbb0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-216-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-218-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/Services.cs b/src/Services.cs index a98c8fe..cac857b 100644 --- a/src/Services.cs +++ b/src/Services.cs @@ -56,7 +56,7 @@ namespace TL prevUser.lang_code = user.lang_code; // tdlib: updated if present ; tdesktop: ignored prevUser.emoji_status = user.emoji_status; // tdlib/tdesktop: updated //prevUser.usernames = user.usernames; // tdlib/tdesktop: not updated - if (user.stories_max_id > 0) + if (user.stories_max_id != null) prevUser.stories_max_id = user.stories_max_id; // tdlib: updated if > 0 ; tdesktop: not updated prevUser.color = user.color; // tdlib/tdesktop: updated prevUser.profile_color = user.profile_color; // tdlib/tdesktop: unimplemented yet diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index dc0549c..d5800b5 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -116,9 +116,10 @@ namespace TL /// Object defines a contact from the user's phone book. See Derived classes: public abstract partial class InputContact : IObject { } /// Phone contact. See - [TLDef(0xF392B7F4)] + [TLDef(0x6A1DC4BE)] public sealed partial class InputPhoneContact : InputContact { + public Flags flags; /// An arbitrary 64-bit integer: it should be set, for example, to an incremental number when using Contacts_ImportContacts, in order to retry importing only the contacts that weren't imported successfully, according to the client_ids returned in .retry_contacts. public long client_id; /// Phone number @@ -127,6 +128,13 @@ namespace TL public string first_name; /// Contact's last name public string last_name; + [IfFlag(0)] public TextWithEntities note; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_note = 0x1, + } } /// Defines a file uploaded by the client. See Derived classes: , , @@ -781,7 +789,7 @@ namespace TL public long id; } /// Indicates info about a certain user. See - [TLDef(0x020B1422)] + [TLDef(0x31774388)] public sealed partial class User : UserBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -817,7 +825,7 @@ namespace TL /// 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; + [IfFlag(37)] public RecentStory stories_max_id; /// The user's accent color. [IfFlag(40)] public PeerColorBase color; /// The user's profile color. @@ -1090,7 +1098,7 @@ namespace TL public override string Title => title; } /// Channel/supergroup info See - [TLDef(0xFE685355)] + [TLDef(0x1C32B11C)] public sealed partial class Channel : ChatBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1122,7 +1130,7 @@ namespace TL /// Additional usernames [IfFlag(32)] public Username[] usernames; /// ID of the maximum read story. - [IfFlag(36)] public int stories_max_id; + [IfFlag(36)] public RecentStory stories_max_id; /// The channel's accent color. [IfFlag(39)] public PeerColorBase color; /// The channel's profile color. @@ -1808,7 +1816,7 @@ namespace TL public override Peer Peer => peer_id; } /// A message See - [TLDef(0x9815CEC8)] + [TLDef(0xB92F76CF)] public sealed partial class Message : MessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1873,6 +1881,7 @@ namespace TL [IfFlag(38)] public long paid_message_stars; /// Used to suggest a post to a channel, see here » for more info on the full flow. [IfFlag(39)] public SuggestedPost suggested_post; + [IfFlag(42)] public int schedule_repeat_period; [Flags] public enum Flags : uint { @@ -1958,6 +1967,8 @@ namespace TL paid_suggested_post_stars = 0x100, /// Set if this is a suggested channel post » that was paid using Toncoins. paid_suggested_post_ton = 0x200, + /// Field has a value + has_schedule_repeat_period = 0x400, } /// ID of the message @@ -2388,6 +2399,18 @@ namespace TL has_completions = 0x1, } } + /// See + [TLDef(0xCA5CAB89)] + public sealed partial class MessageMediaVideoStream : MessageMedia + { + public Flags flags; + public InputGroupCallBase call; + + [Flags] public enum Flags : uint + { + rtmp_stream = 0x1, + } + } /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , /// a value means messageActionEmpty @@ -2702,7 +2725,7 @@ namespace TL public string text; } /// Info about a gifted Telegram Premium subscription See - [TLDef(0x6C6274FA)] + [TLDef(0x48E91302)] public sealed partial class MessageActionGiftPremium : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -2711,8 +2734,7 @@ namespace TL public string currency; /// Price of the gift in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). public long amount; - /// Duration of the gifted Telegram Premium subscription. - public int months; + public int days; /// If the gift was bought using a cryptocurrency, the cryptocurrency name. [IfFlag(0)] public string crypto_currency; /// If the gift was bought using a cryptocurrency, price of the gift in the smallest units of a cryptocurrency. @@ -2809,15 +2831,14 @@ namespace TL } } /// Contains a Telegram Premium giftcode link. See - [TLDef(0x56D03994)] + [TLDef(0x31C48347)] public sealed partial class MessageActionGiftCode : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Identifier of the channel/supergroup that created the gift code either directly or through a giveaway: if we import this giftcode link, we will also automatically boost this channel/supergroup. [IfFlag(1)] public Peer boost_peer; - /// Duration in months of the gifted Telegram Premium subscription. - public int months; + public int days; /// Slug of the Telegram Premium giftcode link public string slug; /// Three-letter ISO 4217 currency code @@ -2967,7 +2988,7 @@ namespace TL } } /// You received a gift, see here » for more info. See - [TLDef(0xF24DE7FA)] + [TLDef(0xDB596550)] public sealed partial class MessageActionStarGift : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -2992,6 +3013,7 @@ namespace TL [IfFlag(14)] public string prepaid_upgrade_hash; /// For separate upgrades, the identifier of the message with the gift whose upgrade was prepaid (only valid for the receiver of the service message). [IfFlag(15)] public int gift_msg_id; + [IfFlag(18)] public Peer to_id; [Flags] public enum Flags : uint { @@ -3025,6 +3047,9 @@ namespace TL has_gift_msg_id = 0x8000, /// This service message is the notification of a separate pre-payment for the upgrade of a gift we own. upgrade_separate = 0x10000, + auction_acquired = 0x20000, + /// Field has a value + has_to_id = 0x40000, } } /// A gift » was upgraded to a collectible gift ». See @@ -5490,20 +5515,20 @@ namespace TL public int version; } /// A new groupcall was started See - [TLDef(0x97D64341)] + [TLDef(0x9D2216E0)] public sealed partial class UpdateGroupCall : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// The channel/supergroup where this group call or livestream takes place - [IfFlag(0)] public long chat_id; + [IfFlag(1)] public Peer peer; /// Info about the group call or livestream public GroupCallBase call; [Flags] public enum Flags : uint { - /// Field has a value - has_chat_id = 0x1, + /// Field has a value + has_peer = 0x2, + live_story = 0x4, } } /// The Time-To-Live for messages sent by the current user in a specific chat has changed See @@ -6205,13 +6230,11 @@ namespace TL } } /// See - [TLDef(0x78C314E0)] + [TLDef(0xD8326F0D)] public sealed partial class UpdateGroupCallMessage : Update { public InputGroupCallBase call; - public Peer from_id; - public long random_id; - public TextWithEntities message; + public GroupCallMessage message; } /// See [TLDef(0xC957A766)] @@ -6247,6 +6270,27 @@ namespace TL has_order = 0x1, } } + /// See + [TLDef(0x3E85E92C)] + public sealed partial class UpdateDeleteGroupCallMessages : Update + { + public InputGroupCallBase call; + public int[] messages; + } + /// See + [TLDef(0x48E246C2)] + public sealed partial class UpdateStarGiftAuctionState : Update + { + public long gift_id; + public StarGiftAuctionStateBase state; + } + /// See + [TLDef(0xDC58F31E)] + public sealed partial class UpdateStarGiftAuctionUserState : Update + { + public long gift_id; + public StarGiftAuctionUserState user_state; + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -7398,6 +7442,8 @@ namespace TL StarGiftsAutoSave = 0xE1732341, ///Who can send you messages without paying, if paid messages » are enabled. NoPaidMessages = 0xBDC597B4, + ///See + SavedMusic = 0x4DBE9226, } /// Privacy keys together with privacy rules » indicate what can or can't someone do and are specified by a constructor, and its input counterpart . See @@ -7429,6 +7475,8 @@ namespace TL StarGiftsAutoSave = 0x2CA4FDF8, ///Who can send you messages without paying, if paid messages » are enabled. NoPaidMessages = 0x17D348D2, + ///See + SavedMusic = 0xFF7A571B, } /// Privacy rules indicate who can or can't do something and are specified by a , and its input counterpart . See Derived classes: , , , , , , , , , , , @@ -14504,6 +14552,16 @@ namespace TL /// Gifts in the collection. public DocumentBase[] icons; } + /// See + [TLDef(0x034986AB)] + public sealed partial class WebPageAttributeStarGiftAuction : WebPageAttribute + { + public StarGiftBase gift; + public DateTime end_date; + public int center_color; + public int edge_color; + public int text_color; + } /// How users voted in a poll See [TLDef(0x4899484E)] @@ -15273,7 +15331,7 @@ namespace TL public override long AccessHash => access_hash; } /// Info about a group call or livestream See - [TLDef(0x553B0BA1)] + [TLDef(0xEFB2B617)] public sealed partial class GroupCall : GroupCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -15300,6 +15358,8 @@ namespace TL public int version; /// Invitation link for the conference. [IfFlag(16)] public string invite_link; + [IfFlag(20)] public long send_paid_messages_stars; + [IfFlag(21)] public Peer default_send_as; [Flags] public enum Flags : uint { @@ -15338,6 +15398,10 @@ namespace TL messages_enabled = 0x20000, can_change_messages_enabled = 0x40000, min = 0x80000, + /// Field has a value + has_send_paid_messages_stars = 0x100000, + /// Field has a value + has_default_send_as = 0x200000, } /// Group call ID @@ -15373,7 +15437,7 @@ namespace TL } /// Info about a group call participant See - [TLDef(0xEBA636FE)] + [TLDef(0x2A3DC7AC)] public sealed partial class GroupCallParticipant : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -15396,6 +15460,7 @@ namespace TL [IfFlag(6)] public GroupCallParticipantVideo video; /// Info about the screen sharing stream the participant is currently broadcasting [IfFlag(14)] public GroupCallParticipantVideo presentation; + [IfFlag(16)] public long paid_stars_total; [Flags] public enum Flags : uint { @@ -15431,6 +15496,8 @@ namespace TL has_presentation = 0x4000, /// Whether this participant is currently broadcasting video video_joined = 0x8000, + /// Field has a value + has_paid_stars_total = 0x10000, } } @@ -16553,6 +16620,24 @@ namespace TL { public InputSavedStarGift stargift; } + /// See + [TLDef(0x1ECAFA10)] + public sealed partial class InputInvoiceStarGiftAuctionBid : InputInvoice + { + public Flags flags; + [IfFlag(3)] public InputPeer peer; + public long gift_id; + public long bid_amount; + [IfFlag(1)] public TextWithEntities message; + + [Flags] public enum Flags : uint + { + hide_name = 0x1, + has_message = 0x2, + update_bid = 0x4, + has_peer = 0x8, + } + } /// Exported invoice deep link See [TLDef(0xAED0CBD9)] @@ -17819,6 +17904,7 @@ namespace TL { /// Whether this story can only be viewed by our close friends, see here » for more info close_friends = 0x100, + live = 0x200, } /// Story ID @@ -18391,7 +18477,7 @@ namespace TL } /// Contains info about a Telegram Premium giftcode link. See - [TLDef(0x284A1096)] + [TLDef(0xEB983F8F)] public sealed partial class Payments_CheckedGiftCode : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -18404,8 +18490,7 @@ namespace TL [IfFlag(0)] public long to_id; /// Creation date of the gift code. public DateTime date; - /// Duration in months of the gifted Telegram Premium subscription. - public int months; + public int days; /// When was the giftcode imported, if it was imported. [IfFlag(1)] public DateTime used_date; /// Mentioned chats @@ -20171,6 +20256,8 @@ namespace TL /// Represents payment for a separate prepaid upgrade of a gift. stargift_prepaid_upgrade = 0x2000000, stargift_drop_original_details = 0x4000000, + phonegroup_message = 0x8000000, + stargift_auction_bid = 0x10000000, } } @@ -20555,7 +20642,7 @@ namespace TL public virtual Peer ReleasedBy => default; } /// Represents a star gift, see here » for more info. See - [TLDef(0x80AC53C3)] + [TLDef(0x1B9A4D7F)] public sealed partial class StarGift : StarGiftBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -20592,6 +20679,8 @@ namespace TL [IfFlag(8)] public int per_user_remains; /// If set, the specified gift possibly cannot be sent until the specified date, see here » for the full flow. [IfFlag(9)] public DateTime locked_until_date; + [IfFlag(11)] public string auction_slug; + [IfFlag(11)] public int gifts_per_round; [Flags] public enum Flags : uint { @@ -20616,6 +20705,7 @@ namespace TL /// Field has a value has_locked_until_date = 0x200, peer_color_available = 0x400, + auction = 0x800, } /// Identifier of the gift @@ -21373,6 +21463,7 @@ namespace TL disallow_unique_stargifts = 0x4, /// Disallow the reception of gifted Telegram Premium subscriptions ». disallow_premium_gifts = 0x8, + disallow_stargifts_from_channels = 0x10, } } @@ -21538,13 +21629,13 @@ namespace TL } /// A completed todo list » item. See - [TLDef(0x4CC120B7)] + [TLDef(0x221BB5E4)] public sealed partial class TodoCompletion : IObject { /// The ID of the completed item. public int id; /// ID of the user that completed the item. - public long completed_by; + public Peer completed_by; /// When was the item completed. public DateTime date; } @@ -21824,4 +21915,203 @@ namespace TL public DateTime date; public long upgrade_stars; } + + /// See + [TLDef(0x1A8AFC7E)] + public sealed partial class GroupCallMessage : IObject + { + public Flags flags; + public int id; + public Peer from_id; + public DateTime date; + public TextWithEntities message; + [IfFlag(0)] public long paid_message_stars; + + [Flags] public enum Flags : uint + { + has_paid_message_stars = 0x1, + from_admin = 0x2, + } + } + + /// See + [TLDef(0xEE430C85)] + public sealed partial class GroupCallDonor : IObject + { + public Flags flags; + [IfFlag(3)] public Peer peer_id; + public long stars; + + [Flags] public enum Flags : uint + { + top = 0x1, + my = 0x2, + anonymous = 0x4, + has_peer_id = 0x8, + } + } + + /// See + [TLDef(0x9D1DBD26)] + public sealed partial class Phone_GroupCallStars : IObject, IPeerResolver + { + public long total_stars; + public GroupCallDonor[] top_donors; + public Dictionary chats; + public Dictionary users; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); + } + + /// See + [TLDef(0x711D692D)] + public sealed partial class RecentStory : IObject + { + public Flags flags; + [IfFlag(1)] public int max_id; + + [Flags] public enum Flags : uint + { + live = 0x1, + has_max_id = 0x2, + } + } + + /// See + [TLDef(0x310240CC)] + public sealed partial class AuctionBidLevel : IObject + { + public int pos; + public long amount; + public DateTime date; + } + + /// See + /// a value means starGiftAuctionStateNotModified + public abstract partial class StarGiftAuctionStateBase : IObject + { + public virtual DateTime StartDate => default; + public virtual DateTime EndDate => default; + } + /// See + [TLDef(0x5DB04F4B)] + public sealed partial class StarGiftAuctionState : StarGiftAuctionStateBase + { + public int version; + public DateTime start_date; + public DateTime end_date; + public long min_bid_amount; + public AuctionBidLevel[] bid_levels; + public long[] top_bidders; + public DateTime next_round_at; + public int gifts_left; + public int current_round; + public int total_rounds; + + public override DateTime StartDate => start_date; + public override DateTime EndDate => end_date; + } + /// See + [TLDef(0x7D967C3A)] + public sealed partial class StarGiftAuctionStateFinished : StarGiftAuctionStateBase + { + public DateTime start_date; + public DateTime end_date; + public long average_price; + + public override DateTime StartDate => start_date; + public override DateTime EndDate => end_date; + } + + /// See + [TLDef(0x2EEED1C4)] + public sealed partial class StarGiftAuctionUserState : IObject + { + public Flags flags; + [IfFlag(0)] public long bid_amount; + [IfFlag(0)] public DateTime bid_date; + [IfFlag(0)] public long min_bid_amount; + [IfFlag(0)] public Peer bid_peer; + public int acquired_count; + + [Flags] public enum Flags : uint + { + has_bid_amount = 0x1, + returned = 0x2, + } + } + + /// See + [TLDef(0x0E98E474)] + public sealed partial class Payments_StarGiftAuctionState : IObject + { + public StarGiftBase gift; + public StarGiftAuctionStateBase state; + public StarGiftAuctionUserState user_state; + public int timeout; + public Dictionary users; + } + + /// See + [TLDef(0xAB60E20B)] + public sealed partial class StarGiftAuctionAcquiredGift : IObject + { + public Flags flags; + public Peer peer; + public DateTime date; + public long bid_amount; + public int round; + public int pos; + [IfFlag(1)] public TextWithEntities message; + + [Flags] public enum Flags : uint + { + name_hidden = 0x1, + has_message = 0x2, + } + } + + /// See + [TLDef(0x7D5BD1F0)] + public sealed partial class Payments_StarGiftAuctionAcquiredGifts : IObject, IPeerResolver + { + public StarGiftAuctionAcquiredGift[] gifts; + public Dictionary users; + public Dictionary chats; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); + } + + /// See + [TLDef(0xD31BC45D)] + public sealed partial class StarGiftActiveAuctionState : IObject + { + public StarGiftBase gift; + public StarGiftAuctionStateBase state; + public StarGiftAuctionUserState user_state; + } + + /// See + /// a value means payments.starGiftActiveAuctionsNotModified + [TLDef(0x97F187D8)] + public sealed partial class Payments_StarGiftActiveAuctions : IObject + { + public StarGiftActiveAuctionState[] auctions; + public Dictionary users; + } + + /// See + public abstract partial class InputStarGiftAuctionBase : IObject { } + /// See + [TLDef(0x02E16C98)] + public sealed partial class InputStarGiftAuction : InputStarGiftAuctionBase + { + public long gift_id; + } + /// See + [TLDef(0x7AB58308)] + public sealed partial class InputStarGiftAuctionSlug : InputStarGiftAuctionBase + { + public string slug; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 95c6790..9d21f96 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -2009,10 +2009,10 @@ namespace TL /// Specifies a message effect » to use for the message. /// For paid messages », specifies the amount of Telegram Stars the user has agreed to pay in order to send the message. /// Used to suggest a post to a channel, see here » for more info on the full flow. - public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, SuggestedPost suggested_post = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) + public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, SuggestedPost suggested_post = null, int? schedule_repeat_period = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_SendMessage { - flags = (Messages_SendMessage.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (suggested_post != null ? 0x400000 : 0) | (no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), + flags = (Messages_SendMessage.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (suggested_post != null ? 0x400000 : 0) | (schedule_repeat_period != null ? 0x1000000 : 0) | (no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), peer = peer, reply_to = reply_to, message = message, @@ -2020,6 +2020,7 @@ namespace TL reply_markup = reply_markup, entities = entities, schedule_date = schedule_date ?? default, + schedule_repeat_period = schedule_repeat_period ?? default, send_as = send_as, quick_reply_shortcut = quick_reply_shortcut, effect = effect ?? default, @@ -2048,10 +2049,10 @@ namespace TL /// Specifies a message effect » to use for the message. /// For paid messages », specifies the amount of Telegram Stars the user has agreed to pay in order to send the message. /// Used to suggest a post to a channel, see here » for more info on the full flow. - public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, SuggestedPost suggested_post = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) + public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, SuggestedPost suggested_post = null, int? schedule_repeat_period = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_SendMedia { - flags = (Messages_SendMedia.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (suggested_post != null ? 0x400000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), + flags = (Messages_SendMedia.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (suggested_post != null ? 0x400000 : 0) | (schedule_repeat_period != null ? 0x1000000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), peer = peer, reply_to = reply_to, media = media, @@ -2060,6 +2061,7 @@ namespace TL reply_markup = reply_markup, entities = entities, schedule_date = schedule_date ?? default, + schedule_repeat_period = schedule_repeat_period ?? default, send_as = send_as, quick_reply_shortcut = quick_reply_shortcut, effect = effect ?? default, @@ -2087,10 +2089,10 @@ namespace TL /// Start playing the video at the specified timestamp (seconds). /// For paid messages », specifies the amount of Telegram Stars the user has agreed to pay in order to send the message. /// Used to suggest a post to a channel, see here » for more info on the full flow. - public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, int? video_timestamp = null, long? allow_paid_stars = null, InputReplyTo reply_to = null, SuggestedPost suggested_post = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, bool allow_paid_floodskip = false) + public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, int? video_timestamp = null, long? allow_paid_stars = null, InputReplyTo reply_to = null, SuggestedPost suggested_post = null, int? schedule_repeat_period = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_ForwardMessages { - flags = (Messages_ForwardMessages.Flags)((top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (video_timestamp != null ? 0x100000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (reply_to != null ? 0x400000 : 0) | (suggested_post != null ? 0x800000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), + flags = (Messages_ForwardMessages.Flags)((top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (video_timestamp != null ? 0x100000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (reply_to != null ? 0x400000 : 0) | (suggested_post != null ? 0x800000 : 0) | (schedule_repeat_period != null ? 0x1000000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), from_peer = from_peer, id = id, random_id = random_id, @@ -2098,6 +2100,7 @@ namespace TL top_msg_id = top_msg_id ?? default, reply_to = reply_to, schedule_date = schedule_date ?? default, + schedule_repeat_period = schedule_repeat_period ?? default, send_as = send_as, quick_reply_shortcut = quick_reply_shortcut, video_timestamp = video_timestamp ?? default, @@ -2637,10 +2640,10 @@ namespace TL /// Message entities for styled text /// Scheduled message date for scheduled messages /// If specified, edits a quick reply shortcut message, instead ». - public static Task Messages_EditMessage(this Client client, InputPeer peer, int id, string message = null, InputMedia media = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, int? quick_reply_shortcut_id = null, bool no_webpage = false, bool invert_media = false) + public static Task Messages_EditMessage(this Client client, InputPeer peer, int id, string message = null, InputMedia media = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, int? schedule_repeat_period = null, int? quick_reply_shortcut_id = null, bool no_webpage = false, bool invert_media = false) => client.Invoke(new Messages_EditMessage { - flags = (Messages_EditMessage.Flags)((message != null ? 0x800 : 0) | (media != null ? 0x4000 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x8000 : 0) | (quick_reply_shortcut_id != null ? 0x20000 : 0) | (no_webpage ? 0x2 : 0) | (invert_media ? 0x10000 : 0)), + flags = (Messages_EditMessage.Flags)((message != null ? 0x800 : 0) | (media != null ? 0x4000 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x8000 : 0) | (schedule_repeat_period != null ? 0x40000 : 0) | (quick_reply_shortcut_id != null ? 0x20000 : 0) | (no_webpage ? 0x2 : 0) | (invert_media ? 0x10000 : 0)), peer = peer, id = id, message = message, @@ -2648,6 +2651,7 @@ namespace TL reply_markup = reply_markup, entities = entities, schedule_date = schedule_date ?? default, + schedule_repeat_period = schedule_repeat_period ?? default, quick_reply_shortcut_id = quick_reply_shortcut_id ?? default, }); @@ -5595,10 +5599,10 @@ namespace TL /// Obtains a list of peers that can be used to send messages in a specific group See Possible codes: 400 (details) /// If set, fetches the list of peers that can be used to send paid reactions to messages of a specific peer. /// The group where we intend to send messages - public static Task Channels_GetSendAs(this Client client, InputPeer peer, bool for_paid_reactions = false) + public static Task Channels_GetSendAs(this Client client, InputPeer peer, bool for_paid_reactions = false, bool for_live_stories = false) => client.Invoke(new Channels_GetSendAs { - flags = (Channels_GetSendAs.Flags)(for_paid_reactions ? 0x1 : 0), + flags = (Channels_GetSendAs.Flags)((for_paid_reactions ? 0x1 : 0) | (for_live_stories ? 0x2 : 0)), peer = peer, }); @@ -6777,6 +6781,29 @@ namespace TL gift_id = gift_id, }); + /// See + public static Task Payments_GetStarGiftAuctionState(this Client client, InputStarGiftAuctionBase auction, int version) + => client.Invoke(new Payments_GetStarGiftAuctionState + { + auction = auction, + version = version, + }); + + /// See + public static Task Payments_GetStarGiftAuctionAcquiredGifts(this Client client, long gift_id) + => client.Invoke(new Payments_GetStarGiftAuctionAcquiredGifts + { + gift_id = gift_id, + }); + + /// See + /// a null value means payments.starGiftActiveAuctionsNotModified + public static Task Payments_GetStarGiftActiveAuctions(this Client client, long hash = default) + => client.Invoke(new Payments_GetStarGiftActiveAuctions + { + hash = hash, + }); + /// Create a stickerset. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is a custom emoji stickerset. @@ -7082,13 +7109,14 @@ namespace TL /// Invalidate existing invite links /// Group call /// Whether all users will that join this group call are muted by default upon joining the group call - public static Task Phone_ToggleGroupCallSettings(this Client client, InputGroupCallBase call, bool? join_muted = default, bool? messages_enabled = default, bool reset_invite_hash = false) + public static Task Phone_ToggleGroupCallSettings(this Client client, InputGroupCallBase call, bool? join_muted = default, bool? messages_enabled = default, long? send_paid_messages_stars = null, bool reset_invite_hash = false) => client.Invoke(new Phone_ToggleGroupCallSettings { - flags = (Phone_ToggleGroupCallSettings.Flags)((join_muted != default ? 0x1 : 0) | (messages_enabled != default ? 0x4 : 0) | (reset_invite_hash ? 0x2 : 0)), + flags = (Phone_ToggleGroupCallSettings.Flags)((join_muted != default ? 0x1 : 0) | (messages_enabled != default ? 0x4 : 0) | (send_paid_messages_stars != null ? 0x8 : 0) | (reset_invite_hash ? 0x2 : 0)), call = call, join_muted = join_muted ?? default, messages_enabled = messages_enabled ?? default, + send_paid_messages_stars = send_paid_messages_stars ?? default, }); /// Get info about a group call See Possible codes: 400,403 (details) @@ -7250,9 +7278,10 @@ namespace TL /// Get RTMP URL and stream key for RTMP livestreams. Can be used even before creating the actual RTMP livestream with Phone_CreateGroupCall (the rtmp_stream flag must be set). See Possible codes: 400 (details) /// Peer to livestream into /// Whether to revoke the previous stream key or simply return the existing one - public static Task Phone_GetGroupCallStreamRtmpUrl(this Client client, InputPeer peer, bool revoke) + public static Task Phone_GetGroupCallStreamRtmpUrl(this Client client, InputPeer peer, bool revoke, bool live_story = false) => client.Invoke(new Phone_GetGroupCallStreamRtmpUrl { + flags = (Phone_GetGroupCallStreamRtmpUrl.Flags)(live_story ? 0x1 : 0), peer = peer, revoke = revoke, }); @@ -7345,12 +7374,15 @@ namespace TL }); /// See - public static Task Phone_SendGroupCallMessage(this Client client, InputGroupCallBase call, long random_id, TextWithEntities message) + public static Task Phone_SendGroupCallMessage(this Client client, InputGroupCallBase call, long random_id, TextWithEntities message, long? allow_paid_stars = null, InputPeer send_as = null) => client.Invoke(new Phone_SendGroupCallMessage { + flags = (Phone_SendGroupCallMessage.Flags)((allow_paid_stars != null ? 0x1 : 0) | (send_as != null ? 0x2 : 0)), call = call, random_id = random_id, message = message, + allow_paid_stars = allow_paid_stars ?? default, + send_as = send_as, }); /// See @@ -7361,6 +7393,39 @@ namespace TL encrypted_message = encrypted_message, }); + /// See + public static Task Phone_DeleteGroupCallMessages(this Client client, InputGroupCallBase call, int[] messages, bool report_spam = false) + => client.Invoke(new Phone_DeleteGroupCallMessages + { + flags = (Phone_DeleteGroupCallMessages.Flags)(report_spam ? 0x1 : 0), + call = call, + messages = messages, + }); + + /// See + public static Task Phone_DeleteGroupCallParticipantMessages(this Client client, InputGroupCallBase call, InputPeer participant, bool report_spam = false) + => client.Invoke(new Phone_DeleteGroupCallParticipantMessages + { + flags = (Phone_DeleteGroupCallParticipantMessages.Flags)(report_spam ? 0x1 : 0), + call = call, + participant = participant, + }); + + /// See + public static Task Phone_GetGroupCallStars(this Client client, InputGroupCallBase call) + => client.Invoke(new Phone_GetGroupCallStars + { + call = call, + }); + + /// See + public static Task Phone_SaveDefaultSendAs(this Client client, InputGroupCallBase call, InputPeer send_as) + => client.Invoke(new Phone_SaveDefaultSendAs + { + call = call, + send_as = send_as, + }); + /// Get localization pack strings See Possible codes: 400 (details) /// Platform identifier (i.e. android, tdesktop, etc). /// Either an ISO 639-1 language code or a language pack name obtained from a language pack link. @@ -7860,7 +7925,7 @@ namespace TL /// Get the IDs of the maximum read stories for a set of peers. See /// Peers - public static Task Stories_GetPeerMaxIDs(this Client client, params InputPeer[] id) + public static Task Stories_GetPeerMaxIDs(this Client client, params InputPeer[] id) => client.Invoke(new Stories_GetPeerMaxIDs { id = id, @@ -8003,6 +8068,20 @@ namespace TL limit = limit, }); + /// See + public static Task Stories_StartLive(this Client client, InputPeer peer, InputPrivacyRule[] privacy_rules, long random_id, string caption = null, MessageEntity[] entities = null, bool? messages_enabled = default, long? send_paid_messages_stars = null, bool pinned = false, bool noforwards = false, bool rtmp_stream = false) + => client.Invoke(new Stories_StartLive + { + flags = (Stories_StartLive.Flags)((caption != null ? 0x1 : 0) | (entities != null ? 0x2 : 0) | (messages_enabled != default ? 0x40 : 0) | (send_paid_messages_stars != null ? 0x80 : 0) | (pinned ? 0x4 : 0) | (noforwards ? 0x10 : 0) | (rtmp_stream ? 0x20 : 0)), + peer = peer, + caption = caption, + entities = entities, + privacy_rules = privacy_rules, + random_id = random_id, + messages_enabled = messages_enabled ?? default, + send_paid_messages_stars = send_paid_messages_stars ?? default, + }); + /// Obtains info about the boosts that were applied to a certain channel or supergroup (admins only) See Possible codes: 400 (details) /// Whether to return only info about boosts received from gift codes and giveaways created by the channel/supergroup » /// The channel/supergroup @@ -9716,7 +9795,7 @@ namespace TL.Methods } } - [TLDef(0xFE05DC9A)] + [TLDef(0x545CD15A)] public sealed partial class Messages_SendMessage : IMethod { public Flags flags; @@ -9727,6 +9806,7 @@ namespace TL.Methods [IfFlag(2)] public ReplyMarkup reply_markup; [IfFlag(3)] public MessageEntity[] entities; [IfFlag(10)] public DateTime schedule_date; + [IfFlag(24)] public int schedule_repeat_period; [IfFlag(13)] public InputPeer send_as; [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; [IfFlag(18)] public long effect; @@ -9752,10 +9832,11 @@ namespace TL.Methods allow_paid_floodskip = 0x80000, has_allow_paid_stars = 0x200000, has_suggested_post = 0x400000, + has_schedule_repeat_period = 0x1000000, } } - [TLDef(0xAC55D9C1)] + [TLDef(0x0330E77F)] public sealed partial class Messages_SendMedia : IMethod { public Flags flags; @@ -9767,6 +9848,7 @@ namespace TL.Methods [IfFlag(2)] public ReplyMarkup reply_markup; [IfFlag(3)] public MessageEntity[] entities; [IfFlag(10)] public DateTime schedule_date; + [IfFlag(24)] public int schedule_repeat_period; [IfFlag(13)] public InputPeer send_as; [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; [IfFlag(18)] public long effect; @@ -9791,10 +9873,11 @@ namespace TL.Methods allow_paid_floodskip = 0x80000, has_allow_paid_stars = 0x200000, has_suggested_post = 0x400000, + has_schedule_repeat_period = 0x1000000, } } - [TLDef(0x978928CA)] + [TLDef(0x41D41ADE)] public sealed partial class Messages_ForwardMessages : IMethod { public Flags flags; @@ -9805,6 +9888,7 @@ namespace TL.Methods [IfFlag(9)] public int top_msg_id; [IfFlag(22)] public InputReplyTo reply_to; [IfFlag(10)] public DateTime schedule_date; + [IfFlag(24)] public int schedule_repeat_period; [IfFlag(13)] public InputPeer send_as; [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; [IfFlag(20)] public int video_timestamp; @@ -9828,6 +9912,7 @@ namespace TL.Methods has_allow_paid_stars = 0x200000, has_reply_to = 0x400000, has_suggested_post = 0x800000, + has_schedule_repeat_period = 0x1000000, } } @@ -10256,7 +10341,7 @@ namespace TL.Methods public int id; } - [TLDef(0xDFD14005)] + [TLDef(0x51E842E1)] public sealed partial class Messages_EditMessage : IMethod { public Flags flags; @@ -10267,6 +10352,7 @@ namespace TL.Methods [IfFlag(2)] public ReplyMarkup reply_markup; [IfFlag(3)] public MessageEntity[] entities; [IfFlag(15)] public DateTime schedule_date; + [IfFlag(18)] public int schedule_repeat_period; [IfFlag(17)] public int quick_reply_shortcut_id; [Flags] public enum Flags : uint @@ -10279,6 +10365,7 @@ namespace TL.Methods has_schedule_date = 0x8000, invert_media = 0x10000, has_quick_reply_shortcut_id = 0x20000, + has_schedule_repeat_period = 0x40000, } } @@ -12752,6 +12839,7 @@ namespace TL.Methods [Flags] public enum Flags : uint { for_paid_reactions = 0x1, + for_live_stories = 0x2, } } @@ -13747,6 +13835,25 @@ namespace TL.Methods public long gift_id; } + [TLDef(0x5C9FF4D6)] + public sealed partial class Payments_GetStarGiftAuctionState : IMethod + { + public InputStarGiftAuctionBase auction; + public int version; + } + + [TLDef(0x6BA2CBEC)] + public sealed partial class Payments_GetStarGiftAuctionAcquiredGifts : IMethod + { + public long gift_id; + } + + [TLDef(0xA5D0514D)] + public sealed partial class Payments_GetStarGiftActiveAuctions : IMethod + { + public long hash; + } + [TLDef(0x9021AB67)] public sealed partial class Stickers_CreateStickerSet : IMethod { @@ -13993,19 +14100,21 @@ namespace TL.Methods public InputGroupCallBase call; } - [TLDef(0xE9723804)] + [TLDef(0x974392F2)] public sealed partial class Phone_ToggleGroupCallSettings : IMethod { public Flags flags; public InputGroupCallBase call; [IfFlag(0)] public bool join_muted; [IfFlag(2)] public bool messages_enabled; + [IfFlag(3)] public long send_paid_messages_stars; [Flags] public enum Flags : uint { has_join_muted = 0x1, reset_invite_hash = 0x2, has_messages_enabled = 0x4, + has_send_paid_messages_stars = 0x8, } } @@ -14137,11 +14246,17 @@ namespace TL.Methods public InputGroupCallBase call; } - [TLDef(0xDEB3ABBF)] + [TLDef(0x5AF4C73A)] public sealed partial class Phone_GetGroupCallStreamRtmpUrl : IMethod { + public Flags flags; public InputPeer peer; public bool revoke; + + [Flags] public enum Flags : uint + { + live_story = 0x1, + } } [TLDef(0x41248786)] @@ -14218,12 +14333,21 @@ namespace TL.Methods public int limit; } - [TLDef(0x87893014)] - public sealed partial class Phone_SendGroupCallMessage : IMethod + [TLDef(0xB1D11410)] + public sealed partial class Phone_SendGroupCallMessage : IMethod { + public Flags flags; public InputGroupCallBase call; public long random_id; public TextWithEntities message; + [IfFlag(0)] public long allow_paid_stars; + [IfFlag(1)] public InputPeer send_as; + + [Flags] public enum Flags : uint + { + has_allow_paid_stars = 0x1, + has_send_as = 0x2, + } } [TLDef(0xE5AFA56D)] @@ -14233,6 +14357,45 @@ namespace TL.Methods public byte[] encrypted_message; } + [TLDef(0xF64F54F7)] + public sealed partial class Phone_DeleteGroupCallMessages : IMethod + { + public Flags flags; + public InputGroupCallBase call; + public int[] messages; + + [Flags] public enum Flags : uint + { + report_spam = 0x1, + } + } + + [TLDef(0x1DBFECA0)] + public sealed partial class Phone_DeleteGroupCallParticipantMessages : IMethod + { + public Flags flags; + public InputGroupCallBase call; + public InputPeer participant; + + [Flags] public enum Flags : uint + { + report_spam = 0x1, + } + } + + [TLDef(0x6F636302)] + public sealed partial class Phone_GetGroupCallStars : IMethod + { + public InputGroupCallBase call; + } + + [TLDef(0x4167ADD1)] + public sealed partial class Phone_SaveDefaultSendAs : IMethod + { + public InputGroupCallBase call; + public InputPeer send_as; + } + [TLDef(0xF2F2330A)] public sealed partial class Langpack_GetLangPack : IMethod { @@ -14644,8 +14807,8 @@ namespace TL.Methods [TLDef(0x9B5AE7F9)] public sealed partial class Stories_GetAllReadPeerStories : IMethod { } - [TLDef(0x535983C3)] - public sealed partial class Stories_GetPeerMaxIDs : IMethod + [TLDef(0x78499170)] + public sealed partial class Stories_GetPeerMaxIDs : IMethod { public InputPeer[] id; } @@ -14761,6 +14924,30 @@ namespace TL.Methods public int limit; } + [TLDef(0xD069CCDE)] + public sealed partial class Stories_StartLive : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(0)] public string caption; + [IfFlag(1)] public MessageEntity[] entities; + public InputPrivacyRule[] privacy_rules; + public long random_id; + [IfFlag(6)] public bool messages_enabled; + [IfFlag(7)] public long send_paid_messages_stars; + + [Flags] public enum Flags : uint + { + has_caption = 0x1, + has_entities = 0x2, + pinned = 0x4, + noforwards = 0x10, + rtmp_stream = 0x20, + has_messages_enabled = 0x40, + has_send_paid_messages_stars = 0x80, + } + } + [TLDef(0x60F67660)] public sealed partial class Premium_GetBoostsList : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index de3f2d5..76ac918 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 = 216; // fetched 10/10/2025 20:01:17 + public const int Version = 218; // fetched 11/15/2025 21:06:24 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -84,7 +84,7 @@ namespace TL [0xF7C1B13F] = typeof(InputUserSelf), [0xF21158C6] = typeof(InputUser), [0x1DA448E2] = typeof(InputUserFromMessage), - [0xF392B7F4] = typeof(InputPhoneContact), + [0x6A1DC4BE] = typeof(InputPhoneContact), [0xF52FF27F] = typeof(InputFile), [0xFA4F0BB5] = typeof(InputFileBig), [0x62DC8B48] = typeof(InputFileStoryDocument), @@ -128,7 +128,7 @@ namespace TL [0x36C6019A] = typeof(PeerChat), [0xA2A5371E] = typeof(PeerChannel), [0xD3BC4B7A] = typeof(UserEmpty), - [0x020B1422] = typeof(User), + [0x31774388] = typeof(User), [0x4F11BAE1] = null,//UserProfilePhotoEmpty [0x82D1F706] = typeof(UserProfilePhoto), [0x09D05049] = null,//UserStatusEmpty @@ -140,7 +140,7 @@ namespace TL [0x29562865] = typeof(ChatEmpty), [0x41CBF256] = typeof(Chat), [0x6592A1A7] = typeof(ChatForbidden), - [0xFE685355] = typeof(Channel), + [0x1C32B11C] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), [0x2633421B] = typeof(ChatFull), [0xE4E0B29D] = typeof(ChannelFull), @@ -152,7 +152,7 @@ namespace TL [0x37C1011C] = null,//ChatPhotoEmpty [0x1C6E1C11] = typeof(ChatPhoto), [0x90A6CA84] = typeof(MessageEmpty), - [0x9815CEC8] = typeof(Message), + [0xB92F76CF] = typeof(Message), [0x7A800E0A] = typeof(MessageService), [0x3DED6320] = null,//MessageMediaEmpty [0x695150D7] = typeof(MessageMediaPhoto), @@ -172,6 +172,7 @@ namespace TL [0xCEAA3EA1] = typeof(MessageMediaGiveawayResults), [0xA8852491] = typeof(MessageMediaPaidMedia), [0x8A53B014] = typeof(MessageMediaToDo), + [0xCA5CAB89] = typeof(MessageMediaVideoStream), [0xB6AEF7B0] = null,//MessageActionEmpty [0xBD47CBAD] = typeof(MessageActionChatCreate), [0xB5A1CE5A] = typeof(MessageActionChatEditTitle), @@ -204,13 +205,13 @@ namespace TL [0xEBBCA3CB] = typeof(MessageActionChatJoinedByRequest), [0x47DD8079] = typeof(MessageActionWebViewDataSentMe), [0xB4C38CB5] = typeof(MessageActionWebViewDataSent), - [0x6C6274FA] = typeof(MessageActionGiftPremium), + [0x48E91302] = typeof(MessageActionGiftPremium), [0x0D999256] = typeof(MessageActionTopicCreate), [0xC0944820] = typeof(MessageActionTopicEdit), [0x57DE635E] = typeof(MessageActionSuggestProfilePhoto), [0x31518E9B] = typeof(MessageActionRequestedPeer), [0x5060A3F4] = typeof(MessageActionSetChatWallPaper), - [0x56D03994] = typeof(MessageActionGiftCode), + [0x31C48347] = typeof(MessageActionGiftCode), [0xA80F51E4] = typeof(MessageActionGiveawayLaunch), [0x87E2F155] = typeof(MessageActionGiveawayResults), [0xCC02AA6D] = typeof(MessageActionBoostApply), @@ -218,7 +219,7 @@ namespace TL [0x41B3E202] = typeof(MessageActionPaymentRefunded), [0x45D5B021] = typeof(MessageActionGiftStars), [0xB00C47A2] = typeof(MessageActionPrizeStars), - [0xF24DE7FA] = typeof(MessageActionStarGift), + [0xDB596550] = typeof(MessageActionStarGift), [0x95728543] = typeof(MessageActionStarGiftUnique), [0xAC1F1FCD] = typeof(MessageActionPaidMessagesRefunded), [0x84B88578] = typeof(MessageActionPaidMessagesPrice), @@ -381,7 +382,7 @@ namespace TL [0x5BB98608] = typeof(UpdatePinnedChannelMessages), [0xF89A6A4E] = typeof(UpdateChat), [0xF2EBDB4E] = typeof(UpdateGroupCallParticipants), - [0x97D64341] = typeof(UpdateGroupCall), + [0x9D2216E0] = typeof(UpdateGroupCall), [0xBB9BB9A5] = typeof(UpdatePeerHistoryTTL), [0xD087663A] = typeof(UpdateChatParticipant), [0x985D3ABB] = typeof(UpdateChannelParticipant), @@ -438,10 +439,13 @@ namespace TL [0x77B0E372] = typeof(UpdateReadMonoForumInbox), [0xA4A79376] = typeof(UpdateReadMonoForumOutbox), [0x9F812B08] = typeof(UpdateMonoForumNoPaidException), - [0x78C314E0] = typeof(UpdateGroupCallMessage), + [0xD8326F0D] = typeof(UpdateGroupCallMessage), [0xC957A766] = typeof(UpdateGroupCallEncryptedMessage), [0x683B2C52] = typeof(UpdatePinnedForumTopic), [0xDEF143D0] = typeof(UpdatePinnedForumTopics), + [0x3E85E92C] = typeof(UpdateDeleteGroupCallMessages), + [0x48E246C2] = typeof(UpdateStarGiftAuctionState), + [0xDC58F31E] = typeof(UpdateStarGiftAuctionUserState), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -1016,6 +1020,7 @@ namespace TL [0x50CC03D3] = typeof(WebPageAttributeStickerSet), [0xCF6F6DB8] = typeof(WebPageAttributeUniqueStarGift), [0x31CAD303] = typeof(WebPageAttributeStarGiftCollection), + [0x034986AB] = typeof(WebPageAttributeStarGiftAuction), [0x4899484E] = typeof(Messages_VotesList), [0xF568028A] = typeof(BankCardOpenUrl), [0x3E24E573] = typeof(Payments_BankCardData), @@ -1053,11 +1058,11 @@ namespace TL [0xE8FD8014] = typeof(PeerBlocked), [0x7FE91C14] = typeof(Stats_MessageStats), [0x7780BCB4] = typeof(GroupCallDiscarded), - [0x553B0BA1] = typeof(GroupCall), + [0xEFB2B617] = typeof(GroupCall), [0xD8AA840F] = typeof(InputGroupCall), [0xFE06823F] = typeof(InputGroupCallSlug), [0x8C10603F] = typeof(InputGroupCallInviteMessage), - [0xEBA636FE] = typeof(GroupCallParticipant), + [0x2A3DC7AC] = typeof(GroupCallParticipant), [0x9E727AAD] = typeof(Phone_GroupCall), [0xF47751B6] = typeof(Phone_GroupParticipants), [0x1662AF0B] = typeof(Messages_HistoryImport), @@ -1144,6 +1149,7 @@ namespace TL [0x9A0B48B8] = typeof(InputInvoiceStarGiftPrepaidUpgrade), [0x3E77F614] = typeof(InputInvoicePremiumAuthCode), [0x0923D8D1] = typeof(InputInvoiceStarGiftDropOriginalDetails), + [0x1ECAFA10] = typeof(InputInvoiceStarGiftAuctionBid), [0xAED0CBD9] = typeof(Payments_ExportedInvoice), [0xCFB9D957] = typeof(Messages_TranscribedAudio), [0x5334759C] = typeof(Help_PremiumPromo), @@ -1256,7 +1262,7 @@ namespace TL [0xCAE68768] = typeof(Stories_PeerStories), [0xFD5E12BD] = typeof(Messages_WebPage), [0x257E962B] = typeof(PremiumGiftCodeOption), - [0x284A1096] = typeof(Payments_CheckedGiftCode), + [0xEB983F8F] = typeof(Payments_CheckedGiftCode), [0x4367DAA0] = typeof(Payments_GiveawayInfo), [0xE175E66F] = typeof(Payments_GiveawayInfoResults), [0xB2539D54] = typeof(PrepaidGiveaway), @@ -1378,7 +1384,7 @@ namespace TL [0x4BA3A95A] = typeof(MessageReactor), [0x94CE852A] = typeof(StarsGiveawayOption), [0x54236209] = typeof(StarsGiveawayWinnersOption), - [0x80AC53C3] = typeof(StarGift), + [0x1B9A4D7F] = typeof(StarGift), [0xB0BF741B] = typeof(StarGiftUnique), [0xA388A368] = null,//Payments_StarGiftsNotModified [0x2ED82995] = typeof(Payments_StarGifts), @@ -1435,7 +1441,7 @@ namespace TL [0xE7E82E12] = typeof(PendingSuggestion), [0xCBA9A52F] = typeof(TodoItem), [0x49B92A26] = typeof(TodoList), - [0x4CC120B7] = typeof(TodoCompletion), + [0x221BB5E4] = typeof(TodoCompletion), [0x0E8E37E5] = typeof(SuggestedPost), [0x1B0E4F07] = typeof(StarsRating), [0x9D6B13B0] = typeof(StarGiftCollection), @@ -1456,6 +1462,23 @@ namespace TL [0xC93DE95C] = typeof(InputChatTheme), [0x87E5DFE4] = typeof(InputChatThemeUniqueGift), [0x99EA331D] = typeof(StarGiftUpgradePrice), + [0x1A8AFC7E] = typeof(GroupCallMessage), + [0xEE430C85] = typeof(GroupCallDonor), + [0x9D1DBD26] = typeof(Phone_GroupCallStars), + [0x711D692D] = typeof(RecentStory), + [0x310240CC] = typeof(AuctionBidLevel), + [0xFE333952] = null,//StarGiftAuctionStateNotModified + [0x5DB04F4B] = typeof(StarGiftAuctionState), + [0x7D967C3A] = typeof(StarGiftAuctionStateFinished), + [0x2EEED1C4] = typeof(StarGiftAuctionUserState), + [0x0E98E474] = typeof(Payments_StarGiftAuctionState), + [0xAB60E20B] = typeof(StarGiftAuctionAcquiredGift), + [0x7D5BD1F0] = typeof(Payments_StarGiftAuctionAcquiredGifts), + [0xD31BC45D] = typeof(StarGiftActiveAuctionState), + [0xDB33DAD0] = null,//Payments_StarGiftActiveAuctionsNotModified + [0x97F187D8] = typeof(Payments_StarGiftActiveAuctions), + [0x02E16C98] = typeof(InputStarGiftAuction), + [0x7AB58308] = typeof(InputStarGiftAuctionSlug), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), @@ -1594,6 +1617,8 @@ namespace TL [typeof(Stories_Albums)] = 0x564EDAEB, //stories.albumsNotModified [typeof(Account_SavedMusicIds)] = 0x4FC81D6E, //account.savedMusicIdsNotModified [typeof(InputChatThemeBase)] = 0x83268483, //inputChatThemeEmpty + [typeof(StarGiftAuctionStateBase)] = 0xFE333952, //starGiftAuctionStateNotModified + [typeof(Payments_StarGiftActiveAuctions)]= 0xDB33DAD0, //payments.starGiftActiveAuctionsNotModified [typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty }; } diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index bda3719..c043406 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,8 +13,8 @@ WTelegramClient Wizou 0.0.0 - layer.216 - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 216 + layer.218 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 218 Release Notes: $(ReleaseNotes) From d3ad4789a1739b4fff6a588033eea0ca9a2ba76c Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 5 Dec 2025 06:53:54 +0100 Subject: [PATCH 41/54] WTelegram.Helpers.JsonOptions can now serialize polymorph TL types (useful for logs). Deserialization is also possible in non-trimmed apps, but not recommended as structures can change. --- src/Helpers.cs | 82 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-) diff --git a/src/Helpers.cs b/src/Helpers.cs index d483cb6..ea7d0b5 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -27,8 +27,88 @@ namespace WTelegram public static readonly JsonSerializerOptions JsonOptions = new() { IncludeFields = true, WriteIndented = true, #if NET8_0_OR_GREATER TypeInfoResolver = JsonSerializer.IsReflectionEnabledByDefault ? null : WTelegramContext.Default, + Converters = { new TLJsonConverter(), new JsonStringEnumConverter() }, +#endif + IgnoreReadOnlyProperties = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault }; + +#if NET8_0_OR_GREATER + public sealed class TLJsonConverter : JsonConverter + { + public override bool CanConvert(Type typeToConvert) + => typeToConvert.IsAbstract || typeToConvert == typeof(Dictionary) || typeToConvert == typeof(Dictionary); + public override object Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (typeToConvert == typeof(Dictionary)) + { + if (reader.TokenType != JsonTokenType.StartArray) throw new JsonException("Expected array for users dictionary"); + var users = new Dictionary(); + while (reader.Read() && reader.TokenType != JsonTokenType.EndArray) + { + var user = JsonSerializer.Deserialize(ref reader, options); + if (user != null) users[user.id] = user; + } + return users; + } + else if (typeToConvert == typeof(Dictionary)) + { + if (reader.TokenType != JsonTokenType.StartArray) throw new JsonException("Expected array for chats dictionary"); + var chats = new Dictionary(); + while (reader.Read() && reader.TokenType != JsonTokenType.EndArray) + { + var chat = (TL.ChatBase)Read(ref reader, typeof(TL.ChatBase), options); + if (chat != null) chats[chat.ID] = chat; + } + return chats; + } + else if (reader.TokenType == JsonTokenType.Null) + return null; + else if (reader.TokenType == JsonTokenType.StartObject) + { + var typeReader = reader; + if (!typeReader.Read() || typeReader.TokenType != JsonTokenType.PropertyName || typeReader.GetString() != "$") + throw new JsonException("Expected $ type property"); + if (!typeReader.Read() || typeReader.TokenType != JsonTokenType.String) + throw new JsonException("Invalid $ type property"); + var type = typeReader.GetString(); + var actualType = typeToConvert.Assembly.GetType("TL." + type); + if (!typeToConvert.IsAssignableFrom(actualType)) + throw new JsonException($"Incompatible $ type: {type} -> {typeToConvert}"); + return JsonSerializer.Deserialize(ref reader, actualType, options); + } + throw new JsonException($"Unexpected token type: {reader.TokenType}"); + } + public override void Write(Utf8JsonWriter writer, object value, JsonSerializerOptions options) + { + if (value is Dictionary users) + { + writer.WriteStartArray(); + foreach (var element in users.Values) + JsonSerializer.Serialize(writer, element, options); + writer.WriteEndArray(); + } + else if (value is Dictionary chats) + { + writer.WriteStartArray(); + foreach (var element in chats.Values) + Write(writer, element, options); + writer.WriteEndArray(); + } + else if (value is null) + writer.WriteNullValue(); + else + { + var actualType = value.GetType(); + var jsonObject = JsonSerializer.SerializeToElement(value, actualType, options); + writer.WriteStartObject(); + writer.WriteString("$", actualType.Name); + foreach (var property in jsonObject.EnumerateObject()) + if (char.IsLower(property.Name[0])) + property.WriteTo(writer); + writer.WriteEndObject(); + } + } + } #endif - IgnoreReadOnlyProperties = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull }; private static readonly ConsoleColor[] LogLevelToColor = [ ConsoleColor.DarkGray, ConsoleColor.DarkCyan, ConsoleColor.Cyan, ConsoleColor.Yellow, ConsoleColor.Red, ConsoleColor.Magenta, ConsoleColor.DarkBlue ]; From 9c839128bbafa472e17782d1b18de7323bcbcdc1 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 14 Dec 2025 20:24:02 +0100 Subject: [PATCH 42/54] Update to Telegram API Layer 220 - Added support for passkey-based authentication with new classes (`Passkey`, `Account_Passkeys`, etc.) and methods (`Auth_InitPasskeyLogin`, `Account_RegisterPasskey`, etc.). - Added new methods for handling star gift offers and upgrades (`Payments_ResolveStarGiftOffer`, `Payments_SendStarGiftOffer`, etc.). - Enhanced star gift functionality with new fields (`gift_num`, `upgrade_variants`, etc.), flags, and classes (`MessageActionStarGiftPurchaseOffer`, `StarGiftBackground`, etc.). - Updated `Messages_ForwardMessages` to include a new `effect` parameter. --- README.md | 2 +- src/TL.Schema.cs | 198 +++++++++++++++++++++++++++++++++---- src/TL.SchemaFuncs.cs | 155 ++++++++++++++++++++++++++++- src/TL.Table.cs | 35 ++++--- src/WTelegramClient.csproj | 4 +- 5 files changed, 360 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 85bfbb0..3edbec0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-218-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-220-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 d5800b5..8d88c61 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2988,7 +2988,7 @@ namespace TL } } /// You received a gift, see here » for more info. See - [TLDef(0xDB596550)] + [TLDef(0xEA2C31D3)] public sealed partial class MessageActionStarGift : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -3014,6 +3014,7 @@ namespace TL /// For separate upgrades, the identifier of the message with the gift whose upgrade was prepaid (only valid for the receiver of the service message). [IfFlag(15)] public int gift_msg_id; [IfFlag(18)] public Peer to_id; + [IfFlag(19)] public int gift_num; [Flags] public enum Flags : uint { @@ -3050,6 +3051,8 @@ namespace TL auction_acquired = 0x20000, /// Field has a value has_to_id = 0x40000, + /// Field has a value + has_gift_num = 0x80000, } } /// A gift » was upgraded to a collectible gift ». See @@ -3107,6 +3110,7 @@ namespace TL /// Field has a value has_drop_original_details_stars = 0x1000, assigned = 0x2000, + from_offer = 0x4000, } } /// Sent from peer A to B, indicates that A refunded all stars B previously paid to send messages to A, see here » for more info on paid messages. See @@ -3252,6 +3256,34 @@ namespace TL { public Birthday birthday; } + /// See + [TLDef(0x774278D4)] + public sealed partial class MessageActionStarGiftPurchaseOffer : MessageAction + { + public Flags flags; + public StarGiftBase gift; + public StarsAmountBase price; + public DateTime expires_at; + + [Flags] public enum Flags : uint + { + accepted = 0x1, + declined = 0x2, + } + } + /// See + [TLDef(0x73ADA76B)] + public sealed partial class MessageActionStarGiftPurchaseOfferDeclined : MessageAction + { + public Flags flags; + public StarGiftBase gift; + public StarsAmountBase price; + + [Flags] public enum Flags : uint + { + expired = 0x1, + } + } /// Chat info. See Derived classes: , public abstract partial class DialogBase : IObject @@ -14553,14 +14585,11 @@ namespace TL public DocumentBase[] icons; } /// See - [TLDef(0x034986AB)] + [TLDef(0x01C641C2)] public sealed partial class WebPageAttributeStarGiftAuction : WebPageAttribute { public StarGiftBase gift; public DateTime end_date; - public int center_color; - public int edge_color; - public int text_color; } /// How users voted in a poll See @@ -20258,6 +20287,7 @@ namespace TL stargift_drop_original_details = 0x4000000, phonegroup_message = 0x8000000, stargift_auction_bid = 0x10000000, + offer = 0x20000000, } } @@ -20642,7 +20672,7 @@ namespace TL public virtual Peer ReleasedBy => default; } /// Represents a star gift, see here » for more info. See - [TLDef(0x1B9A4D7F)] + [TLDef(0x313A9547)] public sealed partial class StarGift : StarGiftBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -20681,6 +20711,9 @@ namespace TL [IfFlag(9)] public DateTime locked_until_date; [IfFlag(11)] public string auction_slug; [IfFlag(11)] public int gifts_per_round; + [IfFlag(11)] public DateTime auction_start_date; + [IfFlag(12)] public int upgrade_variants; + [IfFlag(13)] public StarGiftBackground background; [Flags] public enum Flags : uint { @@ -20706,6 +20739,10 @@ namespace TL has_locked_until_date = 0x200, peer_color_available = 0x400, auction = 0x800, + /// Field has a value + has_upgrade_variants = 0x1000, + /// Field has a value + has_background = 0x2000, } /// Identifier of the gift @@ -20718,7 +20755,7 @@ namespace TL public override Peer ReleasedBy => released_by; } /// Represents a collectible star gift, see here » for more info. See - [TLDef(0xB0BF741B)] + [TLDef(0x569D64C9)] public sealed partial class StarGiftUnique : StarGiftBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -20755,10 +20792,12 @@ namespace TL [IfFlag(8)] public long value_amount; /// Currency for the gift's price. [IfFlag(8)] public string value_currency; + [IfFlag(8)] public long value_usd_amount; /// The current chat where the associated chat theme is installed, if any (gift-based themes can only be installed in one chat at a time). [IfFlag(10)] public Peer theme_peer; [IfFlag(11)] public PeerColorBase peer_color; [IfFlag(12)] public Peer host_id; + [IfFlag(13)] public int offer_min_stars; [Flags] public enum Flags : uint { @@ -20778,7 +20817,7 @@ namespace TL require_premium = 0x40, /// Whether the gift can be bought only using Toncoins. resale_ton_only = 0x80, - /// Fields and have a value + /// Fields , and have a value has_value_amount = 0x100, /// A chat theme associated to this gift is available, see here » for more info on how to use it. theme_available = 0x200, @@ -20788,6 +20827,8 @@ namespace TL has_peer_color = 0x800, /// Field has a value has_host_id = 0x1000, + /// Field has a value + has_offer_min_stars = 0x2000, } /// Identifier of the collectible gift. @@ -21228,7 +21269,7 @@ namespace TL } /// Represents a gift owned by a peer. See - [TLDef(0x8983A452)] + [TLDef(0xEAD6805E)] public sealed partial class SavedStarGift : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -21262,6 +21303,7 @@ namespace TL /// Hash to prepay for a gift upgrade separately ». [IfFlag(16)] public string prepaid_upgrade_hash; [IfFlag(18)] public long drop_original_details_stars; + [IfFlag(19)] public int gift_num; [Flags] public enum Flags : uint { @@ -21303,6 +21345,8 @@ namespace TL upgrade_separate = 0x20000, /// Field has a value has_drop_original_details_stars = 0x40000, + /// Field has a value + has_gift_num = 0x80000, } } @@ -21946,7 +21990,6 @@ namespace TL { top = 0x1, my = 0x2, - anonymous = 0x4, has_peer_id = 0x8, } } @@ -21994,7 +22037,7 @@ namespace TL public virtual DateTime EndDate => default; } /// See - [TLDef(0x5DB04F4B)] + [TLDef(0x771A4E66)] public sealed partial class StarGiftAuctionState : StarGiftAuctionStateBase { public int version; @@ -22004,20 +22047,32 @@ namespace TL public AuctionBidLevel[] bid_levels; public long[] top_bidders; public DateTime next_round_at; + public int last_gift_num; public int gifts_left; public int current_round; public int total_rounds; + public StarGiftAuctionRound[] rounds; public override DateTime StartDate => start_date; public override DateTime EndDate => end_date; } /// See - [TLDef(0x7D967C3A)] + [TLDef(0x972DABBF)] public sealed partial class StarGiftAuctionStateFinished : StarGiftAuctionStateBase { + public Flags flags; public DateTime start_date; public DateTime end_date; public long average_price; + [IfFlag(0)] public int listed_count; + [IfFlag(1)] public int fragment_listed_count; + [IfFlag(1)] public string fragment_listed_url; + + [Flags] public enum Flags : uint + { + has_listed_count = 0x1, + has_fragment_listed_count = 0x2, + } public override DateTime StartDate => start_date; public override DateTime EndDate => end_date; @@ -22042,18 +22097,21 @@ namespace TL } /// See - [TLDef(0x0E98E474)] - public sealed partial class Payments_StarGiftAuctionState : IObject + [TLDef(0x6B39F4EC)] + public sealed partial class Payments_StarGiftAuctionState : IObject, IPeerResolver { public StarGiftBase gift; public StarGiftAuctionStateBase state; public StarGiftAuctionUserState user_state; public int timeout; public Dictionary users; + public Dictionary chats; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// See - [TLDef(0xAB60E20B)] + [TLDef(0x42B00348)] public sealed partial class StarGiftAuctionAcquiredGift : IObject { public Flags flags; @@ -22063,11 +22121,13 @@ namespace TL public int round; public int pos; [IfFlag(1)] public TextWithEntities message; + [IfFlag(2)] public int gift_num; [Flags] public enum Flags : uint { name_hidden = 0x1, has_message = 0x2, + has_gift_num = 0x4, } } @@ -22093,11 +22153,14 @@ namespace TL /// See /// a value means payments.starGiftActiveAuctionsNotModified - [TLDef(0x97F187D8)] - public sealed partial class Payments_StarGiftActiveAuctions : IObject + [TLDef(0xAEF6ABBC)] + public sealed partial class Payments_StarGiftActiveAuctions : IObject, IPeerResolver { public StarGiftActiveAuctionState[] auctions; public Dictionary users; + public Dictionary chats; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// See @@ -22114,4 +22177,105 @@ namespace TL { public string slug; } + + /// See + [TLDef(0x98613EBF)] + public sealed partial class Passkey : IObject + { + public Flags flags; + public string id; + public string name; + public DateTime date; + [IfFlag(0)] public long software_emoji_id; + [IfFlag(1)] public DateTime last_usage_date; + + [Flags] public enum Flags : uint + { + has_software_emoji_id = 0x1, + has_last_usage_date = 0x2, + } + } + + /// See + [TLDef(0xF8E0AA1C)] + public sealed partial class Account_Passkeys : IObject + { + public Passkey[] passkeys; + } + + /// See + [TLDef(0xE16B5CE1)] + public sealed partial class Account_PasskeyRegistrationOptions : IObject + { + public DataJSON options; + } + + /// See + [TLDef(0xE2037789)] + public sealed partial class Auth_PasskeyLoginOptions : IObject + { + public DataJSON options; + } + + /// See + public abstract partial class InputPasskeyResponse : IObject + { + public DataJSON client_data; + } + /// See + [TLDef(0x3E63935C, inheritBefore = true)] + public sealed partial class InputPasskeyResponseRegister : InputPasskeyResponse + { + public byte[] attestation_data; + } + /// See + [TLDef(0xC31FC14A, inheritBefore = true)] + public sealed partial class InputPasskeyResponseLogin : InputPasskeyResponse + { + public byte[] authenticator_data; + public byte[] signature; + public string user_handle; + } + + /// See + public abstract partial class InputPasskeyCredential : IObject { } + /// See + [TLDef(0x3C27B78F)] + public sealed partial class InputPasskeyCredentialPublicKey : InputPasskeyCredential + { + public string id; + public string raw_id; + public InputPasskeyResponse response; + } + + /// See + [TLDef(0xAFF56398)] + public sealed partial class StarGiftBackground : IObject + { + public int center_color; + public int edge_color; + public int text_color; + } + + /// See + [TLDef(0x3AAE0528)] + public partial class StarGiftAuctionRound : IObject + { + public int num; + public int duration; + } + /// See + [TLDef(0x0AA021E5, inheritBefore = true)] + public sealed partial class StarGiftAuctionRoundExtendable : StarGiftAuctionRound + { + public int extend_top; + public int extend_window; + } + + /// See + [TLDef(0x46C6E36F)] + public sealed partial class Payments_StarGiftUpgradeAttributes : IObject + { + public StarGiftAttribute[] attributes; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 9d21f96..5e2cdbc 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -396,6 +396,24 @@ namespace TL form_id = form_id, }); + /// See + public static Task Auth_InitPasskeyLogin(this Client client, int api_id, string api_hash) + => client.Invoke(new Auth_InitPasskeyLogin + { + api_id = api_id, + api_hash = api_hash, + }); + + /// See + public static Task Auth_FinishPasskeyLogin(this Client client, InputPasskeyCredential credential, int? from_dc_id = null, long? from_auth_key_id = null) + => client.Invoke(new Auth_FinishPasskeyLogin + { + flags = (Auth_FinishPasskeyLogin.Flags)((from_dc_id != null ? 0x1 : 0) | (from_auth_key_id != null ? 0x1 : 0)), + credential = credential, + from_dc_id = from_dc_id ?? default, + from_auth_key_id = from_auth_key_id ?? default, + }); + /// Register device to receive PUSH notifications See Possible codes: 400 (details) /// Avoid receiving (silent and invisible background) notifications. Useful to save battery. /// Device token type, see PUSH updates for the possible values. @@ -1510,6 +1528,32 @@ namespace TL hash = hash, }); + /// See + public static Task Account_InitPasskeyRegistration(this Client client) + => client.Invoke(new Account_InitPasskeyRegistration + { + }); + + /// See + public static Task Account_RegisterPasskey(this Client client, InputPasskeyCredential credential) + => client.Invoke(new Account_RegisterPasskey + { + credential = credential, + }); + + /// See + public static Task Account_GetPasskeys(this Client client) + => client.Invoke(new Account_GetPasskeys + { + }); + + /// See + public static Task Account_DeletePasskey(this Client client, string id) + => client.Invoke(new Account_DeletePasskey + { + id = id, + }); + /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, params InputUserBase[] id) @@ -2089,10 +2133,10 @@ namespace TL /// Start playing the video at the specified timestamp (seconds). /// For paid messages », specifies the amount of Telegram Stars the user has agreed to pay in order to send the message. /// Used to suggest a post to a channel, see here » for more info on the full flow. - public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, int? video_timestamp = null, long? allow_paid_stars = null, InputReplyTo reply_to = null, SuggestedPost suggested_post = null, int? schedule_repeat_period = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, bool allow_paid_floodskip = false) + public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, int? video_timestamp = null, long? allow_paid_stars = null, InputReplyTo reply_to = null, SuggestedPost suggested_post = null, int? schedule_repeat_period = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_ForwardMessages { - flags = (Messages_ForwardMessages.Flags)((top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (video_timestamp != null ? 0x100000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (reply_to != null ? 0x400000 : 0) | (suggested_post != null ? 0x800000 : 0) | (schedule_repeat_period != null ? 0x1000000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), + flags = (Messages_ForwardMessages.Flags)((top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (video_timestamp != null ? 0x100000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (reply_to != null ? 0x400000 : 0) | (suggested_post != null ? 0x800000 : 0) | (schedule_repeat_period != null ? 0x1000000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), from_peer = from_peer, id = id, random_id = random_id, @@ -2103,6 +2147,7 @@ namespace TL schedule_repeat_period = schedule_repeat_period ?? default, send_as = send_as, quick_reply_shortcut = quick_reply_shortcut, + effect = effect ?? default, video_timestamp = video_timestamp ?? default, allow_paid_stars = allow_paid_stars ?? default, suggested_post = suggested_post, @@ -6804,6 +6849,34 @@ namespace TL hash = hash, }); + /// See + public static Task Payments_ResolveStarGiftOffer(this Client client, int offer_msg_id, bool decline = false) + => client.Invoke(new Payments_ResolveStarGiftOffer + { + flags = (Payments_ResolveStarGiftOffer.Flags)(decline ? 0x1 : 0), + offer_msg_id = offer_msg_id, + }); + + /// See + public static Task Payments_SendStarGiftOffer(this Client client, InputPeer peer, string slug, StarsAmountBase price, int duration, long random_id, long? allow_paid_stars = null) + => client.Invoke(new Payments_SendStarGiftOffer + { + flags = (Payments_SendStarGiftOffer.Flags)(allow_paid_stars != null ? 0x1 : 0), + peer = peer, + slug = slug, + price = price, + duration = duration, + random_id = random_id, + allow_paid_stars = allow_paid_stars ?? default, + }); + + /// See + public static Task Payments_GetStarGiftUpgradeAttributes(this Client client, long gift_id) + => client.Invoke(new Payments_GetStarGiftUpgradeAttributes + { + gift_id = gift_id, + }); + /// Create a stickerset. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is a custom emoji stickerset. @@ -8489,6 +8562,27 @@ namespace TL.Methods public long form_id; } + [TLDef(0x518AD0B7)] + public sealed partial class Auth_InitPasskeyLogin : IMethod + { + public int api_id; + public string api_hash; + } + + [TLDef(0x9857AD07)] + public sealed partial class Auth_FinishPasskeyLogin : IMethod + { + public Flags flags; + public InputPasskeyCredential credential; + [IfFlag(0)] public int from_dc_id; + [IfFlag(0)] public long from_auth_key_id; + + [Flags] public enum Flags : uint + { + has_from_dc_id = 0x1, + } + } + [TLDef(0xEC86017A)] public sealed partial class Account_RegisterDevice : IMethod { @@ -9392,6 +9486,24 @@ namespace TL.Methods public long hash; } + [TLDef(0x429547E8)] + public sealed partial class Account_InitPasskeyRegistration : IMethod { } + + [TLDef(0x55B41FD6)] + public sealed partial class Account_RegisterPasskey : IMethod + { + public InputPasskeyCredential credential; + } + + [TLDef(0xEA1F0C52)] + public sealed partial class Account_GetPasskeys : IMethod { } + + [TLDef(0xF5B5563F)] + public sealed partial class Account_DeletePasskey : IMethod + { + public string id; + } + [TLDef(0x0D91A548)] public sealed partial class Users_GetUsers : IMethod { @@ -9877,7 +9989,7 @@ namespace TL.Methods } } - [TLDef(0x41D41ADE)] + [TLDef(0x13704A7C)] public sealed partial class Messages_ForwardMessages : IMethod { public Flags flags; @@ -9891,6 +10003,7 @@ namespace TL.Methods [IfFlag(24)] public int schedule_repeat_period; [IfFlag(13)] public InputPeer send_as; [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; + [IfFlag(18)] public long effect; [IfFlag(20)] public int video_timestamp; [IfFlag(21)] public long allow_paid_stars; [IfFlag(23)] public SuggestedPost suggested_post; @@ -9907,6 +10020,7 @@ namespace TL.Methods has_send_as = 0x2000, noforwards = 0x4000, has_quick_reply_shortcut = 0x20000, + has_effect = 0x40000, allow_paid_floodskip = 0x80000, has_video_timestamp = 0x100000, has_allow_paid_stars = 0x200000, @@ -13854,6 +13968,41 @@ namespace TL.Methods public long hash; } + [TLDef(0xE9CE781C)] + public sealed partial class Payments_ResolveStarGiftOffer : IMethod + { + public Flags flags; + public int offer_msg_id; + + [Flags] public enum Flags : uint + { + decline = 0x1, + } + } + + [TLDef(0x8FB86B41)] + public sealed partial class Payments_SendStarGiftOffer : IMethod + { + public Flags flags; + public InputPeer peer; + public string slug; + public StarsAmountBase price; + public int duration; + public long random_id; + [IfFlag(0)] public long allow_paid_stars; + + [Flags] public enum Flags : uint + { + has_allow_paid_stars = 0x1, + } + } + + [TLDef(0x6D038B58)] + public sealed partial class Payments_GetStarGiftUpgradeAttributes : IMethod + { + public long gift_id; + } + [TLDef(0x9021AB67)] public sealed partial class Stickers_CreateStickerSet : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 76ac918..7e253c3 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 = 218; // fetched 11/15/2025 21:06:24 + public const int Version = 220; // fetched 12/06/2025 13:11:05 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -219,7 +219,7 @@ namespace TL [0x41B3E202] = typeof(MessageActionPaymentRefunded), [0x45D5B021] = typeof(MessageActionGiftStars), [0xB00C47A2] = typeof(MessageActionPrizeStars), - [0xDB596550] = typeof(MessageActionStarGift), + [0xEA2C31D3] = typeof(MessageActionStarGift), [0x95728543] = typeof(MessageActionStarGiftUnique), [0xAC1F1FCD] = typeof(MessageActionPaidMessagesRefunded), [0x84B88578] = typeof(MessageActionPaidMessagesPrice), @@ -231,6 +231,8 @@ namespace TL [0x69F916F8] = typeof(MessageActionSuggestedPostRefund), [0xA8A3C699] = typeof(MessageActionGiftTon), [0x2C8F2A25] = typeof(MessageActionSuggestBirthday), + [0x774278D4] = typeof(MessageActionStarGiftPurchaseOffer), + [0x73ADA76B] = typeof(MessageActionStarGiftPurchaseOfferDeclined), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -1020,7 +1022,7 @@ namespace TL [0x50CC03D3] = typeof(WebPageAttributeStickerSet), [0xCF6F6DB8] = typeof(WebPageAttributeUniqueStarGift), [0x31CAD303] = typeof(WebPageAttributeStarGiftCollection), - [0x034986AB] = typeof(WebPageAttributeStarGiftAuction), + [0x01C641C2] = typeof(WebPageAttributeStarGiftAuction), [0x4899484E] = typeof(Messages_VotesList), [0xF568028A] = typeof(BankCardOpenUrl), [0x3E24E573] = typeof(Payments_BankCardData), @@ -1384,8 +1386,8 @@ namespace TL [0x4BA3A95A] = typeof(MessageReactor), [0x94CE852A] = typeof(StarsGiveawayOption), [0x54236209] = typeof(StarsGiveawayWinnersOption), - [0x1B9A4D7F] = typeof(StarGift), - [0xB0BF741B] = typeof(StarGiftUnique), + [0x313A9547] = typeof(StarGift), + [0x569D64C9] = typeof(StarGiftUnique), [0xA388A368] = null,//Payments_StarGiftsNotModified [0x2ED82995] = typeof(Payments_StarGifts), [0x7903E3D9] = typeof(MessageReportOption), @@ -1414,7 +1416,7 @@ namespace TL [0x315A4974] = typeof(Users_UsersSlice), [0x416C56E8] = typeof(Payments_UniqueStarGift), [0x8C9A88AC] = typeof(Messages_WebPagePreview), - [0x8983A452] = typeof(SavedStarGift), + [0xEAD6805E] = typeof(SavedStarGift), [0x95F389B1] = typeof(Payments_SavedStarGifts), [0x69279795] = typeof(InputSavedStarGiftUser), [0xF101AA7F] = typeof(InputSavedStarGiftChat), @@ -1468,17 +1470,28 @@ namespace TL [0x711D692D] = typeof(RecentStory), [0x310240CC] = typeof(AuctionBidLevel), [0xFE333952] = null,//StarGiftAuctionStateNotModified - [0x5DB04F4B] = typeof(StarGiftAuctionState), - [0x7D967C3A] = typeof(StarGiftAuctionStateFinished), + [0x771A4E66] = typeof(StarGiftAuctionState), + [0x972DABBF] = typeof(StarGiftAuctionStateFinished), [0x2EEED1C4] = typeof(StarGiftAuctionUserState), - [0x0E98E474] = typeof(Payments_StarGiftAuctionState), - [0xAB60E20B] = typeof(StarGiftAuctionAcquiredGift), + [0x6B39F4EC] = typeof(Payments_StarGiftAuctionState), + [0x42B00348] = typeof(StarGiftAuctionAcquiredGift), [0x7D5BD1F0] = typeof(Payments_StarGiftAuctionAcquiredGifts), [0xD31BC45D] = typeof(StarGiftActiveAuctionState), [0xDB33DAD0] = null,//Payments_StarGiftActiveAuctionsNotModified - [0x97F187D8] = typeof(Payments_StarGiftActiveAuctions), + [0xAEF6ABBC] = typeof(Payments_StarGiftActiveAuctions), [0x02E16C98] = typeof(InputStarGiftAuction), [0x7AB58308] = typeof(InputStarGiftAuctionSlug), + [0x98613EBF] = typeof(Passkey), + [0xF8E0AA1C] = typeof(Account_Passkeys), + [0xE16B5CE1] = typeof(Account_PasskeyRegistrationOptions), + [0xE2037789] = typeof(Auth_PasskeyLoginOptions), + [0x3E63935C] = typeof(InputPasskeyResponseRegister), + [0xC31FC14A] = typeof(InputPasskeyResponseLogin), + [0x3C27B78F] = typeof(InputPasskeyCredentialPublicKey), + [0xAFF56398] = typeof(StarGiftBackground), + [0x3AAE0528] = typeof(StarGiftAuctionRound), + [0x0AA021E5] = typeof(StarGiftAuctionRoundExtendable), + [0x46C6E36F] = typeof(Payments_StarGiftUpgradeAttributes), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index c043406..8eaa0c5 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,8 +13,8 @@ WTelegramClient Wizou 0.0.0 - layer.218 - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 218 + layer.220 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 220 Release Notes: $(ReleaseNotes) From 1912632722f01be5a91afaba7cb4da8025a3613e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 22 Dec 2025 02:34:29 +0100 Subject: [PATCH 43/54] Immediate remigrate to MainDC in case reconnection is only possible through a different DcID --- src/Client.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Client.cs b/src/Client.cs index 18a9b29..ce16017 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -871,6 +871,7 @@ namespace WTelegram { _cts = new(); IPEndPoint endpoint = null; + bool needMigrate = false; byte[] preamble, secret = null; int dcId = _dcSession?.DcID ?? 0; if (dcId == 0) dcId = 2; @@ -943,6 +944,7 @@ namespace WTelegram { endpoint = GetDefaultEndpoint(out defaultDc); // re-ask callback for an address if (!triedEndpoints.Add(endpoint)) throw; + needMigrate = _dcSession.DataCenter.id == _session.MainDC && defaultDc != _session.MainDC; _dcSession.Client = null; // is it address for a known DCSession? _dcSession = _session.DCSessions.Values.FirstOrDefault(dcs => dcs.EndPoint.Equals(endpoint)); @@ -1001,6 +1003,7 @@ namespace WTelegram _session.DCSessions[TLConfig.this_dc] = _dcSession; } if (_session.MainDC == 0) _session.MainDC = TLConfig.this_dc; + else if (needMigrate) await MigrateToDC(_session.MainDC); } } finally From 3f531f4966f40c3c778f515bc37d67c7d478185e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 3 Jan 2026 13:07:04 +0100 Subject: [PATCH 44/54] Collect: updated list of merged flags --- src/Services.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Services.cs b/src/Services.cs index cac857b..7d452f2 100644 --- a/src/Services.cs +++ b/src/Services.cs @@ -32,12 +32,17 @@ namespace TL { // update previously full user from min user: // see https://github.com/tdlib/td/blob/master/td/telegram/UserManager.cpp#L2689 // and https://github.com/telegramdesktop/tdesktop/blob/dev/Telegram/SourceFiles/data/data_session.cpp#L515 - const User.Flags updated_flags = (User.Flags)0x5DAFE000; - const User.Flags2 updated_flags2 = (User.Flags2)0x711; + const User.Flags updated_flags = User.Flags.deleted | User.Flags.bot | User.Flags.bot_chat_history | + User.Flags.bot_nochats | User.Flags.verified | User.Flags.restricted | User.Flags.has_bot_inline_placeholder | + User.Flags.bot_inline_geo | User.Flags.support | User.Flags.scam | User.Flags.fake | User.Flags.bot_attach_menu | + User.Flags.premium | User.Flags.has_emoji_status; + const User.Flags2 updated_flags2 = User.Flags2.has_usernames | User.Flags2.stories_unavailable | + User.Flags2.has_color | User.Flags2.has_profile_color | User.Flags2.contact_require_premium | + User.Flags2.bot_business | User.Flags2.bot_has_main_app | User.Flags2.bot_forum_view; // tdlib updated flags: deleted | bot | bot_chat_history | bot_nochats | verified | bot_inline_geo // | support | scam | fake | bot_attach_menu | premium // tdesktop non-updated flags: bot | bot_chat_history | bot_nochats | bot_attach_menu - // updated flags2: stories_unavailable (tdlib) | contact_require_premium (tdesktop) + // updated flags2: stories_unavailable | main_app | bot_business | bot_forum_view (tdlib) | contact_require_premium (tdesktop) prevUser.flags = (prevUser.flags & ~updated_flags) | (user.flags & updated_flags); prevUser.flags2 = (prevUser.flags2 & ~updated_flags2) | (user.flags2 & updated_flags2); prevUser.first_name ??= user.first_name; // tdlib: not updated ; tdesktop: updated only if unknown From 8fe9a485eeacd29625764fcec166fa35258837ea Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 3 Jan 2026 13:45:53 +0100 Subject: [PATCH 45/54] updated copyright year --- README.md | 2 +- src/WTelegramClient.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3edbec0..9cd653c 100644 --- a/README.md +++ b/README.md @@ -206,4 +206,4 @@ the [Examples codes](https://wiz0u.github.io/WTelegramClient/EXAMPLES) and still If you like this library, you can [buy me a coffee](https://buymeacoffee.com/wizou) ❤ This will help the project keep going. -© 2021-2025 Olivier Marcoux +© 2021-2026 Olivier Marcoux diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 8eaa0c5..6caf009 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -18,7 +18,7 @@ Release Notes: $(ReleaseNotes) - Copyright © Olivier Marcoux 2021-2025 + Copyright © Olivier Marcoux 2021-2026 MIT https://wiz0u.github.io/WTelegramClient logo.png From 0c5f589c548b8fc4f6356da6903d343d163f171e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 3 Jan 2026 18:43:39 +0100 Subject: [PATCH 46/54] Update to Telegram API layer 221 - New objects (InputMediaStakeDice, Messages_EmojiGameOutcome, Messages_EmojiGameInfo, UpdateEmojiGameInfo, InputPasskeyCredentialFirebasePNV) - New methods (messages.getEmojiGameInfo, messages.summarizeText). - Updated Message flags and MessageMediaDice fields. --- README.md | 2 +- src/TL.Schema.cs | 66 ++++++++++++++++++++++++++++++++++++-- src/TL.SchemaFuncs.cs | 33 +++++++++++++++++++ src/TL.Table.cs | 12 +++++-- src/WTelegramClient.csproj | 4 +-- 5 files changed, 109 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 9cd653c..75fd39d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-220-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-221-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 8d88c61..38271ea 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -528,6 +528,14 @@ namespace TL /// The todo list. public TodoList todo; } + /// See + [TLDef(0xF3A9244A)] + public sealed partial class InputMediaStakeDice : InputMedia + { + public string game_hash; + public long ton_amount; + public byte[] client_seed; + } /// Defines a new group profile photo. See Derived classes: , /// a value means inputChatPhotoEmpty @@ -1816,7 +1824,7 @@ namespace TL public override Peer Peer => peer_id; } /// A message See - [TLDef(0xB92F76CF)] + [TLDef(0x9CB490E9)] public sealed partial class Message : MessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1882,6 +1890,7 @@ namespace TL /// Used to suggest a post to a channel, see here » for more info on the full flow. [IfFlag(39)] public SuggestedPost suggested_post; [IfFlag(42)] public int schedule_repeat_period; + [IfFlag(43)] public string summary_from_language; [Flags] public enum Flags : uint { @@ -1969,6 +1978,8 @@ namespace TL paid_suggested_post_ton = 0x200, /// Field has a value has_schedule_repeat_period = 0x400, + /// Field has a value + has_summary_from_language = 0x800, } /// ID of the message @@ -2264,13 +2275,21 @@ namespace TL public PollResults results; } /// Dice-based animated sticker See - [TLDef(0x3F7EE58B)] + [TLDef(0x08CBEC07)] public sealed partial class MessageMediaDice : MessageMedia { + public Flags flags; /// Dice value public int value; /// The emoji, for now 🏀, 🎲 and 🎯 are supported public string emoticon; + [IfFlag(0)] public Messages_EmojiGameOutcome game_outcome; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_game_outcome = 0x1, + } } /// Represents a forwarded story or a story mention. See [TLDef(0x68CB6283)] @@ -6323,6 +6342,12 @@ namespace TL public long gift_id; public StarGiftAuctionUserState user_state; } + /// See + [TLDef(0xFB9C547A)] + public sealed partial class UpdateEmojiGameInfo : Update + { + public Messages_EmojiGameInfo info; + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -22247,6 +22272,12 @@ namespace TL public string raw_id; public InputPasskeyResponse response; } + /// See + [TLDef(0x5B1CCB28)] + public sealed partial class InputPasskeyCredentialFirebasePNV : InputPasskeyCredential + { + public string pnv_token; + } /// See [TLDef(0xAFF56398)] @@ -22278,4 +22309,35 @@ namespace TL { public StarGiftAttribute[] attributes; } + + /// See + [TLDef(0xDA2AD647)] + public sealed partial class Messages_EmojiGameOutcome : IObject + { + public byte[] seed; + public long stake_ton_amount; + public long ton_amount; + } + + /// See + public abstract partial class Messages_EmojiGameInfo : IObject { } + /// See + [TLDef(0x59E65335)] + public sealed partial class Messages_EmojiGameUnavailable : Messages_EmojiGameInfo { } + /// See + [TLDef(0x44E56023)] + public sealed partial class Messages_EmojiGameDiceInfo : Messages_EmojiGameInfo + { + public Flags flags; + public string game_hash; + public long prev_stake; + public int current_streak; + public int[] params_; + [IfFlag(0)] public int plays_left; + + [Flags] public enum Flags : uint + { + has_plays_left = 0x1, + } + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 5e2cdbc..ebcc49a 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -4857,6 +4857,22 @@ namespace TL top_msg_id = top_msg_id, }, peer is InputPeerChannel ipc ? ipc.channel_id : 0); + /// See + public static Task Messages_GetEmojiGameInfo(this Client client) + => client.Invoke(new Messages_GetEmojiGameInfo + { + }); + + /// See + public static Task Messages_SummarizeText(this Client client, InputPeer peer, int id, string to_lang = null) + => client.Invoke(new Messages_SummarizeText + { + flags = (Messages_SummarizeText.Flags)(to_lang != null ? 0x1 : 0), + peer = peer, + id = id, + to_lang = to_lang, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -12349,6 +12365,23 @@ namespace TL.Methods public int top_msg_id; } + [TLDef(0xFB7E8CA7)] + public sealed partial class Messages_GetEmojiGameInfo : IMethod { } + + [TLDef(0x9D4104E2)] + public sealed partial class Messages_SummarizeText : IMethod + { + public Flags flags; + public InputPeer peer; + public int id; + [IfFlag(0)] public string to_lang; + + [Flags] public enum Flags : uint + { + has_to_lang = 0x1, + } + } + [TLDef(0xEDD4882A)] public sealed partial class Updates_GetState : IMethod { } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 7e253c3..9c8fa3b 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 = 220; // fetched 12/06/2025 13:11:05 + public const int Version = 221; // fetched 01/03/2026 17:38:29 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -107,6 +107,7 @@ namespace TL [0xC21B8849] = typeof(InputMediaWebPage), [0xC4103386] = typeof(InputMediaPaidMedia), [0x9FC55FDE] = typeof(InputMediaTodo), + [0xF3A9244A] = typeof(InputMediaStakeDice), [0x1CA48F57] = null,//InputChatPhotoEmpty [0xBDCDAEC0] = typeof(InputChatUploadedPhoto), [0x8953AD37] = typeof(InputChatPhoto), @@ -152,7 +153,7 @@ namespace TL [0x37C1011C] = null,//ChatPhotoEmpty [0x1C6E1C11] = typeof(ChatPhoto), [0x90A6CA84] = typeof(MessageEmpty), - [0xB92F76CF] = typeof(Message), + [0x9CB490E9] = typeof(Message), [0x7A800E0A] = typeof(MessageService), [0x3DED6320] = null,//MessageMediaEmpty [0x695150D7] = typeof(MessageMediaPhoto), @@ -166,7 +167,7 @@ namespace TL [0xF6A548D3] = typeof(MessageMediaInvoice), [0xB940C666] = typeof(MessageMediaGeoLive), [0x4BD6E798] = typeof(MessageMediaPoll), - [0x3F7EE58B] = typeof(MessageMediaDice), + [0x08CBEC07] = typeof(MessageMediaDice), [0x68CB6283] = typeof(MessageMediaStory), [0xAA073BEB] = typeof(MessageMediaGiveaway), [0xCEAA3EA1] = typeof(MessageMediaGiveawayResults), @@ -448,6 +449,7 @@ namespace TL [0x3E85E92C] = typeof(UpdateDeleteGroupCallMessages), [0x48E246C2] = typeof(UpdateStarGiftAuctionState), [0xDC58F31E] = typeof(UpdateStarGiftAuctionUserState), + [0xFB9C547A] = typeof(UpdateEmojiGameInfo), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -1488,10 +1490,14 @@ namespace TL [0x3E63935C] = typeof(InputPasskeyResponseRegister), [0xC31FC14A] = typeof(InputPasskeyResponseLogin), [0x3C27B78F] = typeof(InputPasskeyCredentialPublicKey), + [0x5B1CCB28] = typeof(InputPasskeyCredentialFirebasePNV), [0xAFF56398] = typeof(StarGiftBackground), [0x3AAE0528] = typeof(StarGiftAuctionRound), [0x0AA021E5] = typeof(StarGiftAuctionRoundExtendable), [0x46C6E36F] = typeof(Payments_StarGiftUpgradeAttributes), + [0xDA2AD647] = typeof(Messages_EmojiGameOutcome), + [0x59E65335] = typeof(Messages_EmojiGameUnavailable), + [0x44E56023] = typeof(Messages_EmojiGameDiceInfo), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 6caf009..524af21 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,8 +13,8 @@ WTelegramClient Wizou 0.0.0 - layer.220 - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 220 + layer.221 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 221 Release Notes: $(ReleaseNotes) From c60c9cb7af7c4696dd13c0c01845c57c186eb8e3 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 3 Feb 2026 02:34:33 +0100 Subject: [PATCH 47/54] fix warnings/suggests --- README.md | 2 +- src/Client.Helpers.cs | 4 ++-- src/Client.cs | 2 ++ src/Compat.cs | 2 +- src/WTelegramClient.csproj | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 75fd39d..dc55f6f 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![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) -## *_Telegram Client API library written 100% in C# and .NET_* +## *Telegram Client API library written 100% in C# and .NET* This library allows you to connect to Telegram and control a user programmatically (or a bot, but [WTelegramBot](https://www.nuget.org/packages/WTelegramBot) is much easier for that). All the Telegram Client APIs (MTProto) are supported so you can do everything the user could do with a full Telegram GUI client. diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 8a3768f..eb0f8a6 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -899,8 +899,8 @@ namespace WTelegram var mc = await this.Channels_GetChannels(new InputChannel(chatId, 0)); if (!mc.chats.TryGetValue(chatId, out chat)) throw new WTException($"Channel {chatId} not found"); - else if (chats != null) - chats[chatId] = chat; + else + chats?[chatId] = chat; } } else diff --git a/src/Client.cs b/src/Client.cs index ce16017..316dfc0 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -391,7 +391,9 @@ namespace WTelegram _reactorReconnects = 0; if (_reactorReconnects == 0) throw; +#pragma warning disable CA2016 await Task.Delay(5000); +#pragma warning restore CA2016 if (_networkStream == null) return; // Dispose has been called in-between await ConnectAsync(); // start a new reactor after 5 secs lock (_pendingRpcs) // retry all pending requests diff --git a/src/Compat.cs b/src/Compat.cs index 4e9f9dc..31f26d8 100644 --- a/src/Compat.cs +++ b/src/Compat.cs @@ -75,7 +75,7 @@ namespace WTelegram static class Convert { internal static string ToHexString(byte[] data) => BitConverter.ToString(data).Replace("-", ""); - internal static byte[] FromHexString(string hex) => Enumerable.Range(0, hex.Length / 2).Select(i => System.Convert.ToByte(hex.Substring(i * 2, 2), 16)).ToArray(); + internal static byte[] FromHexString(string hex) => [.. Enumerable.Range(0, hex.Length / 2).Select(i => System.Convert.ToByte(hex.Substring(i * 2, 2), 16))]; } public class RandomNumberGenerator { diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 524af21..02e519b 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -28,7 +28,7 @@ $(ReleaseNotes) Telegram;MTProto;Client;Api;UserBot README.md $(ReleaseNotes) - NETSDK1138;CS0419;CS1573;CS1591 + NETSDK1138;CS0419;CS1573;CS1591;CA1850 TRACE;OBFUSCATION;MTPG From 3d4be8ee9a89d677be86a4ace48f31462b403cef Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 6 Feb 2026 20:27:00 +0100 Subject: [PATCH 48/54] Update to Telegram API layer 222: gift crafting, keyboard buttons style, getFutureCreatorAfterLeave and more... --- README.md | 2 +- src/TL.Schema.cs | 363 ++++++++++++++++++++++++++++++++----- src/TL.SchemaFuncs.cs | 53 +++++- src/TL.Table.cs | 63 ++++--- src/WTelegramClient.csproj | 4 +- 5 files changed, 406 insertions(+), 79 deletions(-) diff --git a/README.md b/README.md index dc55f6f..d0baa0d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-221-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-222-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 38271ea..e0f1216 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -936,6 +936,7 @@ namespace TL /// Field has a value has_send_paid_messages_stars = 0x8000, bot_forum_view = 0x10000, + bot_forum_can_manage_topics = 0x20000, } } @@ -1278,6 +1279,7 @@ namespace TL broadcast = 0x20, /// Is this a supergroup megagroup = 0x100, + monoforum = 0x400, /// Field has a value has_until_date = 0x10000, } @@ -3075,7 +3077,7 @@ namespace TL } } /// A gift » was upgraded to a collectible gift ». See - [TLDef(0x95728543)] + [TLDef(0xE6C31522)] public sealed partial class MessageActionStarGiftUnique : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -3099,6 +3101,7 @@ namespace TL /// If set, indicates that the current gift can't be resold » yet: the owner will be able to put it up for sale at the specified unixtime. [IfFlag(10)] public DateTime can_resell_at; [IfFlag(12)] public long drop_original_details_stars; + [IfFlag(15)] public DateTime can_craft_at; [Flags] public enum Flags : uint { @@ -3130,6 +3133,9 @@ namespace TL has_drop_original_details_stars = 0x1000, assigned = 0x2000, from_offer = 0x4000, + /// Field has a value + has_can_craft_at = 0x8000, + craft = 0x10000, } } /// Sent from peer A to B, indicates that A refunded all stars B previously paid to send messages to A, see here » for more info on paid messages. See @@ -3303,6 +3309,18 @@ namespace TL expired = 0x1, } } + /// See + [TLDef(0xB07ED085)] + public sealed partial class MessageActionNewCreatorPending : MessageAction + { + public long new_creator_id; + } + /// See + [TLDef(0xE188503B)] + public sealed partial class MessageActionChangeCreator : MessageAction + { + public long new_creator_id; + } /// Chat info. See Derived classes: , public abstract partial class DialogBase : IObject @@ -6348,6 +6366,9 @@ namespace TL { public Messages_EmojiGameInfo info; } + /// See + [TLDef(0xAC072444)] + public sealed partial class UpdateStarGiftCraftFail : Update { } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -8477,32 +8498,57 @@ namespace TL /// Bot or inline keyboard buttons See Derived classes: , , , , , , , , , , , , , , , , , public abstract partial class KeyboardButtonBase : IObject { + public virtual KeyboardButtonStyle Style => default; /// Button text public virtual string Text => default; } /// Bot keyboard button See - [TLDef(0xA2FA4880)] - public partial class KeyboardButton : KeyboardButtonBase + [TLDef(0x7D170CFF)] + public sealed partial class KeyboardButton : KeyboardButtonBase { + public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; /// Button text public string text; + [Flags] public enum Flags : uint + { + /// Field has a value + has_style = 0x400, + } + + public override KeyboardButtonStyle Style => style; /// Button text public override string Text => text; } /// URL button See - [TLDef(0x258AFF05, inheritBefore = true)] - public sealed partial class KeyboardButtonUrl : KeyboardButton + [TLDef(0xD80C25EC)] + public sealed partial class KeyboardButtonUrl : KeyboardButtonBase { + public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; + /// Button label + public string text; /// URL public string url; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_style = 0x400, + } + + public override KeyboardButtonStyle Style => style; + /// Button label + public override string Text => text; } /// Callback button See - [TLDef(0x35BBDB6B)] + [TLDef(0xE62BC960)] public sealed partial class KeyboardButtonCallback : KeyboardButtonBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; /// Button text public string text; /// Callback data @@ -8512,27 +8558,59 @@ namespace TL { /// Whether the user should verify his identity by entering his 2FA SRP parameters to the Messages_GetBotCallbackAnswer method. NOTE: telegram and the bot WILL NOT have access to the plaintext password, thanks to SRP. This button is mainly used by the official @botfather bot, for verifying the user's identity before transferring ownership of a bot to another user. requires_password = 0x1, + /// Field has a value + has_style = 0x400, } + public override KeyboardButtonStyle Style => style; /// Button text public override string Text => text; } /// Button to request a user's phone number See - [TLDef(0xB16A6C29)] - public sealed partial class KeyboardButtonRequestPhone : KeyboardButton + [TLDef(0x417EFD8F)] + public sealed partial class KeyboardButtonRequestPhone : KeyboardButtonBase { + public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; + /// Button text + public string text; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_style = 0x400, + } + + public override KeyboardButtonStyle Style => style; + /// Button text + public override string Text => text; } /// Button to request a user's geolocation See - [TLDef(0xFC796B3F)] - public sealed partial class KeyboardButtonRequestGeoLocation : KeyboardButton + [TLDef(0xAA40F94D)] + public sealed partial class KeyboardButtonRequestGeoLocation : KeyboardButtonBase { + public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; + /// Button text + public string text; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_style = 0x400, + } + + public override KeyboardButtonStyle Style => style; + /// Button text + public override string Text => text; } /// Button to force a user to switch to inline mode: pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. See - [TLDef(0x93B9FBB5)] + [TLDef(0x991399FC)] public sealed partial class KeyboardButtonSwitchInline : KeyboardButtonBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; /// Button label public string text; /// The inline query to use @@ -8546,27 +8624,59 @@ namespace TL same_peer = 0x1, /// Field has a value has_peer_types = 0x2, + /// Field has a value + has_style = 0x400, } + public override KeyboardButtonStyle Style => style; /// Button label public override string Text => text; } /// Button to start a game See - [TLDef(0x50F41CCF)] - public sealed partial class KeyboardButtonGame : KeyboardButton + [TLDef(0x89C590F9)] + public sealed partial class KeyboardButtonGame : KeyboardButtonBase { + public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; + /// Button text + public string text; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_style = 0x400, + } + + public override KeyboardButtonStyle Style => style; + /// Button text + public override string Text => text; } /// Button to buy a product See - [TLDef(0xAFD93FBB)] - public sealed partial class KeyboardButtonBuy : KeyboardButton + [TLDef(0x3FA53905)] + public sealed partial class KeyboardButtonBuy : KeyboardButtonBase { + public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; + /// Button text + public string text; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_style = 0x400, + } + + public override KeyboardButtonStyle Style => style; + /// Button text + public override string Text => text; } /// Button to request a user to authorize via URL using Seamless Telegram Login. When the user clicks on such a button, Messages_RequestUrlAuth should be called, providing the button_id and the ID of the container message. The returned object will contain more details about the authorization request (request_write_access if the bot would like to send messages to the user along with the username of the bot which will be used for user authorization). Finally, the user can choose to call Messages_AcceptUrlAuth to get a with the URL to open instead of the url of this constructor, or a , in which case the url of this constructor must be opened, instead. If the user refuses the authorization request but still wants to open the link, the url of this constructor must be used. See - [TLDef(0x10B78D29)] + [TLDef(0xF51006F9)] public sealed partial class KeyboardButtonUrlAuth : KeyboardButtonBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; /// Button label public string text; /// New text of the button in forwarded messages. @@ -8580,17 +8690,21 @@ namespace TL { /// Field has a value has_fwd_text = 0x1, + /// Field has a value + has_style = 0x400, } + public override KeyboardButtonStyle Style => style; /// Button label public override string Text => text; } /// Button to request a user to Messages_AcceptUrlAuth via URL using Seamless Telegram Login. See - [TLDef(0xD02E7FD4)] + [TLDef(0x68013E72)] public sealed partial class InputKeyboardButtonUrlAuth : KeyboardButtonBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; /// Button text public string text; /// New text of the button in forwarded messages. @@ -8606,74 +8720,154 @@ namespace TL request_write_access = 0x1, /// Field has a value has_fwd_text = 0x2, + /// Field has a value + has_style = 0x400, } + public override KeyboardButtonStyle Style => style; /// Button text public override string Text => text; } /// A button that allows the user to create and send a poll when pressed; available only in private See - [TLDef(0xBBC7515D)] - public sealed partial class KeyboardButtonRequestPoll : KeyboardButton + [TLDef(0x7A11D782)] + public sealed partial class KeyboardButtonRequestPoll : KeyboardButtonBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; /// If set, only quiz polls can be sent [IfFlag(0)] public bool quiz; + /// Button text + public string text; [Flags] public enum Flags : uint { /// Field has a value has_quiz = 0x1, + /// Field has a value + has_style = 0x400, } + + public override KeyboardButtonStyle Style => style; + /// Button text + public override string Text => text; } /// Button that links directly to a user profile See - [TLDef(0xE988037B)] + [TLDef(0x7D5E07C7)] public sealed partial class InputKeyboardButtonUserProfile : KeyboardButtonBase { + public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; /// Button text public string text; /// User ID public InputUserBase user_id; + [Flags] public enum Flags : uint + { + /// Field has a value + has_style = 0x400, + } + + public override KeyboardButtonStyle Style => style; /// Button text public override string Text => text; } /// Button that links directly to a user profile See - [TLDef(0x308660C1, inheritBefore = true)] - public sealed partial class KeyboardButtonUserProfile : KeyboardButton + [TLDef(0xC0FD5D09)] + public sealed partial class KeyboardButtonUserProfile : KeyboardButtonBase { + public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; + /// Button text + public string text; /// User ID public long user_id; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_style = 0x400, + } + + public override KeyboardButtonStyle Style => style; + /// Button text + public override string Text => text; } /// Button to open a bot mini app using Messages_RequestWebView, sending over user information after user confirmation. See - [TLDef(0x13767230, inheritBefore = true)] - public partial class KeyboardButtonWebView : KeyboardButton + [TLDef(0xE846B1A0)] + public sealed partial class KeyboardButtonWebView : KeyboardButtonBase { + public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; + /// Button text + public string text; /// Web app url public string url; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_style = 0x400, + } + + public override KeyboardButtonStyle Style => style; + /// Button text + public override string Text => text; } /// Button to open a bot mini app using Messages_RequestSimpleWebView, without sending user information to the web app. See - [TLDef(0xA0C0505C)] - public sealed partial class KeyboardButtonSimpleWebView : KeyboardButtonWebView + [TLDef(0xE15C4370)] + public sealed partial class KeyboardButtonSimpleWebView : KeyboardButtonBase { + public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; + /// Button text + public string text; + /// Web app URL + public string url; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_style = 0x400, + } + + public override KeyboardButtonStyle Style => style; + /// Button text + public override string Text => text; } /// Prompts the user to select and share one or more peers with the bot using Messages_SendBotRequestedPeer See - [TLDef(0x53D7BFD8, inheritBefore = true)] - public sealed partial class KeyboardButtonRequestPeer : KeyboardButton + [TLDef(0x5B0F15F5)] + public sealed partial class KeyboardButtonRequestPeer : KeyboardButtonBase { + public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; + /// Button text + public string text; /// Button ID, to be passed to Messages_SendBotRequestedPeer. public int button_id; /// Filtering criteria to use for the peer selection list shown to the user.
The list should display all existing peers of the specified type, and should also offer an option for the user to create and immediately use one or more (up to max_quantity) peers of the specified type, if needed.
public RequestPeerType peer_type; /// Maximum number of peers that can be chosen. public int max_quantity; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_style = 0x400, + } + + public override KeyboardButtonStyle Style => style; + /// Button text + public override string Text => text; } ///
Prompts the user to select and share one or more peers with the bot using Messages_SendBotRequestedPeer. See - [TLDef(0xC9662D05)] + [TLDef(0x02B78156)] public sealed partial class InputKeyboardButtonRequestPeer : KeyboardButtonBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; /// Button text public string text; /// Button ID, to be passed to Messages_SendBotRequestedPeer. @@ -8691,17 +8885,34 @@ namespace TL username_requested = 0x2, /// Set this flag to request the peer's photo (if any). photo_requested = 0x4, + /// Field has a value + has_style = 0x400, } + public override KeyboardButtonStyle Style => style; /// Button text public override string Text => text; } /// Clipboard button: when clicked, the attached text must be copied to the clipboard. See - [TLDef(0x75D2698E, inheritBefore = true)] - public sealed partial class KeyboardButtonCopy : KeyboardButton + [TLDef(0xBCC4AF10)] + public sealed partial class KeyboardButtonCopy : KeyboardButtonBase { + public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; + /// Title of the button + public string text; /// The text that will be copied to the clipboard public string copy_text; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_style = 0x400, + } + + public override KeyboardButtonStyle Style => style; + /// Title of the button + public override string Text => text; } /// Inline keyboard row See @@ -14253,7 +14464,7 @@ namespace TL /// a value means urlAuthResultDefault public abstract partial class UrlAuthResult : IObject { } /// Details about the authorization request, for more info click here » See - [TLDef(0x92D33A0E)] + [TLDef(0x32FABF1A)] public sealed partial class UrlAuthResultRequest : UrlAuthResult { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -14262,19 +14473,33 @@ namespace TL public UserBase bot; /// The domain name of the website on which the user will log in. public string domain; + [IfFlag(2)] public string browser; + [IfFlag(2)] public string platform; + [IfFlag(2)] public string ip; + [IfFlag(2)] public string region; [Flags] public enum Flags : uint { /// Whether the bot would like to send messages to the user request_write_access = 0x1, + request_phone_number = 0x2, + /// Fields , , and have a value + has_browser = 0x4, } } /// Details about an accepted authorization request, for more info click here » See - [TLDef(0x8F8C0E4E)] + [TLDef(0x623A8FA0)] public sealed partial class UrlAuthResultAccepted : UrlAuthResult { + public Flags flags; /// The URL name of the website on which the user has logged in. - public string url; + [IfFlag(0)] public string url; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_url = 0x1, + } } /// Geographical location of supergroup (geogroups) See @@ -20780,7 +21005,7 @@ namespace TL public override Peer ReleasedBy => released_by; } /// Represents a collectible star gift, see here » for more info. See - [TLDef(0x569D64C9)] + [TLDef(0x85F0A9CD)] public sealed partial class StarGiftUnique : StarGiftBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -20823,6 +21048,7 @@ namespace TL [IfFlag(11)] public PeerColorBase peer_color; [IfFlag(12)] public Peer host_id; [IfFlag(13)] public int offer_min_stars; + [IfFlag(16)] public int craft_chance_permille; [Flags] public enum Flags : uint { @@ -20854,6 +21080,10 @@ namespace TL has_host_id = 0x1000, /// Field has a value has_offer_min_stars = 0x2000, + burned = 0x4000, + crafted = 0x8000, + /// Field has a value + has_craft_chance_permille = 0x10000, } /// Identifier of the collectible gift. @@ -21176,29 +21406,33 @@ namespace TL /// An attribute of a collectible gift ». See Derived classes: , , , public abstract partial class StarGiftAttribute : IObject { } /// The model of a collectible gift ». See - [TLDef(0x39D99013)] + [TLDef(0x565251E2)] public sealed partial class StarGiftAttributeModel : StarGiftAttribute { + public Flags flags; /// Name of the model public string name; /// The sticker representing the upgraded gift public DocumentBase document; - /// The number of upgraded gifts that receive this backdrop for each 1000 gifts upgraded. - public int rarity_permille; + public StarGiftAttributeRarityBase rarity; + + [Flags] public enum Flags : uint + { + crafted = 0x1, + } } /// A sticker applied on the backdrop of a collectible gift » using a repeating pattern. See - [TLDef(0x13ACFF19)] + [TLDef(0x4E7085EA)] public sealed partial class StarGiftAttributePattern : StarGiftAttribute { /// Name of the symbol public string name; /// The symbol public DocumentBase document; - /// The number of upgraded gifts that receive this backdrop for each 1000 gifts upgraded. - public int rarity_permille; + public StarGiftAttributeRarityBase rarity; } /// The backdrop of a collectible gift ». See - [TLDef(0xD93D859C)] + [TLDef(0x9F2504E4)] public sealed partial class StarGiftAttributeBackdrop : StarGiftAttribute { /// Name of the backdrop @@ -21213,8 +21447,7 @@ namespace TL public int pattern_color; /// Color of the text on the backdrop in RGB24 format. public int text_color; - /// The number of upgraded gifts that receive this backdrop for each 1000 gifts upgraded. - public int rarity_permille; + public StarGiftAttributeRarityBase rarity; } /// Info about the sender, receiver and message attached to the original gift », before it was upgraded to a collectible gift ». See [TLDef(0xE0BFF26C)] @@ -21294,7 +21527,7 @@ namespace TL } /// Represents a gift owned by a peer. See - [TLDef(0xEAD6805E)] + [TLDef(0x41DF43FC)] public sealed partial class SavedStarGift : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -21329,6 +21562,7 @@ namespace TL [IfFlag(16)] public string prepaid_upgrade_hash; [IfFlag(18)] public long drop_original_details_stars; [IfFlag(19)] public int gift_num; + [IfFlag(20)] public DateTime can_craft_at; [Flags] public enum Flags : uint { @@ -21372,6 +21606,8 @@ namespace TL has_drop_original_details_stars = 0x40000, /// Field has a value has_gift_num = 0x80000, + /// Field has a value + has_can_craft_at = 0x100000, } } @@ -22340,4 +22576,41 @@ namespace TL has_plays_left = 0x1, } } + + /// See + public abstract partial class StarGiftAttributeRarityBase : IObject { } + /// See + [TLDef(0x36437737)] + public sealed partial class StarGiftAttributeRarity : StarGiftAttributeRarityBase + { + public int permille; + } + /// See + [TLDef(0xDBCE6389)] + public sealed partial class StarGiftAttributeRarityUncommon : StarGiftAttributeRarityBase { } + /// See + [TLDef(0xF08D516B)] + public sealed partial class StarGiftAttributeRarityRare : StarGiftAttributeRarityBase { } + /// See + [TLDef(0x78FBF3A8)] + public sealed partial class StarGiftAttributeRarityEpic : StarGiftAttributeRarityBase { } + /// See + [TLDef(0xCEF7E7A8)] + public sealed partial class StarGiftAttributeRarityLegendary : StarGiftAttributeRarityBase { } + + /// See + [TLDef(0x4FDD3430)] + public sealed partial class KeyboardButtonStyle : IObject + { + public Flags flags; + [IfFlag(3)] public long icon; + + [Flags] public enum Flags : uint + { + bg_primary = 0x1, + bg_danger = 0x2, + bg_success = 0x4, + has_icon = 0x8, + } + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index ebcc49a..c7ded16 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -3308,10 +3308,10 @@ namespace TL /// ID of the login button /// URL used for link URL authorization, click here for more info » /// a null value means urlAuthResultDefault - public static Task Messages_AcceptUrlAuth(this Client client, InputPeer peer = null, int? msg_id = null, int? button_id = null, string url = null, bool write_allowed = false) + public static Task Messages_AcceptUrlAuth(this Client client, InputPeer peer = null, int? msg_id = null, int? button_id = null, string url = null, bool write_allowed = false, bool share_phone_number = false) => client.Invoke(new Messages_AcceptUrlAuth { - flags = (Messages_AcceptUrlAuth.Flags)((peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0) | (write_allowed ? 0x1 : 0)), + flags = (Messages_AcceptUrlAuth.Flags)((peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0) | (write_allowed ? 0x1 : 0) | (share_phone_number ? 0x8 : 0)), peer = peer, msg_id = msg_id ?? default, button_id = button_id ?? default, @@ -5914,6 +5914,13 @@ namespace TL tab = tab, }); + /// See + public static Task Channels_GetFutureCreatorAfterLeave(this Client client, InputChannelBase channel) + => client.Invoke(new Channels_GetFutureCreatorAfterLeave + { + channel = channel, + }); + /// Sends a custom request; for bots only See [bots: ✓ users: ✗] Possible codes: 400 (details) /// The method name /// JSON-serialized method parameters @@ -6743,10 +6750,10 @@ namespace TL /// Optionally filter gifts with the specified attributes. If no attributes of a specific type are specified, all attributes of that type are allowed. /// Offset for pagination. If not equal to an empty string, .counters will not be set to avoid returning the counters every time a new page is fetched. /// Maximum number of results to return, see pagination - public static Task Payments_GetResaleStarGifts(this Client client, long gift_id, string offset, int limit = int.MaxValue, long? attributes_hash = null, StarGiftAttributeId[] attributes = null, bool sort_by_price = false, bool sort_by_num = false) + public static Task Payments_GetResaleStarGifts(this Client client, long gift_id, string offset, int limit = int.MaxValue, long? attributes_hash = null, StarGiftAttributeId[] attributes = null, bool sort_by_price = false, bool sort_by_num = false, bool for_craft = false) => client.Invoke(new Payments_GetResaleStarGifts { - flags = (Payments_GetResaleStarGifts.Flags)((attributes_hash != null ? 0x1 : 0) | (attributes != null ? 0x8 : 0) | (sort_by_price ? 0x2 : 0) | (sort_by_num ? 0x4 : 0)), + flags = (Payments_GetResaleStarGifts.Flags)((attributes_hash != null ? 0x1 : 0) | (attributes != null ? 0x8 : 0) | (sort_by_price ? 0x2 : 0) | (sort_by_num ? 0x4 : 0) | (for_craft ? 0x10 : 0)), attributes_hash = attributes_hash ?? default, gift_id = gift_id, attributes = attributes, @@ -6893,6 +6900,22 @@ namespace TL gift_id = gift_id, }); + /// See + public static Task Payments_GetCraftStarGifts(this Client client, long gift_id, string offset, int limit = int.MaxValue) + => client.Invoke(new Payments_GetCraftStarGifts + { + gift_id = gift_id, + offset = offset, + limit = limit, + }); + + /// See + public static Task Payments_CraftStarGift(this Client client, params InputSavedStarGift[] stargift) + => client.Invoke(new Payments_CraftStarGift + { + stargift = stargift, + }); + /// Create a stickerset. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is a custom emoji stickerset. @@ -11060,6 +11083,7 @@ namespace TL.Methods write_allowed = 0x1, has_peer = 0x2, has_url = 0x4, + share_phone_number = 0x8, } } @@ -13190,6 +13214,12 @@ namespace TL.Methods public ProfileTab tab; } + [TLDef(0xA00918AF)] + public sealed partial class Channels_GetFutureCreatorAfterLeave : IMethod + { + public InputChannelBase channel; + } + [TLDef(0xAA2769ED)] public sealed partial class Bots_SendCustomRequest : IMethod { @@ -13911,6 +13941,7 @@ namespace TL.Methods sort_by_price = 0x2, sort_by_num = 0x4, has_attributes = 0x8, + for_craft = 0x10, } } @@ -14036,6 +14067,20 @@ namespace TL.Methods public long gift_id; } + [TLDef(0xFD05DD00)] + public sealed partial class Payments_GetCraftStarGifts : IMethod + { + public long gift_id; + public string offset; + public int limit; + } + + [TLDef(0xB0F9684F)] + public sealed partial class Payments_CraftStarGift : IMethod + { + public InputSavedStarGift[] stargift; + } + [TLDef(0x9021AB67)] public sealed partial class Stickers_CreateStickerSet : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 9c8fa3b..58c89c4 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 = 221; // fetched 01/03/2026 17:38:29 + public const int Version = 222; // fetched 02/06/2026 19:18:24 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -221,7 +221,7 @@ namespace TL [0x45D5B021] = typeof(MessageActionGiftStars), [0xB00C47A2] = typeof(MessageActionPrizeStars), [0xEA2C31D3] = typeof(MessageActionStarGift), - [0x95728543] = typeof(MessageActionStarGiftUnique), + [0xE6C31522] = typeof(MessageActionStarGiftUnique), [0xAC1F1FCD] = typeof(MessageActionPaidMessagesRefunded), [0x84B88578] = typeof(MessageActionPaidMessagesPrice), [0x2FFE2F7A] = typeof(MessageActionConferenceCall), @@ -234,6 +234,8 @@ namespace TL [0x2C8F2A25] = typeof(MessageActionSuggestBirthday), [0x774278D4] = typeof(MessageActionStarGiftPurchaseOffer), [0x73ADA76B] = typeof(MessageActionStarGiftPurchaseOfferDeclined), + [0xB07ED085] = typeof(MessageActionNewCreatorPending), + [0xE188503B] = typeof(MessageActionChangeCreator), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -450,6 +452,7 @@ namespace TL [0x48E246C2] = typeof(UpdateStarGiftAuctionState), [0xDC58F31E] = typeof(UpdateStarGiftAuctionUserState), [0xFB9C547A] = typeof(UpdateEmojiGameInfo), + [0xAC072444] = typeof(UpdateStarGiftCraftFail), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -594,24 +597,24 @@ namespace TL [0xD3F924EB] = null,//Messages_StickerSetNotModified [0xC27AC8C7] = typeof(BotCommand), [0x4D8A0299] = typeof(BotInfo), - [0xA2FA4880] = typeof(KeyboardButton), - [0x258AFF05] = typeof(KeyboardButtonUrl), - [0x35BBDB6B] = typeof(KeyboardButtonCallback), - [0xB16A6C29] = typeof(KeyboardButtonRequestPhone), - [0xFC796B3F] = typeof(KeyboardButtonRequestGeoLocation), - [0x93B9FBB5] = typeof(KeyboardButtonSwitchInline), - [0x50F41CCF] = typeof(KeyboardButtonGame), - [0xAFD93FBB] = typeof(KeyboardButtonBuy), - [0x10B78D29] = typeof(KeyboardButtonUrlAuth), - [0xD02E7FD4] = typeof(InputKeyboardButtonUrlAuth), - [0xBBC7515D] = typeof(KeyboardButtonRequestPoll), - [0xE988037B] = typeof(InputKeyboardButtonUserProfile), - [0x308660C1] = typeof(KeyboardButtonUserProfile), - [0x13767230] = typeof(KeyboardButtonWebView), - [0xA0C0505C] = typeof(KeyboardButtonSimpleWebView), - [0x53D7BFD8] = typeof(KeyboardButtonRequestPeer), - [0xC9662D05] = typeof(InputKeyboardButtonRequestPeer), - [0x75D2698E] = typeof(KeyboardButtonCopy), + [0x7D170CFF] = typeof(KeyboardButton), + [0xD80C25EC] = typeof(KeyboardButtonUrl), + [0xE62BC960] = typeof(KeyboardButtonCallback), + [0x417EFD8F] = typeof(KeyboardButtonRequestPhone), + [0xAA40F94D] = typeof(KeyboardButtonRequestGeoLocation), + [0x991399FC] = typeof(KeyboardButtonSwitchInline), + [0x89C590F9] = typeof(KeyboardButtonGame), + [0x3FA53905] = typeof(KeyboardButtonBuy), + [0xF51006F9] = typeof(KeyboardButtonUrlAuth), + [0x68013E72] = typeof(InputKeyboardButtonUrlAuth), + [0x7A11D782] = typeof(KeyboardButtonRequestPoll), + [0x7D5E07C7] = typeof(InputKeyboardButtonUserProfile), + [0xC0FD5D09] = typeof(KeyboardButtonUserProfile), + [0xE846B1A0] = typeof(KeyboardButtonWebView), + [0xE15C4370] = typeof(KeyboardButtonSimpleWebView), + [0x5B0F15F5] = typeof(KeyboardButtonRequestPeer), + [0x02B78156] = typeof(InputKeyboardButtonRequestPeer), + [0xBCC4AF10] = typeof(KeyboardButtonCopy), [0x77608B83] = typeof(KeyboardButtonRow), [0xA03E5B85] = typeof(ReplyKeyboardHide), [0x86B40B08] = typeof(ReplyKeyboardForceReply), @@ -999,8 +1002,8 @@ namespace TL [0xFBD2C296] = typeof(InputFolderPeer), [0xE9BAA668] = typeof(FolderPeer), [0xE844EBFF] = typeof(Messages_SearchCounter), - [0x92D33A0E] = typeof(UrlAuthResultRequest), - [0x8F8C0E4E] = typeof(UrlAuthResultAccepted), + [0x32FABF1A] = typeof(UrlAuthResultRequest), + [0x623A8FA0] = typeof(UrlAuthResultAccepted), [0xA9D6DB1F] = null,//UrlAuthResultDefault [0xBFB5AD8B] = null,//ChannelLocationEmpty [0x209B82DB] = typeof(ChannelLocation), @@ -1389,7 +1392,7 @@ namespace TL [0x94CE852A] = typeof(StarsGiveawayOption), [0x54236209] = typeof(StarsGiveawayWinnersOption), [0x313A9547] = typeof(StarGift), - [0x569D64C9] = typeof(StarGiftUnique), + [0x85F0A9CD] = typeof(StarGiftUnique), [0xA388A368] = null,//Payments_StarGiftsNotModified [0x2ED82995] = typeof(Payments_StarGifts), [0x7903E3D9] = typeof(MessageReportOption), @@ -1409,16 +1412,16 @@ namespace TL [0x82C9E290] = typeof(Messages_FoundStickers), [0xB0CD6617] = typeof(BotVerifierSettings), [0xF93CD45C] = typeof(BotVerification), - [0x39D99013] = typeof(StarGiftAttributeModel), - [0x13ACFF19] = typeof(StarGiftAttributePattern), - [0xD93D859C] = typeof(StarGiftAttributeBackdrop), + [0x565251E2] = typeof(StarGiftAttributeModel), + [0x4E7085EA] = typeof(StarGiftAttributePattern), + [0x9F2504E4] = typeof(StarGiftAttributeBackdrop), [0xE0BFF26C] = typeof(StarGiftAttributeOriginalDetails), [0x3DE1DFED] = typeof(Payments_StarGiftUpgradePreview), [0x62D706B8] = typeof(Users_Users), [0x315A4974] = typeof(Users_UsersSlice), [0x416C56E8] = typeof(Payments_UniqueStarGift), [0x8C9A88AC] = typeof(Messages_WebPagePreview), - [0xEAD6805E] = typeof(SavedStarGift), + [0x41DF43FC] = typeof(SavedStarGift), [0x95F389B1] = typeof(Payments_SavedStarGifts), [0x69279795] = typeof(InputSavedStarGiftUser), [0xF101AA7F] = typeof(InputSavedStarGiftChat), @@ -1498,6 +1501,12 @@ namespace TL [0xDA2AD647] = typeof(Messages_EmojiGameOutcome), [0x59E65335] = typeof(Messages_EmojiGameUnavailable), [0x44E56023] = typeof(Messages_EmojiGameDiceInfo), + [0x36437737] = typeof(StarGiftAttributeRarity), + [0xDBCE6389] = typeof(StarGiftAttributeRarityUncommon), + [0xF08D516B] = typeof(StarGiftAttributeRarityRare), + [0x78FBF3A8] = typeof(StarGiftAttributeRarityEpic), + [0xCEF7E7A8] = typeof(StarGiftAttributeRarityLegendary), + [0x4FDD3430] = typeof(KeyboardButtonStyle), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 02e519b..aef2b5c 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,8 +13,8 @@ WTelegramClient Wizou 0.0.0 - layer.221 - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 221 + layer.222 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 222 Release Notes: $(ReleaseNotes) From 42fed132054ce8dcd6e9d06242b08c068c02f605 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 27 Feb 2026 16:40:53 +0100 Subject: [PATCH 49/54] Making method Invoke virtual for library add-ons. --- src/Client.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Client.cs b/src/Client.cs index 316dfc0..fbeb56b 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1584,7 +1584,7 @@ namespace WTelegram /// Expected type of the returned object /// TL method structure /// Wait for the reply and return the resulting object, or throws an RpcException if an error was replied - public async Task Invoke(IMethod query) + public virtual async Task Invoke(IMethod query) { if (_dcSession.withoutUpdates && query is not IMethod and not IMethod) query = new TL.Methods.InvokeWithoutUpdates { query = query }; From bd311a3a4fb276b9415aaa2f2c87c9a7480130fe Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 2 Mar 2026 16:25:35 +0100 Subject: [PATCH 50/54] TLDef.inheritBefore => inheritAt --- generator/MTProtoGenerator.cs | 7 ++-- src/TL.MTProto.cs | 20 +++++------ src/TL.Schema.cs | 66 +++++++++++++++++------------------ src/TL.Secret.cs | 2 +- src/TL.cs | 23 +++++++++--- 5 files changed, 66 insertions(+), 52 deletions(-) diff --git a/generator/MTProtoGenerator.cs b/generator/MTProtoGenerator.cs index f326c13..44c7c35 100644 --- a/generator/MTProtoGenerator.cs +++ b/generator/MTProtoGenerator.cs @@ -112,11 +112,12 @@ public class MTProtoGenerator : IIncrementalGenerator .AppendLine("\t\t{") .AppendLine($"\t\t\twriter.Write(0x{id:X8});"); var members = symbol.GetMembers().ToList(); + int inheritIndex = 0; for (var parent = symbol.BaseType; parent != object_; parent = parent.BaseType) { - var inheritBefore = (bool?)tldef.NamedArguments.FirstOrDefault(k => k.Key == "inheritBefore").Value.Value ?? false; - if (inheritBefore) members.InsertRange(0, parent.GetMembers()); - else members.AddRange(parent.GetMembers()); + var inheritAt = (int?)tldef.NamedArguments.FirstOrDefault(k => k.Key == "inheritAt").Value.Value ?? -1; + if (inheritAt >= 0) members.InsertRange(inheritIndex += inheritAt, parent.GetMembers()); + else { inheritIndex = members.Count; members.AddRange(parent.GetMembers()); } tldef = parent.GetAttributes().FirstOrDefault(a => a.AttributeClass == tlDefAttribute); } foreach (var member in members.OfType()) diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index 4b6e052..de10b70 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -25,17 +25,17 @@ namespace TL public Int128 server_nonce; public Int256 new_nonce; } - [TLDef(0xA9F55F95, inheritBefore = true)] //p_q_inner_data_dc#a9f55f95 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 dc:int = P_Q_inner_data + [TLDef(0xA9F55F95, inheritAt = 0)] //p_q_inner_data_dc#a9f55f95 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 dc:int = P_Q_inner_data public sealed partial class PQInnerDataDc : PQInnerData { public int dc; } - [TLDef(0x3C6A84D4, inheritBefore = true)] //p_q_inner_data_temp#3c6a84d4 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 expires_in:int = P_Q_inner_data + [TLDef(0x3C6A84D4, inheritAt = 0)] //p_q_inner_data_temp#3c6a84d4 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 expires_in:int = P_Q_inner_data public sealed partial class PQInnerDataTemp : PQInnerData { public int expires_in; } - [TLDef(0x56FDDF88, inheritBefore = true)] //p_q_inner_data_temp_dc#56fddf88 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 dc:int expires_in:int = P_Q_inner_data + [TLDef(0x56FDDF88, inheritAt = 0)] //p_q_inner_data_temp_dc#56fddf88 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 dc:int expires_in:int = P_Q_inner_data public sealed partial class PQInnerDataTempDc : PQInnerData { public int dc; @@ -57,12 +57,12 @@ namespace TL public Int128 nonce; public Int128 server_nonce; } - [TLDef(0x79CB045D, inheritBefore = true)] //server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params + [TLDef(0x79CB045D, inheritAt = 0)] //server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params public sealed partial class ServerDHParamsFail : ServerDHParams { public Int128 new_nonce_hash; } - [TLDef(0xD0E8075C, inheritBefore = true)] //server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:bytes = Server_DH_Params + [TLDef(0xD0E8075C, inheritAt = 0)] //server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:bytes = Server_DH_Params public sealed partial class ServerDHParamsOk : ServerDHParams { public byte[] encrypted_answer; @@ -93,17 +93,17 @@ namespace TL public Int128 nonce; public Int128 server_nonce; } - [TLDef(0x3BCBF734, inheritBefore = true)] //dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer + [TLDef(0x3BCBF734, inheritAt = 0)] //dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer public sealed partial class DhGenOk : SetClientDHParamsAnswer { public Int128 new_nonce_hash1; } - [TLDef(0x46DC1FB9, inheritBefore = true)] //dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer + [TLDef(0x46DC1FB9, inheritAt = 0)] //dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer public sealed partial class DhGenRetry : SetClientDHParamsAnswer { public Int128 new_nonce_hash2; } - [TLDef(0xA69DAE02, inheritBefore = true)] //dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer + [TLDef(0xA69DAE02, inheritAt = 0)] //dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer public sealed partial class DhGenFail : SetClientDHParamsAnswer { public Int128 new_nonce_hash3; @@ -130,7 +130,7 @@ namespace TL public int bad_msg_seqno; public int error_code; } - [TLDef(0xEDAB447B, inheritBefore = true)] //bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int error_code:int new_server_salt:long = BadMsgNotification + [TLDef(0xEDAB447B, inheritAt = 0)] //bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int error_code:int new_server_salt:long = BadMsgNotification public sealed partial class BadServerSalt : BadMsgNotification { public long new_server_salt; @@ -267,7 +267,7 @@ namespace TL public int ipv4; public int port; } - [TLDef(0x37982646, inheritBefore = true)] //ipPortSecret#37982646 ipv4:int port:int secret:bytes = IpPort + [TLDef(0x37982646, inheritAt = 0)] //ipPortSecret#37982646 ipv4:int port:int secret:bytes = IpPort public sealed partial class IpPortSecret : IpPort { public byte[] secret; diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index e0f1216..e5d7470 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2732,7 +2732,7 @@ namespace TL [TLDef(0xEBBCA3CB)] public sealed partial class MessageActionChatJoinedByRequest : MessageAction { } /// Data from an opened reply keyboard bot mini app was relayed to the bot that owns it (bot side service message). See - [TLDef(0x47DD8079, inheritBefore = true)] + [TLDef(0x47DD8079, inheritAt = 0)] public sealed partial class MessageActionWebViewDataSentMe : MessageActionWebViewDataSent { /// Relayed data. @@ -4401,7 +4401,7 @@ namespace TL } /// Affected part of communication history with the user or in a chat. See - [TLDef(0xB45C69D1, inheritBefore = true)] + [TLDef(0xB45C69D1, inheritAt = 0)] public partial class Messages_AffectedHistory : Messages_AffectedMessages { /// If a parameter contains positive value, it is necessary to repeat the method call using the given value; during the proceeding of all the history the value itself shall gradually decrease @@ -4531,7 +4531,7 @@ namespace TL } } /// The user is preparing a message in a group; typing, recording, uploading, etc. This update is valid for 6 seconds. If no further updates of this kind are received after 6 seconds, it should be considered that the user stopped doing whatever they were doing See - [TLDef(0x83487AF0, inheritBefore = true)] + [TLDef(0x83487AF0, inheritAt = 0)] public sealed partial class UpdateChatUserTyping : UpdateChat { /// Peer that started typing (can be the chat itself, in case of anonymous admins). @@ -4547,14 +4547,14 @@ namespace TL public ChatParticipantsBase participants; } /// Contact status update. See - [TLDef(0xE5BDF8DE, inheritBefore = true)] + [TLDef(0xE5BDF8DE, inheritAt = 0)] public sealed partial class UpdateUserStatus : UpdateUser { /// New status public UserStatus status; } /// Changes the user's first name, last name and username. See - [TLDef(0xA7848924, inheritBefore = true)] + [TLDef(0xA7848924, inheritAt = 0)] public sealed partial class UpdateUserName : UpdateUser { /// New first name. Corresponds to the new value of real_first_name field of the . @@ -4625,7 +4625,7 @@ namespace TL public DateTime date; } /// New group member. See - [TLDef(0x3DDA5451, inheritBefore = true)] + [TLDef(0x3DDA5451, inheritAt = 0)] public sealed partial class UpdateChatParticipantAdd : UpdateChat { /// ID of the new member @@ -4638,7 +4638,7 @@ namespace TL public int version; } /// A member has left the group. See - [TLDef(0xE32F3D77, inheritBefore = true)] + [TLDef(0xE32F3D77, inheritAt = 0)] public sealed partial class UpdateChatParticipantDelete : UpdateChat { /// ID of the user @@ -4699,7 +4699,7 @@ namespace TL public PrivacyRule[] rules; } /// A user's phone number was changed See - [TLDef(0x05492A13, inheritBefore = true)] + [TLDef(0x05492A13, inheritAt = 0)] public sealed partial class UpdateUserPhone : UpdateUser { /// New phone number @@ -4861,7 +4861,7 @@ namespace TL public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// The view counter of a message in a channel has changed See - [TLDef(0xF226AC08, inheritBefore = true)] + [TLDef(0xF226AC08, inheritAt = 0)] public sealed partial class UpdateChannelMessageViews : UpdateChannel { /// ID of the message @@ -4870,7 +4870,7 @@ namespace TL public int views; } /// Admin permissions of a user in a basic group were changed See - [TLDef(0xD7CA61A2, inheritBefore = true)] + [TLDef(0xD7CA61A2, inheritAt = 0)] public sealed partial class UpdateChatParticipantAdmin : UpdateChat { /// ID of the (de)admined user @@ -5254,7 +5254,7 @@ namespace TL [TLDef(0x7084A7BE)] public sealed partial class UpdateContactsReset : Update { } /// The history of a channel/supergroup was hidden. See - [TLDef(0xB23FC698, inheritBefore = true)] + [TLDef(0xB23FC698, inheritAt = 0)] public sealed partial class UpdateChannelAvailableMessages : UpdateChannel { /// Identifier of a maximum unavailable message in a channel due to hidden history. @@ -5437,7 +5437,7 @@ namespace TL public byte[] data; } /// The forward counter of a message in a channel has changed See - [TLDef(0xD29A27F4, inheritBefore = true)] + [TLDef(0xD29A27F4, inheritAt = 0)] public sealed partial class UpdateChannelMessageForwards : UpdateChannel { /// ID of the message @@ -5836,7 +5836,7 @@ namespace TL [TLDef(0xFB4C496C)] public sealed partial class UpdateReadFeaturedEmojiStickers : Update { } /// The emoji status of a certain user has changed See - [TLDef(0x28373599, inheritBefore = true)] + [TLDef(0x28373599, inheritAt = 0)] public sealed partial class UpdateUserEmojiStatus : UpdateUser { /// New emoji status @@ -5946,7 +5946,7 @@ namespace TL public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// Users may also choose to display messages from all topics as if they were sent to a normal group, using a "View as messages" setting in the local client.
This setting only affects the current account, and is synced to other logged in sessions using the Channels_ToggleViewForumAsMessages method; invoking this method will update the value of the view_forum_as_messages flag of or and emit an . See
- [TLDef(0x07B68920, inheritBefore = true)] + [TLDef(0x07B68920, inheritAt = 0)] public sealed partial class UpdateChannelViewForumAsMessages : UpdateChannel { /// The new value of the toggle. @@ -6080,7 +6080,7 @@ namespace TL public MessageBase message; } /// One or more messages in a quick reply shortcut » were deleted. See - [TLDef(0x566FE7CD, inheritBefore = true)] + [TLDef(0x566FE7CD, inheritAt = 0)] public sealed partial class UpdateDeleteQuickReplyMessages : UpdateDeleteQuickReply { /// IDs of the deleted messages. @@ -7272,7 +7272,7 @@ namespace TL public DateTime date; } /// Message with a file enclosure sent to a protected chat See - [TLDef(0x9493FF32, inheritBefore = true)] + [TLDef(0x9493FF32, inheritAt = 0)] public sealed partial class Messages_SentEncryptedFile : Messages_SentEncryptedMessage { /// Attached file @@ -9026,28 +9026,28 @@ namespace TL [TLDef(0x28A20571)] public sealed partial class MessageEntityCode : MessageEntity { } /// Message entity representing a preformatted codeblock, allowing the user to specify a programming language for the codeblock. See - [TLDef(0x73924BE0, inheritBefore = true)] + [TLDef(0x73924BE0, inheritAt = 0)] public sealed partial class MessageEntityPre : MessageEntity { /// Programming language of the code public string language; } /// Message entity representing a text url: for in-text urls like https://google.com use . See - [TLDef(0x76A6D327, inheritBefore = true)] + [TLDef(0x76A6D327, inheritAt = 0)] public sealed partial class MessageEntityTextUrl : MessageEntity { /// The actual URL public string url; } /// Message entity representing a user mention: for creating a mention use . See - [TLDef(0xDC7B1140, inheritBefore = true)] + [TLDef(0xDC7B1140, inheritAt = 0)] public sealed partial class MessageEntityMentionName : MessageEntity { /// Identifier of the user that was mentioned public long user_id; } /// Message entity that can be used to create a user user mention: received mentions use the , instead. See - [TLDef(0x208E68C9, inheritBefore = true)] + [TLDef(0x208E68C9, inheritAt = 0)] public sealed partial class InputMessageEntityMentionName : MessageEntity { /// Identifier of the user that was mentioned @@ -9072,7 +9072,7 @@ namespace TL [TLDef(0x32CA960F)] public sealed partial class MessageEntitySpoiler : MessageEntity { } /// Represents a custom emoji.
Note that this entity must wrap exactly one regular emoji (the one contained in .alt) in the related text, otherwise the server will ignore it. See
- [TLDef(0xC8CF05F8, inheritBefore = true)] + [TLDef(0xC8CF05F8, inheritAt = 0)] public sealed partial class MessageEntityCustomEmoji : MessageEntity { /// Document ID of the custom emoji, use Messages_GetCustomEmojiDocuments to fetch the emoji animation and the actual emoji it represents. @@ -12993,28 +12993,28 @@ namespace TL [TLDef(0x46E1D13D)] public sealed partial class RecentMeUrlUnknown : RecentMeUrl { } /// Recent t.me link to a user See - [TLDef(0xB92C09E2, inheritBefore = true)] + [TLDef(0xB92C09E2, inheritAt = 0)] public sealed partial class RecentMeUrlUser : RecentMeUrl { /// User ID public long user_id; } /// Recent t.me link to a chat See - [TLDef(0xB2DA71D2, inheritBefore = true)] + [TLDef(0xB2DA71D2, inheritAt = 0)] public sealed partial class RecentMeUrlChat : RecentMeUrl { /// Chat ID public long chat_id; } /// Recent t.me invite link to a chat See - [TLDef(0xEB49081D, inheritBefore = true)] + [TLDef(0xEB49081D, inheritAt = 0)] public sealed partial class RecentMeUrlChatInvite : RecentMeUrl { /// Chat invitation public ChatInviteBase chat_invite; } /// Recent t.me stickerset installation URL See - [TLDef(0xBC0A57DC, inheritBefore = true)] + [TLDef(0xBC0A57DC, inheritAt = 0)] public sealed partial class RecentMeUrlStickerSet : RecentMeUrl { /// Stickerset @@ -13881,14 +13881,14 @@ namespace TL public string num; } /// Ordered list of text items See - [TLDef(0x5E068047, inheritBefore = true)] + [TLDef(0x5E068047, inheritAt = 0)] public sealed partial class PageListOrderedItemText : PageListOrderedItem { /// Text public RichText text; } /// Ordered list of IV blocks See - [TLDef(0x98DD8936, inheritBefore = true)] + [TLDef(0x98DD8936, inheritAt = 0)] public sealed partial class PageListOrderedItemBlocks : PageListOrderedItem { /// Item contents @@ -15864,7 +15864,7 @@ namespace TL } /// Messages found and affected by changes See - [TLDef(0xEF8D3E6C, inheritBefore = true)] + [TLDef(0xEF8D3E6C, inheritAt = 0)] public sealed partial class Messages_AffectedFoundMessages : Messages_AffectedHistory { /// Affected message IDs @@ -16077,7 +16077,7 @@ namespace TL [TLDef(0x3FD863D1)] public sealed partial class BotCommandScopePeerAdmins : BotCommandScopePeer { } /// The specified bot commands will be valid only for a specific user in the specified group or supergroup. See - [TLDef(0x0A1321F3, inheritBefore = true)] + [TLDef(0x0A1321F3, inheritAt = 0)] public sealed partial class BotCommandScopePeerUser : BotCommandScopePeer { /// The user @@ -17366,7 +17366,7 @@ namespace TL public string email; } /// The email was verified correctly, and a login code was just sent to it. See - [TLDef(0xE1BB0D61, inheritBefore = true)] + [TLDef(0xE1BB0D61, inheritAt = 0)] public sealed partial class Account_EmailVerifiedLogin : Account_EmailVerified { /// Info about the sent login code @@ -22484,13 +22484,13 @@ namespace TL public DataJSON client_data; } /// See - [TLDef(0x3E63935C, inheritBefore = true)] + [TLDef(0x3E63935C, inheritAt = 0)] public sealed partial class InputPasskeyResponseRegister : InputPasskeyResponse { public byte[] attestation_data; } /// See - [TLDef(0xC31FC14A, inheritBefore = true)] + [TLDef(0xC31FC14A, inheritAt = 0)] public sealed partial class InputPasskeyResponseLogin : InputPasskeyResponse { public byte[] authenticator_data; @@ -22532,7 +22532,7 @@ namespace TL public int duration; } /// See - [TLDef(0x0AA021E5, inheritBefore = true)] + [TLDef(0x0AA021E5, inheritAt = 0)] public sealed partial class StarGiftAuctionRoundExtendable : StarGiftAuctionRound { public int extend_top; diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 0bc2a97..4988782 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -571,7 +571,7 @@ namespace TL } /// Message entity representing a user mention: for creating a mention use . See - [TLDef(0x352DCA58, inheritBefore = true)] + [TLDef(0x352DCA58, inheritAt = 0)] public sealed partial class MessageEntityMentionName : MessageEntity { /// Identifier of the user that was mentioned diff --git a/src/TL.cs b/src/TL.cs index 0bb4583..2f12b19 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -24,7 +24,7 @@ namespace TL public sealed class TLDefAttribute(uint ctorNb) : Attribute { public readonly uint CtorNb = ctorNb; - public bool inheritBefore; + public int inheritAt = -1; } [AttributeUsage(AttributeTargets.Field)] @@ -68,8 +68,7 @@ namespace TL var tlDef = type.GetCustomAttribute(); var ctorNb = tlDef.CtorNb; writer.Write(ctorNb); - IEnumerable fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public); - if (tlDef.inheritBefore) fields = fields.GroupBy(f => f.DeclaringType).Reverse().SelectMany(g => g); + var fields = GetTLFields(type, tlDef); ulong flags = 0; IfFlagAttribute ifFlag; foreach (var field in fields) @@ -98,8 +97,7 @@ namespace TL if (type == null) return null; // nullable ctor (class meaning is associated with null) var tlDef = type.GetCustomAttribute(); var obj = Activator.CreateInstance(type, true); - IEnumerable fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public); - if (tlDef.inheritBefore) fields = fields.GroupBy(f => f.DeclaringType).Reverse().SelectMany(g => g); + var fields = GetTLFields(type, tlDef); ulong flags = 0; IfFlagAttribute ifFlag; foreach (var field in fields) @@ -115,6 +113,16 @@ namespace TL #endif } +#if !MTPG + static IEnumerable GetTLFields(Type type, TLDefAttribute tlDef) + { + if (!(tlDef?.inheritAt >= 0)) return type.GetFields(BindingFlags.Instance | BindingFlags.Public); + var fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly); + if (type.IsAbstract || type.BaseType == typeof(IObject)) return fields; + var subfields = GetTLFields(type.BaseType, type.BaseType.GetCustomAttribute()); + return fields.Take(tlDef.inheritAt).Concat(subfields).Concat(fields.Skip(tlDef.inheritAt)); + } +#else public static IMethod ReadTLMethod(this BinaryReader reader) { uint ctorNb = reader.ReadUInt32(); @@ -125,6 +133,7 @@ namespace TL method = new BoolMethod { query = method }; return (IMethod)method; } +#endif internal static void WriteTLValue(this BinaryWriter writer, object value, Type valueType) { @@ -490,6 +499,10 @@ namespace TL public sealed class BoolMethod : IMethod { public IObject query; +#if MTPG public void WriteTL(BinaryWriter writer) => query.WriteTL(writer); +#else + public void WriteTL(BinaryWriter writer) => writer.WriteTLObject(query); +#endif } } From 59425a910a005e57df01d428de9b40dc361b5af3 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 2 Mar 2026 18:28:15 +0100 Subject: [PATCH 51/54] api doc --- src/TL.Schema.cs | 84 ++++++++++++++++++++++++++++++++++--------- src/TL.SchemaFuncs.cs | 71 +++++++++++++++++++----------------- 2 files changed, 105 insertions(+), 50 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index e5d7470..cd05e81 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -119,6 +119,7 @@ namespace TL [TLDef(0x6A1DC4BE)] public sealed partial class InputPhoneContact : InputContact { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// An arbitrary 64-bit integer: it should be set, for example, to an incremental number when using Contacts_ImportContacts, in order to retry importing only the contacts that weren't imported successfully, according to the client_ids returned in .retry_contacts. public long client_id; @@ -171,7 +172,7 @@ namespace TL public InputDocument id; } - /// Defines media content of a message. See Derived classes: , , , , , , , , , , , , , , , , , + /// Defines media content of a message. See Derived classes: , , , , , , , , , , , , , , , , , , /// a value means inputMediaEmpty public abstract partial class InputMedia : IObject { } /// Photo See @@ -2072,7 +2073,7 @@ namespace TL public override int TtlPeriod => ttl_period; } - /// Media See Derived classes: , , , , , , , , , , , , , , , , + /// Media See Derived classes: , , , , , , , , , , , , , , , , , /// a value means messageMediaEmpty public abstract partial class MessageMedia : IObject { } /// Attached photo. See @@ -2280,6 +2281,7 @@ namespace TL [TLDef(0x08CBEC07)] public sealed partial class MessageMediaDice : MessageMedia { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Dice value public int value; @@ -2424,6 +2426,7 @@ namespace TL [TLDef(0xCA5CAB89)] public sealed partial class MessageMediaVideoStream : MessageMedia { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public InputGroupCallBase call; @@ -2433,7 +2436,7 @@ namespace TL } } - /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , /// a value means messageActionEmpty public abstract partial class MessageAction : IObject { } /// Group created See @@ -3285,6 +3288,7 @@ namespace TL [TLDef(0x774278D4)] public sealed partial class MessageActionStarGiftPurchaseOffer : MessageAction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public StarGiftBase gift; public StarsAmountBase price; @@ -3300,6 +3304,7 @@ namespace TL [TLDef(0x73ADA76B)] public sealed partial class MessageActionStarGiftPurchaseOfferDeclined : MessageAction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public StarGiftBase gift; public StarsAmountBase price; @@ -4470,7 +4475,7 @@ namespace TL [TLDef(0x1BB00451)] public sealed partial class InputMessagesFilterPinned : MessagesFilter { } - /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract partial class Update : IObject { public virtual (long mbox_id, int pts, int pts_count) GetMBox() => default; @@ -4517,6 +4522,7 @@ namespace TL [TLDef(0x2A17BF5C)] public sealed partial class UpdateUserTyping : Update { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// User id public long user_id; @@ -6317,6 +6323,7 @@ namespace TL [TLDef(0x683B2C52)] public sealed partial class UpdatePinnedForumTopic : Update { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public Peer peer; public int topic_id; @@ -6330,12 +6337,14 @@ namespace TL [TLDef(0xDEF143D0)] public sealed partial class UpdatePinnedForumTopics : Update { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public Peer peer; [IfFlag(0)] public int[] order; [Flags] public enum Flags : uint { + /// Field has a value has_order = 0x1, } } @@ -7375,7 +7384,7 @@ namespace TL public int top_msg_id; } - /// User actions. Use this to provide users with detailed info about their chat partner's actions: typing or sending attachments of all kinds. See Derived classes: , , , , , , , , , , , , , , , , , + /// User actions. Use this to provide users with detailed info about their chat partner's actions: typing or sending attachments of all kinds. See Derived classes: , , , , , , , , , , , , , , , , , , public abstract partial class SendMessageAction : IObject { } /// User is typing. See [TLDef(0x16BF744E)] @@ -7926,7 +7935,7 @@ namespace TL public string display_url; /// Hash used for caching, for more info click here public int hash; - /// Type of the web page. One of the following:

- app
- article
- document
- gif
- photo
- profile
- telegram_album
- telegram_background
- telegram_bot
- telegram_botapp
- telegram_call
- telegram_channel
- telegram_channel_boost
- telegram_channel_direct
- telegram_channel_request
- telegram_chat
- telegram_chat_request
- telegram_chatlist
- telegram_collection
- telegram_community
- telegram_giftcode
- telegram_group_boost
- telegram_livestream
- telegram_megagroup
- telegram_megagroup_request
- telegram_message
- telegram_nft
- telegram_stickerset
- telegram_story
- telegram_story_album
- telegram_theme
- telegram_user
- telegram_videochat
- telegram_voicechat
- video

+ /// Type of the web page. One of the following:

- app
- article
- document
- gif
- photo
- profile
- telegram_album
- telegram_auction
- telegram_background
- telegram_bot
- telegram_botapp
- telegram_call
- telegram_channel
- telegram_channel_boost
- telegram_channel_direct
- telegram_channel_request
- telegram_chat
- telegram_chat_request
- telegram_chatlist
- telegram_collection
- telegram_community
- telegram_giftcode
- telegram_group_boost
- telegram_livestream
- telegram_megagroup
- telegram_megagroup_request
- telegram_message
- telegram_nft
- telegram_stickerset
- telegram_story
- telegram_story_album
- telegram_theme
- telegram_user
- telegram_videochat
- telegram_voicechat
- video

[IfFlag(0)] public string type; /// Short name of the site (e.g., Google Docs, App Store) [IfFlag(1)] public string site_name; @@ -8506,6 +8515,7 @@ namespace TL [TLDef(0x7D170CFF)] public sealed partial class KeyboardButton : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(10)] public KeyboardButtonStyle style; /// Button text @@ -8525,6 +8535,7 @@ namespace TL [TLDef(0xD80C25EC)] public sealed partial class KeyboardButtonUrl : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(10)] public KeyboardButtonStyle style; /// Button label @@ -8570,6 +8581,7 @@ namespace TL [TLDef(0x417EFD8F)] public sealed partial class KeyboardButtonRequestPhone : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(10)] public KeyboardButtonStyle style; /// Button text @@ -8589,6 +8601,7 @@ namespace TL [TLDef(0xAA40F94D)] public sealed partial class KeyboardButtonRequestGeoLocation : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(10)] public KeyboardButtonStyle style; /// Button text @@ -8636,6 +8649,7 @@ namespace TL [TLDef(0x89C590F9)] public sealed partial class KeyboardButtonGame : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(10)] public KeyboardButtonStyle style; /// Button text @@ -8655,6 +8669,7 @@ namespace TL [TLDef(0x3FA53905)] public sealed partial class KeyboardButtonBuy : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(10)] public KeyboardButtonStyle style; /// Button text @@ -8756,6 +8771,7 @@ namespace TL [TLDef(0x7D5E07C7)] public sealed partial class InputKeyboardButtonUserProfile : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(10)] public KeyboardButtonStyle style; /// Button text @@ -8777,6 +8793,7 @@ namespace TL [TLDef(0xC0FD5D09)] public sealed partial class KeyboardButtonUserProfile : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(10)] public KeyboardButtonStyle style; /// Button text @@ -8798,6 +8815,7 @@ namespace TL [TLDef(0xE846B1A0)] public sealed partial class KeyboardButtonWebView : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(10)] public KeyboardButtonStyle style; /// Button text @@ -8819,6 +8837,7 @@ namespace TL [TLDef(0xE15C4370)] public sealed partial class KeyboardButtonSimpleWebView : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(10)] public KeyboardButtonStyle style; /// Button text @@ -8840,6 +8859,7 @@ namespace TL [TLDef(0x5B0F15F5)] public sealed partial class KeyboardButtonRequestPeer : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(10)] public KeyboardButtonStyle style; /// Button text @@ -8897,6 +8917,7 @@ namespace TL [TLDef(0xBCC4AF10)] public sealed partial class KeyboardButtonCopy : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(10)] public KeyboardButtonStyle style; /// Title of the button @@ -14491,6 +14512,7 @@ namespace TL [TLDef(0x623A8FA0)] public sealed partial class UrlAuthResultAccepted : UrlAuthResult { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The URL name of the website on which the user has logged in. [IfFlag(0)] public string url; @@ -14763,7 +14785,7 @@ namespace TL } } - /// Webpage attributes See Derived classes: , , , , + /// Webpage attributes See Derived classes: , , , , , public abstract partial class WebPageAttribute : IObject { } /// Page theme See [TLDef(0x54B56617)] @@ -16745,7 +16767,7 @@ namespace TL Broadcast = 0x7BFBDEFC, } - /// An invoice See Derived classes: , , , , , , , , , , , + /// An invoice See Derived classes: , , , , , , , , , , , , , , public abstract partial class InputInvoice : IObject { } /// An invoice contained in a message or paid media ». See [TLDef(0xC5B56859)] @@ -16903,6 +16925,7 @@ namespace TL [TLDef(0x1ECAFA10)] public sealed partial class InputInvoiceStarGiftAuctionBid : InputInvoice { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(3)] public InputPeer peer; public long gift_id; @@ -16912,8 +16935,10 @@ namespace TL [Flags] public enum Flags : uint { hide_name = 0x1, + /// Field has a value has_message = 0x2, update_bid = 0x4, + /// Field has a value has_peer = 0x8, } } @@ -19172,7 +19197,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// Represents a color palette ». See Derived classes: + /// Represents a color palette ». See Derived classes: , , public abstract partial class PeerColorBase : IObject { } /// Represents a color palette ». See [TLDef(0xB54B5ACF)] @@ -19197,6 +19222,7 @@ namespace TL [TLDef(0xB9C0639A)] public sealed partial class PeerColorCollectible : PeerColorBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long collectible_id; public long gift_emoji_id; @@ -19208,7 +19234,9 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_dark_accent_color = 0x1, + /// Field has a value has_dark_colors = 0x2, } } @@ -20254,13 +20282,13 @@ namespace TL { /// Localized description of the option. public string text; - /// Option identifier to pass to Channels_ReportSponsoredMessage. + /// Option identifier to pass to Messages_ReportSponsoredMessage. public byte[] option; } /// Status of the method call used to report a sponsored message ». See Derived classes: , , public abstract partial class Channels_SponsoredMessageReportResult : IObject { } - /// The user must choose a report option from the localized options available in options, and after selection, Channels_ReportSponsoredMessage must be invoked again, passing the option's option field to the option param of the method. See + /// The user must choose a report option from the localized options available in options, and after selection, Messages_ReportSponsoredMessage must be invoked again, passing the option's option field to the option param of the method. See [TLDef(0x846F9E42)] public sealed partial class Channels_SponsoredMessageReportResultChooseOption : Channels_SponsoredMessageReportResult { @@ -21409,6 +21437,7 @@ namespace TL [TLDef(0x565251E2)] public sealed partial class StarGiftAttributeModel : StarGiftAttribute { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Name of the model public string name; @@ -22225,6 +22254,7 @@ namespace TL [TLDef(0x1A8AFC7E)] public sealed partial class GroupCallMessage : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int id; public Peer from_id; @@ -22234,6 +22264,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_paid_message_stars = 0x1, from_admin = 0x2, } @@ -22243,6 +22274,7 @@ namespace TL [TLDef(0xEE430C85)] public sealed partial class GroupCallDonor : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(3)] public Peer peer_id; public long stars; @@ -22251,6 +22283,7 @@ namespace TL { top = 0x1, my = 0x2, + /// Field has a value has_peer_id = 0x8, } } @@ -22271,12 +22304,14 @@ namespace TL [TLDef(0x711D692D)] public sealed partial class RecentStory : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(1)] public int max_id; [Flags] public enum Flags : uint { live = 0x1, + /// Field has a value has_max_id = 0x2, } } @@ -22290,7 +22325,7 @@ namespace TL public DateTime date; } - /// See + /// See Derived classes: , /// a value means starGiftAuctionStateNotModified public abstract partial class StarGiftAuctionStateBase : IObject { @@ -22321,6 +22356,7 @@ namespace TL [TLDef(0x972DABBF)] public sealed partial class StarGiftAuctionStateFinished : StarGiftAuctionStateBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public DateTime start_date; public DateTime end_date; @@ -22331,7 +22367,9 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_listed_count = 0x1, + /// Fields and have a value has_fragment_listed_count = 0x2, } @@ -22343,6 +22381,7 @@ namespace TL [TLDef(0x2EEED1C4)] public sealed partial class StarGiftAuctionUserState : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(0)] public long bid_amount; [IfFlag(0)] public DateTime bid_date; @@ -22352,6 +22391,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Fields , , and have a value has_bid_amount = 0x1, returned = 0x2, } @@ -22375,6 +22415,7 @@ namespace TL [TLDef(0x42B00348)] public sealed partial class StarGiftAuctionAcquiredGift : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public Peer peer; public DateTime date; @@ -22387,7 +22428,9 @@ namespace TL [Flags] public enum Flags : uint { name_hidden = 0x1, + /// Field has a value has_message = 0x2, + /// Field has a value has_gift_num = 0x4, } } @@ -22424,7 +22467,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// See Derived classes: , public abstract partial class InputStarGiftAuctionBase : IObject { } /// See [TLDef(0x02E16C98)] @@ -22443,6 +22486,7 @@ namespace TL [TLDef(0x98613EBF)] public sealed partial class Passkey : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public string id; public string name; @@ -22452,7 +22496,9 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_software_emoji_id = 0x1, + /// Field has a value has_last_usage_date = 0x2, } } @@ -22478,7 +22524,7 @@ namespace TL public DataJSON options; } - /// See + /// See Derived classes: , public abstract partial class InputPasskeyResponse : IObject { public DataJSON client_data; @@ -22498,7 +22544,7 @@ namespace TL public string user_handle; } - /// See + /// See Derived classes: , public abstract partial class InputPasskeyCredential : IObject { } /// See [TLDef(0x3C27B78F)] @@ -22555,7 +22601,7 @@ namespace TL public long ton_amount; } - /// See + /// See Derived classes: , public abstract partial class Messages_EmojiGameInfo : IObject { } /// See [TLDef(0x59E65335)] @@ -22564,6 +22610,7 @@ namespace TL [TLDef(0x44E56023)] public sealed partial class Messages_EmojiGameDiceInfo : Messages_EmojiGameInfo { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public string game_hash; public long prev_stake; @@ -22573,11 +22620,12 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_plays_left = 0x1, } } - /// See + /// See Derived classes: , , , , public abstract partial class StarGiftAttributeRarityBase : IObject { } /// See [TLDef(0x36437737)] @@ -22602,6 +22650,7 @@ namespace TL [TLDef(0x4FDD3430)] public sealed partial class KeyboardButtonStyle : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(3)] public long icon; @@ -22610,6 +22659,7 @@ namespace TL bg_primary = 0x1, bg_danger = 0x2, bg_success = 0x4, + /// Field has a value has_icon = 0x8, } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index c7ded16..72fb740 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -387,7 +387,7 @@ namespace TL mnc = mnc, }); - /// See + /// See Possible codes: 400 (details) public static Task Auth_CheckPaidAuth(this Client client, string phone_number, string phone_code_hash, long form_id) => client.Invoke(new Auth_CheckPaidAuth { @@ -396,7 +396,7 @@ namespace TL form_id = form_id, }); - /// See + /// See Possible codes: 400,500 (details) public static Task Auth_InitPasskeyLogin(this Client client, int api_id, string api_hash) => client.Invoke(new Auth_InitPasskeyLogin { @@ -404,7 +404,7 @@ namespace TL api_hash = api_hash, }); - /// See + /// See Possible codes: 400,500 (details) public static Task Auth_FinishPasskeyLogin(this Client client, InputPasskeyCredential credential, int? from_dc_id = null, long? from_auth_key_id = null) => client.Invoke(new Auth_FinishPasskeyLogin { @@ -1528,13 +1528,13 @@ namespace TL hash = hash, }); - /// See + /// See Possible codes: 403 (details) public static Task Account_InitPasskeyRegistration(this Client client) => client.Invoke(new Account_InitPasskeyRegistration { }); - /// See + /// See Possible codes: 400 (details) public static Task Account_RegisterPasskey(this Client client, InputPasskeyCredential credential) => client.Invoke(new Account_RegisterPasskey { @@ -1588,7 +1588,7 @@ namespace TL id = id, }); - /// Get songs pinned to the user's profile, see here » for more info. See Possible codes: 400 (details) + /// Get songs pinned to the user's profile, see here » for more info. See [bots: ✓] Possible codes: 400 (details) /// The ID of the user. /// Offset for pagination. /// Maximum number of results to return, see pagination @@ -1612,7 +1612,7 @@ namespace TL documents = documents, }); - /// See + /// See Possible codes: 400 (details) public static Task Users_SuggestBirthday(this Client client, InputUserBase id, Birthday birthday) => client.Invoke(new Users_SuggestBirthday { @@ -1879,7 +1879,7 @@ namespace TL q = q, }); - /// See + /// See Possible codes: 400 (details) public static Task Contacts_UpdateContactNote(this Client client, InputUserBase id, TextWithEntities note) => client.Invoke(new Contacts_UpdateContactNote { @@ -1915,7 +1915,7 @@ namespace TL hash = hash, }); - /// Returns the conversation history with one interlocutor / within a chat See Possible codes: 400,406 (details) + /// Returns the conversation history with one interlocutor / within a chat See Possible codes: 400,406,500 (details) /// Target peer /// Only return messages starting from the specified message ID /// Only return messages sent before the specified date @@ -2243,7 +2243,7 @@ namespace TL user_id = user_id, }); - /// Creates a new chat. See Possible codes: 400,403,500 (details) + /// Creates a new chat. See Possible codes: 400,406,500 (details) /// List of user IDs to be invited /// Chat name /// Time-to-live of all messages that will be sent in the chat: once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. You can use Messages_SetDefaultHistoryTTL to edit this value later. @@ -2290,7 +2290,7 @@ namespace TL key_fingerprint = key_fingerprint, }); - /// Cancels a request for creation and/or delete info on secret chat. See Possible codes: 400 (details) + /// Cancels a request for creation and/or delete info on secret chat. See Possible codes: 400,500 (details) /// Whether to delete the entire chat history for the other user as well /// Secret chat ID public static Task Messages_DiscardEncryption(this Client client, int chat_id, bool delete_history = false) @@ -3085,7 +3085,7 @@ namespace TL hash = hash, }); - /// Send an album or grouped media See [bots: ✓] Possible codes: 400,403,420,500 (details) + /// Send an album or grouped media See [bots: ✓] Possible codes: 400,403,406,420,500 (details) /// Whether to send the album silently (no notification triggered) /// Send in background? /// Whether to clear drafts @@ -4863,7 +4863,7 @@ namespace TL { }); - /// See + /// See Possible codes: 400 (details) public static Task Messages_SummarizeText(this Client client, InputPeer peer, int id, string to_lang = null) => client.Invoke(new Messages_SummarizeText { @@ -5367,7 +5367,7 @@ namespace TL channel = channel, }); - /// Create a supergroup/channel. See Possible codes: 400,403,500 (details) + /// Create a supergroup/channel. See Possible codes: 400,406,500 (details) /// Whether to create a channel /// Whether to create a supergroup /// Whether the supergroup is being created to import messages from a foreign chat service using Messages_InitHistoryImport @@ -5842,7 +5842,7 @@ namespace TL restricted = restricted, }); - /// Globally search for posts from public channels » (including those we aren't a member of) containing either a specific hashtag, or a full text query. See Possible codes: 420 (details) + /// Globally search for posts from public channels » (including those we aren't a member of) containing either a specific hashtag, or a full text query. See Possible codes: 403,420 (details) /// The hashtag to search, without the # character. /// The full text query: each user has a limited amount of free full text search slots, after which payment is required, see here » for more info on the full flow. /// Initially 0, then set to the next_rate parameter of messages.messagesSlice, or if that is absent, the date of the last returned message. @@ -5914,7 +5914,7 @@ namespace TL tab = tab, }); - /// See + /// See Possible codes: 400 (details) public static Task Channels_GetFutureCreatorAfterLeave(this Client client, InputChannelBase channel) => client.Invoke(new Channels_GetFutureCreatorAfterLeave { @@ -6674,7 +6674,7 @@ namespace TL slug = slug, }); - /// Fetch the full list of gifts owned by a peer. See Possible codes: 400 (details) + /// Fetch the full list of gifts owned by a peer. See [bots: ✓] Possible codes: 400 (details) /// Exclude gifts not pinned on the profile. /// Exclude gifts pinned on the profile. /// Exclude gifts that do not have the .limited flag set. @@ -6849,7 +6849,7 @@ namespace TL gift_id = gift_id, }); - /// See + /// See Possible codes: 400 (details) public static Task Payments_GetStarGiftAuctionState(this Client client, InputStarGiftAuctionBase auction, int version) => client.Invoke(new Payments_GetStarGiftAuctionState { @@ -6857,7 +6857,7 @@ namespace TL version = version, }); - /// See + /// See Possible codes: 400 (details) public static Task Payments_GetStarGiftAuctionAcquiredGifts(this Client client, long gift_id) => client.Invoke(new Payments_GetStarGiftAuctionAcquiredGifts { @@ -6872,7 +6872,7 @@ namespace TL hash = hash, }); - /// See + /// See [bots: ✓] Possible codes: 400 (details) public static Task Payments_ResolveStarGiftOffer(this Client client, int offer_msg_id, bool decline = false) => client.Invoke(new Payments_ResolveStarGiftOffer { @@ -6880,7 +6880,8 @@ namespace TL offer_msg_id = offer_msg_id, }); - /// See + /// See Possible codes: 400 (details) + /// You can use public static Task Payments_SendStarGiftOffer(this Client client, InputPeer peer, string slug, StarsAmountBase price, int duration, long random_id, long? allow_paid_stars = null) => client.Invoke(new Payments_SendStarGiftOffer { @@ -6893,14 +6894,15 @@ namespace TL allow_paid_stars = allow_paid_stars ?? default, }); - /// See + /// See Possible codes: 400 (details) public static Task Payments_GetStarGiftUpgradeAttributes(this Client client, long gift_id) => client.Invoke(new Payments_GetStarGiftUpgradeAttributes { gift_id = gift_id, }); - /// See + /// See Possible codes: 400 (details) + /// Maximum number of results to return, see pagination public static Task Payments_GetCraftStarGifts(this Client client, long gift_id, string offset, int limit = int.MaxValue) => client.Invoke(new Payments_GetCraftStarGifts { @@ -6909,7 +6911,7 @@ namespace TL limit = limit, }); - /// See + /// See Possible codes: 400 (details) public static Task Payments_CraftStarGift(this Client client, params InputSavedStarGift[] stargift) => client.Invoke(new Payments_CraftStarGift { @@ -7052,7 +7054,7 @@ namespace TL { }); - /// Start a telegram phone call See Possible codes: 400,403 (details) + /// Start a telegram phone call See Possible codes: 400,403,500 (details) /// Whether to start a video call /// Destination of the phone call /// Random ID to avoid resending the same object @@ -7168,7 +7170,7 @@ namespace TL schedule_date = schedule_date ?? default, }); - /// Join a group call See Possible codes: 400,403 (details) + /// Join a group call See Possible codes: 400,403,500 (details) /// If set, the user will be muted by default upon joining. /// If set, the user's video will be disabled by default upon joining. /// The group call @@ -7485,7 +7487,8 @@ namespace TL limit = limit, }); - /// See + /// See Possible codes: 400 (details) + /// You can use public static Task Phone_SendGroupCallMessage(this Client client, InputGroupCallBase call, long random_id, TextWithEntities message, long? allow_paid_stars = null, InputPeer send_as = null) => client.Invoke(new Phone_SendGroupCallMessage { @@ -7497,7 +7500,7 @@ namespace TL send_as = send_as, }); - /// See + /// See Possible codes: 400 (details) public static Task Phone_SendGroupCallEncryptedMessage(this Client client, InputGroupCallBase call, byte[] encrypted_message) => client.Invoke(new Phone_SendGroupCallEncryptedMessage { @@ -7505,7 +7508,7 @@ namespace TL encrypted_message = encrypted_message, }); - /// See + /// See Possible codes: 400 (details) public static Task Phone_DeleteGroupCallMessages(this Client client, InputGroupCallBase call, int[] messages, bool report_spam = false) => client.Invoke(new Phone_DeleteGroupCallMessages { @@ -7514,7 +7517,7 @@ namespace TL messages = messages, }); - /// See + /// See Possible codes: 400 (details) public static Task Phone_DeleteGroupCallParticipantMessages(this Client client, InputGroupCallBase call, InputPeer participant, bool report_spam = false) => client.Invoke(new Phone_DeleteGroupCallParticipantMessages { @@ -7523,14 +7526,14 @@ namespace TL participant = participant, }); - /// See + /// See Possible codes: 400 (details) public static Task Phone_GetGroupCallStars(this Client client, InputGroupCallBase call) => client.Invoke(new Phone_GetGroupCallStars { call = call, }); - /// See + /// See Possible codes: 400 (details) public static Task Phone_SaveDefaultSendAs(this Client client, InputGroupCallBase call, InputPeer send_as) => client.Invoke(new Phone_SaveDefaultSendAs { @@ -8180,7 +8183,9 @@ namespace TL limit = limit, }); - /// See + /// See Possible codes: 400 (details) + /// Message entities for styled text + /// You can use public static Task Stories_StartLive(this Client client, InputPeer peer, InputPrivacyRule[] privacy_rules, long random_id, string caption = null, MessageEntity[] entities = null, bool? messages_enabled = default, long? send_paid_messages_stars = null, bool pinned = false, bool noforwards = false, bool rtmp_stream = false) => client.Invoke(new Stories_StartLive { From f8b0fd48b1154523039f5369680d4b55d8c1fe58 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 3 Mar 2026 12:45:45 +0100 Subject: [PATCH 52/54] Update to Telegram API layer 223 - New types (e.g., MessageActionNoForwardsToggle, UpdateChatParticipantRank, MessageEntityFormattedDate) - New methods (e.g., Messages_EditChatCreator, Messages_EditChatParticipantRank). - Enhanced URL auth and admin methods with new parameters and flags. - Refactored keyboard button and MediaArea types for improved inheritance. --- README.md | 2 +- src/TL.Schema.cs | 397 ++++++++++++++----------------------- src/TL.SchemaFuncs.cs | 152 ++++++++++---- src/TL.Table.cs | 23 ++- src/WTelegramClient.csproj | 4 +- 5 files changed, 276 insertions(+), 302 deletions(-) diff --git a/README.md b/README.md index d0baa0d..05aecf3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-222-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-223-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 cd05e81..6f8ea40 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1689,33 +1689,54 @@ namespace TL { /// Member user ID public virtual long UserId => default; + public virtual string Rank => default; } /// Group member. See - [TLDef(0xC02D4007)] + [TLDef(0x38E79FDE)] public partial class ChatParticipant : ChatParticipantBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those + public Flags flags; /// Member user ID public long user_id; /// ID of the user that added the member to the group public long inviter_id; /// Date added to the group public DateTime date; + [IfFlag(0)] public string rank; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_rank = 0x1, + } /// Member user ID public override long UserId => user_id; + public override string Rank => rank; } /// Represents the creator of the group See - [TLDef(0xE46BCEE4)] + [TLDef(0xE1F867B8)] public sealed partial class ChatParticipantCreator : ChatParticipantBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those + public Flags flags; /// ID of the user that created the group public long user_id; + [IfFlag(0)] public string rank; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_rank = 0x1, + } /// ID of the user that created the group public override long UserId => user_id; + public override string Rank => rank; } /// Chat admin See - [TLDef(0xA0933F5B)] + [TLDef(0x0360D5D2)] public sealed partial class ChatParticipantAdmin : ChatParticipant { } @@ -1827,7 +1848,7 @@ namespace TL public override Peer Peer => peer_id; } /// A message See - [TLDef(0x9CB490E9)] + [TLDef(0x3AE56482)] public sealed partial class Message : MessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1840,6 +1861,7 @@ namespace TL [IfFlag(8)] public Peer from_id; /// Supergroups only, contains the number of boosts this user has given the current supergroup, and should be shown in the UI in the header of the message.
Only present for incoming messages from non-anonymous supergroup members that have boosted the supergroup.
Note that this counter should be locally overridden for non-anonymous outgoing messages, according to the current value of .boosts_applied, to ensure the value is correct even for messages sent by the current user before a supergroup was boosted (or after a boost has expired or the number of boosts has changed); do not update this value for incoming messages from other users, even if their boosts have changed.
[IfFlag(29)] public int from_boosts_applied; + [IfFlag(44)] public string from_rank; /// Peer ID, the chat where this message was sent public Peer peer_id; /// Messages from a saved messages dialog » will have peer= and the saved_peer_id flag set to the ID of the saved dialog.
Messages from a monoforum » will have peer=ID of the monoforum and the saved_peer_id flag set to the ID of a topic.
@@ -1983,6 +2005,8 @@ namespace TL has_schedule_repeat_period = 0x400, /// Field has a value has_summary_from_language = 0x800, + /// Field has a value + has_from_rank = 0x1000, } /// ID of the message @@ -2099,7 +2123,7 @@ namespace TL } /// Attached map. See [TLDef(0x56E0D474)] - public sealed partial class MessageMediaGeo : MessageMedia + public partial class MessageMediaGeo : MessageMedia { /// GeoPoint public GeoPoint geo; @@ -2246,13 +2270,11 @@ namespace TL } } /// Indicates a live geolocation See - [TLDef(0xB940C666)] - public sealed partial class MessageMediaGeoLive : MessageMedia + [TLDef(0xB940C666, inheritAt = 1)] + public sealed partial class MessageMediaGeoLive : MessageMediaGeo { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Geolocation - public GeoPoint geo; /// For live locations, a direction in which the location moves, in degrees; 1-360 [IfFlag(0)] public int heading; /// Validity period of provided geolocation @@ -2436,7 +2458,7 @@ namespace TL } } - /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , /// a value means messageActionEmpty public abstract partial class MessageAction : IObject { } /// Group created See @@ -3326,6 +3348,27 @@ namespace TL { public long new_creator_id; } + /// See + [TLDef(0xBF7D6572)] + public sealed partial class MessageActionNoForwardsToggle : MessageAction + { + public bool prev_value; + public bool new_value; + } + /// See + [TLDef(0x3E2793BA)] + public sealed partial class MessageActionNoForwardsRequest : MessageAction + { + /// Extra bits of information, use flags.HasFlag(...) to test for those + public Flags flags; + public bool prev_value; + public bool new_value; + + [Flags] public enum Flags : uint + { + expired = 0x1, + } + } /// Chat info. See Derived classes: , public abstract partial class DialogBase : IObject @@ -4148,6 +4191,8 @@ namespace TL has_saved_music = 0x200000, /// Field has a value has_note = 0x400000, + noforwards_my_enabled = 0x800000, + noforwards_peer_enabled = 0x1000000, } } @@ -4475,7 +4520,7 @@ namespace TL [TLDef(0x1BB00451)] public sealed partial class InputMessagesFilterPinned : MessagesFilter { } - /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract partial class Update : IObject { public virtual (long mbox_id, int pts, int pts_count) GetMBox() => default; @@ -4894,25 +4939,15 @@ namespace TL public Messages_StickerSet stickerset; } /// The order of stickersets was changed See - [TLDef(0x0BB2D201)] - public sealed partial class UpdateStickerSetsOrder : Update + [TLDef(0x0BB2D201, inheritAt = 0)] + public sealed partial class UpdateStickerSetsOrder : UpdateStickerSets { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; /// New sticker order by sticker ID public long[] order; - - [Flags] public enum Flags : uint - { - /// Whether the updated stickers are mask stickers - masks = 0x1, - /// Whether the updated stickers are custom emoji stickers - emojis = 0x2, - } } /// Installed stickersets have changed, the client should refetch them as described in the docs. See [TLDef(0x31C24808)] - public sealed partial class UpdateStickerSets : Update + public partial class UpdateStickerSets : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -6378,6 +6413,14 @@ namespace TL /// See [TLDef(0xAC072444)] public sealed partial class UpdateStarGiftCraftFail : Update { } + /// See + [TLDef(0xBD8367B9, inheritAt = 0)] + public sealed partial class UpdateChatParticipantRank : UpdateChat + { + public long user_id; + public string rank; + public int version; + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -8513,7 +8556,7 @@ namespace TL } /// Bot keyboard button See [TLDef(0x7D170CFF)] - public sealed partial class KeyboardButton : KeyboardButtonBase + public partial class KeyboardButton : KeyboardButtonBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8532,26 +8575,11 @@ namespace TL public override string Text => text; } /// URL button See - [TLDef(0xD80C25EC)] - public sealed partial class KeyboardButtonUrl : KeyboardButtonBase + [TLDef(0xD80C25EC, inheritAt = 0)] + public sealed partial class KeyboardButtonUrl : KeyboardButton { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - [IfFlag(10)] public KeyboardButtonStyle style; - /// Button label - public string text; /// URL public string url; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_style = 0x400, - } - - public override KeyboardButtonStyle Style => style; - /// Button label - public override string Text => text; } /// Callback button See [TLDef(0xE62BC960)] @@ -8579,43 +8607,13 @@ namespace TL } /// Button to request a user's phone number See [TLDef(0x417EFD8F)] - public sealed partial class KeyboardButtonRequestPhone : KeyboardButtonBase + public sealed partial class KeyboardButtonRequestPhone : KeyboardButton { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - [IfFlag(10)] public KeyboardButtonStyle style; - /// Button text - public string text; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_style = 0x400, - } - - public override KeyboardButtonStyle Style => style; - /// Button text - public override string Text => text; } /// Button to request a user's geolocation See [TLDef(0xAA40F94D)] - public sealed partial class KeyboardButtonRequestGeoLocation : KeyboardButtonBase + public sealed partial class KeyboardButtonRequestGeoLocation : KeyboardButton { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - [IfFlag(10)] public KeyboardButtonStyle style; - /// Button text - public string text; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_style = 0x400, - } - - public override KeyboardButtonStyle Style => style; - /// Button text - public override string Text => text; } /// Button to force a user to switch to inline mode: pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. See [TLDef(0x991399FC)] @@ -8647,71 +8645,24 @@ namespace TL } /// Button to start a game See [TLDef(0x89C590F9)] - public sealed partial class KeyboardButtonGame : KeyboardButtonBase + public sealed partial class KeyboardButtonGame : KeyboardButton { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - [IfFlag(10)] public KeyboardButtonStyle style; - /// Button text - public string text; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_style = 0x400, - } - - public override KeyboardButtonStyle Style => style; - /// Button text - public override string Text => text; } /// Button to buy a product See [TLDef(0x3FA53905)] - public sealed partial class KeyboardButtonBuy : KeyboardButtonBase + public sealed partial class KeyboardButtonBuy : KeyboardButton { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - [IfFlag(10)] public KeyboardButtonStyle style; - /// Button text - public string text; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_style = 0x400, - } - - public override KeyboardButtonStyle Style => style; - /// Button text - public override string Text => text; } /// Button to request a user to authorize via URL using Seamless Telegram Login. When the user clicks on such a button, Messages_RequestUrlAuth should be called, providing the button_id and the ID of the container message. The returned object will contain more details about the authorization request (request_write_access if the bot would like to send messages to the user along with the username of the bot which will be used for user authorization). Finally, the user can choose to call Messages_AcceptUrlAuth to get a with the URL to open instead of the url of this constructor, or a , in which case the url of this constructor must be opened, instead. If the user refuses the authorization request but still wants to open the link, the url of this constructor must be used. See - [TLDef(0xF51006F9)] - public sealed partial class KeyboardButtonUrlAuth : KeyboardButtonBase + [TLDef(0xF51006F9, inheritAt = 0)] + public sealed partial class KeyboardButtonUrlAuth : KeyboardButton { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - [IfFlag(10)] public KeyboardButtonStyle style; - /// Button label - public string text; /// New text of the button in forwarded messages. - [IfFlag(0)] public string fwd_text; + public string fwd_text; /// An HTTP URL to be opened with user authorization data added to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. The data added is the same as described in Receiving authorization data.

NOTE: Services must always check the hash of the received data to verify the authentication and the integrity of the data as described in Checking authorization.
public string url; /// ID of the button to pass to Messages_RequestUrlAuth public int button_id; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_fwd_text = 0x1, - /// Field has a value - has_style = 0x400, - } - - public override KeyboardButtonStyle Style => style; - /// Button label - public override string Text => text; } /// Button to request a user to Messages_AcceptUrlAuth via URL using Seamless Telegram Login. See [TLDef(0x68013E72)] @@ -8790,96 +8741,34 @@ namespace TL public override string Text => text; } /// Button that links directly to a user profile See - [TLDef(0xC0FD5D09)] - public sealed partial class KeyboardButtonUserProfile : KeyboardButtonBase + [TLDef(0xC0FD5D09, inheritAt = 0)] + public sealed partial class KeyboardButtonUserProfile : KeyboardButton { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - [IfFlag(10)] public KeyboardButtonStyle style; - /// Button text - public string text; /// User ID public long user_id; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_style = 0x400, - } - - public override KeyboardButtonStyle Style => style; - /// Button text - public override string Text => text; } /// Button to open a bot mini app using Messages_RequestWebView, sending over user information after user confirmation. See - [TLDef(0xE846B1A0)] - public sealed partial class KeyboardButtonWebView : KeyboardButtonBase + [TLDef(0xE846B1A0, inheritAt = 0)] + public partial class KeyboardButtonWebView : KeyboardButton { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - [IfFlag(10)] public KeyboardButtonStyle style; - /// Button text - public string text; /// Web app url public string url; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_style = 0x400, - } - - public override KeyboardButtonStyle Style => style; - /// Button text - public override string Text => text; } /// Button to open a bot mini app using Messages_RequestSimpleWebView, without sending user information to the web app. See [TLDef(0xE15C4370)] - public sealed partial class KeyboardButtonSimpleWebView : KeyboardButtonBase + public sealed partial class KeyboardButtonSimpleWebView : KeyboardButtonWebView { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - [IfFlag(10)] public KeyboardButtonStyle style; - /// Button text - public string text; - /// Web app URL - public string url; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_style = 0x400, - } - - public override KeyboardButtonStyle Style => style; - /// Button text - public override string Text => text; } /// Prompts the user to select and share one or more peers with the bot using Messages_SendBotRequestedPeer See - [TLDef(0x5B0F15F5)] - public sealed partial class KeyboardButtonRequestPeer : KeyboardButtonBase + [TLDef(0x5B0F15F5, inheritAt = 0)] + public sealed partial class KeyboardButtonRequestPeer : KeyboardButton { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - [IfFlag(10)] public KeyboardButtonStyle style; - /// Button text - public string text; /// Button ID, to be passed to Messages_SendBotRequestedPeer. public int button_id; /// Filtering criteria to use for the peer selection list shown to the user.
The list should display all existing peers of the specified type, and should also offer an option for the user to create and immediately use one or more (up to max_quantity) peers of the specified type, if needed.
public RequestPeerType peer_type; /// Maximum number of peers that can be chosen. public int max_quantity; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_style = 0x400, - } - - public override KeyboardButtonStyle Style => style; - /// Button text - public override string Text => text; } ///
Prompts the user to select and share one or more peers with the bot using Messages_SendBotRequestedPeer. See [TLDef(0x02B78156)] @@ -8914,26 +8803,11 @@ namespace TL public override string Text => text; } /// Clipboard button: when clicked, the attached text must be copied to the clipboard. See - [TLDef(0xBCC4AF10)] - public sealed partial class KeyboardButtonCopy : KeyboardButtonBase + [TLDef(0xBCC4AF10, inheritAt = 0)] + public sealed partial class KeyboardButtonCopy : KeyboardButton { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - [IfFlag(10)] public KeyboardButtonStyle style; - /// Title of the button - public string text; /// The text that will be copied to the clipboard public string copy_text; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_style = 0x400, - } - - public override KeyboardButtonStyle Style => style; - /// Title of the button - public override string Text => text; } /// Inline keyboard row See @@ -9011,7 +8885,7 @@ namespace TL public KeyboardButtonRow[] rows; } - /// Message entities, representing styled text in a message See Derived classes: , , , , , , , , , , , , , , , , , , , , + /// Message entities, representing styled text in a message See Derived classes: , , , , , , , , , , , , , , , , , , , , , public abstract partial class MessageEntity : IObject { /// Offset of message entity within message (in UTF-16 code units) @@ -9112,6 +8986,24 @@ namespace TL collapsed = 0x1, } } + /// See + [TLDef(0x904AC7C7, inheritAt = 1)] + public sealed partial class MessageEntityFormattedDate : MessageEntity + { + /// Extra bits of information, use flags.HasFlag(...) to test for those + public Flags flags; + public DateTime date; + + [Flags] public enum Flags : uint + { + relative = 0x1, + short_time = 0x2, + long_time = 0x4, + short_date = 0x8, + long_date = 0x10, + day_of_week = 0x20, + } + } /// Represents a channel See Derived classes: , /// a value means inputChannelEmpty @@ -9275,7 +9167,7 @@ namespace TL /// Channel participant See Derived classes: , , , , , public abstract partial class ChannelParticipantBase : IObject { } /// Channel/supergroup participant See - [TLDef(0xCB397619)] + [TLDef(0x1BD54456)] public sealed partial class ChannelParticipant : ChannelParticipantBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -9286,15 +9178,18 @@ namespace TL public DateTime date; /// If set, contains the expiration date of the current Telegram Star subscription period » for the specified participant. [IfFlag(0)] public DateTime subscription_until_date; + [IfFlag(2)] public string rank; [Flags] public enum Flags : uint { /// Field has a value has_subscription_until_date = 0x1, + /// Field has a value + has_rank = 0x4, } } /// Myself See - [TLDef(0x4F607BEF)] + [TLDef(0xA9478A1A)] public sealed partial class ChannelParticipantSelf : ChannelParticipantBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -9307,6 +9202,7 @@ namespace TL public DateTime date; /// If set, contains the expiration date of the current Telegram Star subscription period » for the specified participant. [IfFlag(1)] public DateTime subscription_until_date; + [IfFlag(2)] public string rank; [Flags] public enum Flags : uint { @@ -9314,6 +9210,8 @@ namespace TL via_request = 0x1, /// Field has a value has_subscription_until_date = 0x2, + /// Field has a value + has_rank = 0x4, } } /// Channel/supergroup creator See @@ -9365,7 +9263,7 @@ namespace TL } } /// Banned/kicked user See - [TLDef(0x6DF8014E)] + [TLDef(0xD5F0AD91)] public sealed partial class ChannelParticipantBanned : ChannelParticipantBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -9378,11 +9276,14 @@ namespace TL public DateTime date; /// Banned rights public ChatBannedRights banned_rights; + [IfFlag(2)] public string rank; [Flags] public enum Flags : uint { /// Whether the user has left the group left = 0x1, + /// Field has a value + has_rank = 0x4, } } /// A participant that left the channel/supergroup See @@ -12499,7 +12400,7 @@ namespace TL } } - /// Channel admin log event See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Channel admin log event See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract partial class ChannelAdminLogEventAction : IObject { } /// Channel/supergroup title was changed See [TLDef(0xE6DFB825)] @@ -12902,6 +12803,14 @@ namespace TL /// New value of the toggle public bool new_value; } + /// See + [TLDef(0x5806B4EC)] + public sealed partial class ChannelAdminLogEventActionParticipantEditRank : ChannelAdminLogEventAction + { + public long user_id; + public string prev_rank; + public string new_rank; + } /// Admin log event See [TLDef(0x1FAD68CD)] @@ -12978,6 +12887,7 @@ namespace TL forums = 0x20000, /// Telegram Star subscription extension events » sub_extend = 0x40000, + edit_rank = 0x80000, } } @@ -14158,6 +14068,7 @@ namespace TL delete_stories = 0x10000, /// If set, allows the admin to manage the direct messages monoforum » and decline suggested posts ». manage_direct_messages = 0x20000, + manage_ranks = 0x40000, } } @@ -14212,6 +14123,7 @@ namespace TL send_docs = 0x1000000, /// If set, does not allow a user to send text messages in a supergroup/chat. send_plain = 0x2000000, + edit_rank = 0x4000000, } } @@ -14485,7 +14397,7 @@ namespace TL /// a value means urlAuthResultDefault public abstract partial class UrlAuthResult : IObject { } /// Details about the authorization request, for more info click here » See - [TLDef(0x32FABF1A)] + [TLDef(0xF8F8EB1E)] public sealed partial class UrlAuthResultRequest : UrlAuthResult { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -14498,6 +14410,8 @@ namespace TL [IfFlag(2)] public string platform; [IfFlag(2)] public string ip; [IfFlag(2)] public string region; + [IfFlag(3)] public string[] match_codes; + [IfFlag(4)] public long user_id_hint; [Flags] public enum Flags : uint { @@ -14506,6 +14420,11 @@ namespace TL request_phone_number = 0x2, /// Fields , , and have a value has_browser = 0x4, + /// Field has a value + has_match_codes = 0x8, + /// Field has a value + has_user_id_hint = 0x10, + match_codes_first = 0x20, } } /// Details about an accepted authorization request, for more info click here » See @@ -18581,13 +18500,15 @@ namespace TL } /// Represents a story media area » See Derived classes: , , , , , , , , - public abstract partial class MediaArea : IObject { } - /// Represents a location tag attached to a story, with additional venue information. See - [TLDef(0xBE82DB9C)] - public sealed partial class MediaAreaVenue : MediaArea + public abstract partial class MediaArea : IObject { /// The size and location of the media area corresponding to the location sticker on top of the story media. public MediaAreaCoordinates coordinates; + } + /// Represents a location tag attached to a story, with additional venue information. See + [TLDef(0xBE82DB9C, inheritAt = 0)] + public sealed partial class MediaAreaVenue : MediaArea + { /// Coordinates of the venue public GeoPoint geo; /// Venue name @@ -18602,24 +18523,20 @@ namespace TL public string venue_type; } /// Represents a location tag attached to a story, with additional venue information. See - [TLDef(0xB282217F)] + [TLDef(0xB282217F, inheritAt = 0)] public sealed partial class InputMediaAreaVenue : MediaArea { - /// The size and location of the media area corresponding to the location sticker on top of the story media. - public MediaAreaCoordinates coordinates; /// The query_id from , see here » for more info. public long query_id; /// The id of the chosen result, see here » for more info. public string result_id; } /// Represents a geolocation tag attached to a story. See - [TLDef(0xCAD5452D)] + [TLDef(0xCAD5452D, inheritAt = 1)] public sealed partial class MediaAreaGeoPoint : MediaArea { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// The size and position of the media area corresponding to the location sticker on top of the story media. - public MediaAreaCoordinates coordinates; /// Coordinates of the geolocation tag. public GeoPoint geo; /// Optional textual representation of the address. @@ -18632,13 +18549,11 @@ namespace TL } } /// Represents a reaction bubble. See - [TLDef(0x14455871)] + [TLDef(0x14455871, inheritAt = 1)] public sealed partial class MediaAreaSuggestedReaction : MediaArea { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// The coordinates of the media area corresponding to the reaction button. - public MediaAreaCoordinates coordinates; /// The reaction that should be sent when this area is clicked. public Reaction reaction; @@ -18651,42 +18566,34 @@ namespace TL } } /// Represents a channel post. See - [TLDef(0x770416AF)] + [TLDef(0x770416AF, inheritAt = 0)] public sealed partial class MediaAreaChannelPost : MediaArea { - /// The size and location of the media area corresponding to the location sticker on top of the story media. - public MediaAreaCoordinates coordinates; /// The channel that posted the message public long channel_id; /// ID of the channel message public int msg_id; } /// Represents a channel post See - [TLDef(0x2271F2BF)] + [TLDef(0x2271F2BF, inheritAt = 0)] public sealed partial class InputMediaAreaChannelPost : MediaArea { - /// The size and location of the media area corresponding to the location sticker on top of the story media. - public MediaAreaCoordinates coordinates; /// The channel that posted the message public InputChannelBase channel; /// ID of the channel message public int msg_id; } /// Represents a URL media area. See - [TLDef(0x37381085)] + [TLDef(0x37381085, inheritAt = 0)] public sealed partial class MediaAreaUrl : MediaArea { - /// The size and location of the media area corresponding to the URL button on top of the story media. - public MediaAreaCoordinates coordinates; /// URL to open when clicked. public string url; } /// Represents a weather widget ». See - [TLDef(0x49A6549C)] + [TLDef(0x49A6549C, inheritAt = 0)] public sealed partial class MediaAreaWeather : MediaArea { - /// The size and location of the media area corresponding to the widget on top of the story media. - public MediaAreaCoordinates coordinates; /// Weather emoji, should be rendered as an animated emoji. public string emoji; /// Temperature in degrees Celsius. @@ -18695,11 +18602,9 @@ namespace TL public int color; } /// Represents a collectible gift ». See - [TLDef(0x5787686D)] + [TLDef(0x5787686D, inheritAt = 0)] public sealed partial class MediaAreaStarGift : MediaArea { - /// Coordinates of the media area. - public MediaAreaCoordinates coordinates; /// slug from .slug, that can be resolved as specified here ». public string slug; } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 72fb740..985dec3 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -3291,14 +3291,15 @@ namespace TL /// The ID of the button with the authorization request /// URL used for link URL authorization, click here for more info » /// a null value means urlAuthResultDefault - public static Task Messages_RequestUrlAuth(this Client client, InputPeer peer = null, int? msg_id = null, int? button_id = null, string url = null) + public static Task Messages_RequestUrlAuth(this Client client, InputPeer peer = null, int? msg_id = null, int? button_id = null, string url = null, string in_app_origin = null) => client.Invoke(new Messages_RequestUrlAuth { - flags = (Messages_RequestUrlAuth.Flags)((peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0)), + flags = (Messages_RequestUrlAuth.Flags)((peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0) | (in_app_origin != null ? 0x8 : 0)), peer = peer, msg_id = msg_id ?? default, button_id = button_id ?? default, url = url, + in_app_origin = in_app_origin, }); /// Use this to accept a Seamless Telegram Login authorization request, for more info click here » See @@ -3308,14 +3309,15 @@ namespace TL /// ID of the login button /// URL used for link URL authorization, click here for more info » /// a null value means urlAuthResultDefault - public static Task Messages_AcceptUrlAuth(this Client client, InputPeer peer = null, int? msg_id = null, int? button_id = null, string url = null, bool write_allowed = false, bool share_phone_number = false) + public static Task Messages_AcceptUrlAuth(this Client client, InputPeer peer = null, int? msg_id = null, int? button_id = null, string url = null, string match_code = null, bool write_allowed = false, bool share_phone_number = false) => client.Invoke(new Messages_AcceptUrlAuth { - flags = (Messages_AcceptUrlAuth.Flags)((peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0) | (write_allowed ? 0x1 : 0) | (share_phone_number ? 0x8 : 0)), + flags = (Messages_AcceptUrlAuth.Flags)((peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0) | (match_code != null ? 0x10 : 0) | (write_allowed ? 0x1 : 0) | (share_phone_number ? 0x8 : 0)), peer = peer, msg_id = msg_id ?? default, button_id = button_id ?? default, url = url, + match_code = match_code, }); /// Should be called after the user hides the report spam/add as contact bar of a new chat, effectively prevents the user from executing the actions specified in the action bar ». See Possible codes: 400 (details) @@ -3754,11 +3756,13 @@ namespace TL /// Enable or disable content protection on a channel or chat See Possible codes: 400 (details) /// The chat or channel /// Enable or disable content protection - public static Task Messages_ToggleNoForwards(this Client client, InputPeer peer, bool enabled) + public static Task Messages_ToggleNoForwards(this Client client, InputPeer peer, bool enabled, int? request_msg_id = null) => client.Invoke(new Messages_ToggleNoForwards { + flags = (Messages_ToggleNoForwards.Flags)(request_msg_id != null ? 0x1 : 0), peer = peer, enabled = enabled, + request_msg_id = request_msg_id ?? default, }); /// Change the default peer that should be used when sending messages, reactions, poll votes to a specific group See Possible codes: 400 (details) @@ -4873,6 +4877,46 @@ namespace TL to_lang = to_lang, }); + /// See [bots: ✓] + public static Task Messages_EditChatCreator(this Client client, InputPeer peer, InputUserBase user_id, InputCheckPasswordSRP password) + => client.Invoke(new Messages_EditChatCreator + { + peer = peer, + user_id = user_id, + password = password, + }); + + /// See [bots: ✓] + public static Task Messages_GetFutureChatCreatorAfterLeave(this Client client, InputPeer peer) + => client.Invoke(new Messages_GetFutureChatCreatorAfterLeave + { + peer = peer, + }); + + /// See [bots: ✓] + public static Task Messages_EditChatParticipantRank(this Client client, InputPeer peer, InputPeer participant, string rank) + => client.Invoke(new Messages_EditChatParticipantRank + { + peer = peer, + participant = participant, + rank = rank, + }); + + /// See [bots: ✓] + public static Task Messages_DeclineUrlAuth(this Client client, string url) + => client.Invoke(new Messages_DeclineUrlAuth + { + url = url, + }); + + /// See [bots: ✓] + public static Task Messages_CheckUrlAuthMatchCode(this Client client, string url, string match_code) + => client.Invoke(new Messages_CheckUrlAuthMatchCode + { + url = url, + match_code = match_code, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -5393,9 +5437,10 @@ namespace TL /// The ID of the user whose admin rights should be modified /// The admin rights /// Indicates the role (rank) of the admin in the group: just an arbitrary string - public static Task Channels_EditAdmin(this Client client, InputChannelBase channel, InputUserBase user_id, ChatAdminRights admin_rights, string rank) + public static Task Channels_EditAdmin(this Client client, InputChannelBase channel, InputUserBase user_id, ChatAdminRights admin_rights, string rank = null) => client.Invoke(new Channels_EditAdmin { + flags = (Channels_EditAdmin.Flags)(rank != null ? 0x1 : 0), channel = channel, user_id = user_id, admin_rights = admin_rights, @@ -5609,18 +5654,6 @@ namespace TL group = group, }); - /// Transfer channel ownership See Possible codes: 400,403 (details) - /// Channel - /// New channel owner - /// 2FA password of account - public static Task Channels_EditCreator(this Client client, InputChannelBase channel, InputUserBase user_id, InputCheckPasswordSRP password) - => client.Invoke(new Channels_EditCreator - { - channel = channel, - user_id = user_id, - password = password, - }); - /// Edit location of geogroup, see here » for more info on geogroups. See Possible codes: 400 (details) /// Geogroup /// New geolocation @@ -5914,13 +5947,6 @@ namespace TL tab = tab, }); - /// See Possible codes: 400 (details) - public static Task Channels_GetFutureCreatorAfterLeave(this Client client, InputChannelBase channel) - => client.Invoke(new Channels_GetFutureCreatorAfterLeave - { - channel = channel, - }); - /// Sends a custom request; for bots only See [bots: ✓ users: ✗] Possible codes: 400 (details) /// The method name /// JSON-serialized method parameters @@ -11058,7 +11084,7 @@ namespace TL.Methods } } - [TLDef(0x198FB446)] + [TLDef(0x894CC99C)] public sealed partial class Messages_RequestUrlAuth : IMethod { public Flags flags; @@ -11066,15 +11092,17 @@ namespace TL.Methods [IfFlag(1)] public int msg_id; [IfFlag(1)] public int button_id; [IfFlag(2)] public string url; + [IfFlag(3)] public string in_app_origin; [Flags] public enum Flags : uint { has_peer = 0x2, has_url = 0x4, + has_in_app_origin = 0x8, } } - [TLDef(0xB12C7125)] + [TLDef(0x67A3F0DE)] public sealed partial class Messages_AcceptUrlAuth : IMethod { public Flags flags; @@ -11082,6 +11110,7 @@ namespace TL.Methods [IfFlag(1)] public int msg_id; [IfFlag(1)] public int button_id; [IfFlag(2)] public string url; + [IfFlag(4)] public string match_code; [Flags] public enum Flags : uint { @@ -11089,6 +11118,7 @@ namespace TL.Methods has_peer = 0x2, has_url = 0x4, share_phone_number = 0x8, + has_match_code = 0x10, } } @@ -11452,11 +11482,18 @@ namespace TL.Methods } } - [TLDef(0xB11EAFA2)] + [TLDef(0xB2081A35)] public sealed partial class Messages_ToggleNoForwards : IMethod { + public Flags flags; public InputPeer peer; public bool enabled; + [IfFlag(0)] public int request_msg_id; + + [Flags] public enum Flags : uint + { + has_request_msg_id = 0x1, + } } [TLDef(0xCCFDDF96)] @@ -12411,6 +12448,41 @@ namespace TL.Methods } } + [TLDef(0xF743B857)] + public sealed partial class Messages_EditChatCreator : IMethod + { + public InputPeer peer; + public InputUserBase user_id; + public InputCheckPasswordSRP password; + } + + [TLDef(0x3B7D0EA6)] + public sealed partial class Messages_GetFutureChatCreatorAfterLeave : IMethod + { + public InputPeer peer; + } + + [TLDef(0xA00F32B0)] + public sealed partial class Messages_EditChatParticipantRank : IMethod + { + public InputPeer peer; + public InputPeer participant; + public string rank; + } + + [TLDef(0x35436BBC)] + public sealed partial class Messages_DeclineUrlAuth : IMethod + { + public string url; + } + + [TLDef(0xC9A47B0B)] + public sealed partial class Messages_CheckUrlAuthMatchCode : IMethod + { + public string url; + public string match_code; + } + [TLDef(0xEDD4882A)] public sealed partial class Updates_GetState : IMethod { } @@ -12795,13 +12867,19 @@ namespace TL.Methods } } - [TLDef(0xD33C8902)] + [TLDef(0x9A98AD68)] public sealed partial class Channels_EditAdmin : IMethod { + public Flags flags; public InputChannelBase channel; public InputUserBase user_id; public ChatAdminRights admin_rights; - public string rank; + [IfFlag(0)] public string rank; + + [Flags] public enum Flags : uint + { + has_rank = 0x1, + } } [TLDef(0x566DECD0)] @@ -12974,14 +13052,6 @@ namespace TL.Methods public InputChannelBase group; } - [TLDef(0x8F38CD1F)] - public sealed partial class Channels_EditCreator : IMethod - { - public InputChannelBase channel; - public InputUserBase user_id; - public InputCheckPasswordSRP password; - } - [TLDef(0x58E63F6D)] public sealed partial class Channels_EditLocation : IMethod { @@ -13219,12 +13289,6 @@ namespace TL.Methods public ProfileTab tab; } - [TLDef(0xA00918AF)] - public sealed partial class Channels_GetFutureCreatorAfterLeave : IMethod - { - public InputChannelBase channel; - } - [TLDef(0xAA2769ED)] public sealed partial class Bots_SendCustomRequest : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 58c89c4..a26fd62 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 = 222; // fetched 02/06/2026 19:18:24 + public const int Version = 223; // fetched 03/02/2026 11:38:17 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -145,15 +145,15 @@ namespace TL [0x17D493D5] = typeof(ChannelForbidden), [0x2633421B] = typeof(ChatFull), [0xE4E0B29D] = typeof(ChannelFull), - [0xC02D4007] = typeof(ChatParticipant), - [0xE46BCEE4] = typeof(ChatParticipantCreator), - [0xA0933F5B] = typeof(ChatParticipantAdmin), + [0x38E79FDE] = typeof(ChatParticipant), + [0xE1F867B8] = typeof(ChatParticipantCreator), + [0x0360D5D2] = typeof(ChatParticipantAdmin), [0x8763D3E1] = typeof(ChatParticipantsForbidden), [0x3CBC93F8] = typeof(ChatParticipants), [0x37C1011C] = null,//ChatPhotoEmpty [0x1C6E1C11] = typeof(ChatPhoto), [0x90A6CA84] = typeof(MessageEmpty), - [0x9CB490E9] = typeof(Message), + [0x3AE56482] = typeof(Message), [0x7A800E0A] = typeof(MessageService), [0x3DED6320] = null,//MessageMediaEmpty [0x695150D7] = typeof(MessageMediaPhoto), @@ -236,6 +236,8 @@ namespace TL [0x73ADA76B] = typeof(MessageActionStarGiftPurchaseOfferDeclined), [0xB07ED085] = typeof(MessageActionNewCreatorPending), [0xE188503B] = typeof(MessageActionChangeCreator), + [0xBF7D6572] = typeof(MessageActionNoForwardsToggle), + [0x3E2793BA] = typeof(MessageActionNoForwardsRequest), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -453,6 +455,7 @@ namespace TL [0xDC58F31E] = typeof(UpdateStarGiftAuctionUserState), [0xFB9C547A] = typeof(UpdateEmojiGameInfo), [0xAC072444] = typeof(UpdateStarGiftCraftFail), + [0xBD8367B9] = typeof(UpdateChatParticipantRank), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -641,6 +644,7 @@ namespace TL [0x32CA960F] = typeof(MessageEntitySpoiler), [0xC8CF05F8] = typeof(MessageEntityCustomEmoji), [0xF1CCAAAC] = typeof(MessageEntityBlockquote), + [0x904AC7C7] = typeof(MessageEntityFormattedDate), [0xEE8C1E86] = null,//InputChannelEmpty [0xF35AEC28] = typeof(InputChannel), [0x5B934F9D] = typeof(InputChannelFromMessage), @@ -651,11 +655,11 @@ namespace TL [0x2064674E] = typeof(Updates_ChannelDifference), [0x94D42EE7] = null,//ChannelMessagesFilterEmpty [0xCD77D957] = typeof(ChannelMessagesFilter), - [0xCB397619] = typeof(ChannelParticipant), - [0x4F607BEF] = typeof(ChannelParticipantSelf), + [0x1BD54456] = typeof(ChannelParticipant), + [0xA9478A1A] = typeof(ChannelParticipantSelf), [0x2FE601D3] = typeof(ChannelParticipantCreator), [0x34C3BB53] = typeof(ChannelParticipantAdmin), - [0x6DF8014E] = typeof(ChannelParticipantBanned), + [0xD5F0AD91] = typeof(ChannelParticipantBanned), [0x1B03F006] = typeof(ChannelParticipantLeft), [0xDE3F3C79] = typeof(ChannelParticipantsRecent), [0xB4608969] = typeof(ChannelParticipantsAdmins), @@ -889,6 +893,7 @@ namespace TL [0x60A79C79] = typeof(ChannelAdminLogEventActionToggleSignatureProfiles), [0x64642DB3] = typeof(ChannelAdminLogEventActionParticipantSubExtend), [0xC517F77E] = typeof(ChannelAdminLogEventActionToggleAutotranslation), + [0x5806B4EC] = typeof(ChannelAdminLogEventActionParticipantEditRank), [0x1FAD68CD] = typeof(ChannelAdminLogEvent), [0xED8AF74D] = typeof(Channels_AdminLogResults), [0xEA107AE4] = typeof(ChannelAdminLogEventsFilter), @@ -1002,7 +1007,7 @@ namespace TL [0xFBD2C296] = typeof(InputFolderPeer), [0xE9BAA668] = typeof(FolderPeer), [0xE844EBFF] = typeof(Messages_SearchCounter), - [0x32FABF1A] = typeof(UrlAuthResultRequest), + [0xF8F8EB1E] = typeof(UrlAuthResultRequest), [0x623A8FA0] = typeof(UrlAuthResultAccepted), [0xA9D6DB1F] = null,//UrlAuthResultDefault [0xBFB5AD8B] = null,//ChannelLocationEmpty diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index aef2b5c..bd1d6c3 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,8 +13,8 @@ WTelegramClient Wizou 0.0.0 - layer.222 - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 222 + layer.223 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 223 Release Notes: $(ReleaseNotes) From 6611e8675b8072e8f81e85e1318d22a3c2eb36c7 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 7 Mar 2026 17:30:15 +0100 Subject: [PATCH 53/54] fixed KeyboardButtonUrlAuth --- src/TL.Schema.cs | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 6f8ea40..fde6d62 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -8654,15 +8654,32 @@ namespace TL { } /// Button to request a user to authorize via URL using Seamless Telegram Login. When the user clicks on such a button, Messages_RequestUrlAuth should be called, providing the button_id and the ID of the container message. The returned object will contain more details about the authorization request (request_write_access if the bot would like to send messages to the user along with the username of the bot which will be used for user authorization). Finally, the user can choose to call Messages_AcceptUrlAuth to get a with the URL to open instead of the url of this constructor, or a , in which case the url of this constructor must be opened, instead. If the user refuses the authorization request but still wants to open the link, the url of this constructor must be used. See - [TLDef(0xF51006F9, inheritAt = 0)] - public sealed partial class KeyboardButtonUrlAuth : KeyboardButton + [TLDef(0xF51006F9)] + public sealed partial class KeyboardButtonUrlAuth : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those + public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; + /// Button label + public string text; /// New text of the button in forwarded messages. - public string fwd_text; + [IfFlag(0)] public string fwd_text; /// An HTTP URL to be opened with user authorization data added to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. The data added is the same as described in Receiving authorization data.

NOTE: Services must always check the hash of the received data to verify the authentication and the integrity of the data as described in Checking authorization.
public string url; /// ID of the button to pass to Messages_RequestUrlAuth public int button_id; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_fwd_text = 0x1, + /// Field has a value + has_style = 0x400, + } + + public override KeyboardButtonStyle Style => style; + /// Button label + public override string Text => text; } /// Button to request a user to Messages_AcceptUrlAuth via URL using Seamless Telegram Login. See [TLDef(0x68013E72)] From 24dbbcf66ba6be26720684dc00415e8a754c9b81 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 1 Apr 2026 05:31:24 +0200 Subject: [PATCH 54/54] Html/Markdown conversions: - Support for MessageEntityFormattedDate - Removed premium optional arg (always true now) - Stopped supporting non-standard markdown "emoji?id=". Correct syntax is "tg://emoji?id=" --- EXAMPLES.md | 2 +- src/Services.cs | 60 ++++++++++++++++++++++++++++++++++--------------- 2 files changed, 43 insertions(+), 19 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index ac2daf1..d00c4b5 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -365,7 +365,7 @@ await Task.Delay(5000); ```csharp // • Sending a message with custom emojies in Markdown to ourself: var text = "Vicksy says Hi! ![👋](tg://emoji?id=5190875290439525089)"; -var entities = client.MarkdownToEntities(ref text, premium: true); +var entities = client.MarkdownToEntities(ref text); await client.SendMessageAsync(InputPeer.Self, text, entities: entities); // also available in HTML: 👋 diff --git a/src/Services.cs b/src/Services.cs index 7d452f2..ebf7733 100644 --- a/src/Services.cs +++ b/src/Services.cs @@ -131,10 +131,9 @@ namespace TL /// Converts a Markdown text into the (plain text + entities) format used by Telegram messages /// not used anymore, you can pass null /// [in] The Markdown text
[out] The same (plain) text, stripped of all Markdown notation - /// Generate premium entities if any /// Dictionary used for tg://user?id= notation /// The array of formatting entities that you can pass (along with the plain text) to SendMessageAsync or SendMediaAsync - public static MessageEntity[] MarkdownToEntities(this Client _, ref string text, bool premium = false, IReadOnlyDictionary users = null) + public static MessageEntity[] MarkdownToEntities(this Client _, ref string text, IReadOnlyDictionary users = null) { var entities = new List(); MessageEntityBlockquote lastBlockQuote = null; @@ -217,12 +216,18 @@ namespace TL else if (c == ')') break; } textUrl.url = sb.ToString(offset + 2, offset2 - offset - 3); + sb.Remove(offset, offset2 - offset); if (textUrl.url.StartsWith("tg://user?id=") && long.TryParse(textUrl.url[13..], out var id) && users?.GetValueOrDefault(id)?.access_hash is long hash) entities[lastIndex] = new InputMessageEntityMentionName { offset = textUrl.offset, length = textUrl.length, user_id = new InputUser(id, hash) }; - else if ((textUrl.url.StartsWith("tg://emoji?id=") || textUrl.url.StartsWith("emoji?id=")) && long.TryParse(textUrl.url[(textUrl.url.IndexOf('=') + 1)..], out id)) - if (premium) entities[lastIndex] = new MessageEntityCustomEmoji { offset = textUrl.offset, length = textUrl.length, document_id = id }; - else entities.RemoveAt(lastIndex); - sb.Remove(offset, offset2 - offset); + else if (textUrl.url.StartsWith("tg://emoji?id=") && long.TryParse(textUrl.url[14..], out id)) + entities[lastIndex] = new MessageEntityCustomEmoji { offset = textUrl.offset, length = textUrl.length, document_id = id }; + else if (textUrl.url.StartsWith("tg://time?unix=") && textUrl.url.IndexOf("&format=", 15) is { } idxFormat) + entities[lastIndex] = new MessageEntityFormattedDate + { + offset = textUrl.offset, length = textUrl.length, + date = new DateTime((long.Parse(idxFormat < 0 ? textUrl.url[15..] : textUrl.url[15..idxFormat]) + 62135596800L) * 10000000, DateTimeKind.Utc), + flags = idxFormat < 0 ? 0 : HtmlText.DateFlags(textUrl.url[(idxFormat + 8)..]) + }; break; } } @@ -264,9 +269,8 @@ namespace TL /// Client, used only for getting current user ID in case of InputMessageEntityMentionName+InputUserSelf /// The plain text, typically obtained from /// The array of formatting entities, typically obtained from - /// Convert premium entities (might lead to non-standard markdown) /// The message text with MarkdownV2 formattings - public static string EntitiesToMarkdown(this Client client, string message, MessageEntity[] entities, bool premium = false) + public static string EntitiesToMarkdown(this Client client, string message, MessageEntity[] entities) { if (entities == null || entities.Length == 0) return Escape(message); var closings = new List<(int offset, string md)>(); @@ -301,8 +305,9 @@ namespace TL else if (nextEntity is InputMessageEntityMentionName imemn) closing.md = $"](tg://user?id={imemn.user_id.UserId ?? client.UserId})"; else if (nextEntity is MessageEntityCustomEmoji mecu) - if (premium) closing.md = $"](tg://emoji?id={mecu.document_id})"; - else continue; + closing.md = $"](tg://emoji?id={mecu.document_id})"; + else if (nextEntity is MessageEntityFormattedDate mefd) + closing.md = $"](tg://time?unix={((DateTimeOffset)mefd.date).ToUnixTimeSeconds()}{(mefd.flags == 0 ? null : $"&format={HtmlText.DateFormat(mefd.flags)}")})"; } else if (nextEntity is MessageEntityBlockquote mebq) { inBlockQuote = true; if (lastCh is not '\n' and not '\0') md = "\n>"; @@ -343,6 +348,7 @@ namespace TL [typeof(MessageEntitySpoiler)] = "||", [typeof(MessageEntityCustomEmoji)] = "![", [typeof(MessageEntityBlockquote)] = ">", + [typeof(MessageEntityFormattedDate)] = "![", }; /// Insert backslashes in front of Markdown reserved characters @@ -372,10 +378,9 @@ namespace TL /// Converts an HTML-formatted text into the (plain text + entities) format used by Telegram messages /// not used anymore, you can pass null /// [in] The HTML-formatted text
[out] The same (plain) text, stripped of all HTML tags - /// Generate premium entities if any /// Dictionary used for tg://user?id= notation /// The array of formatting entities that you can pass (along with the plain text) to SendMessageAsync or SendMediaAsync - public static MessageEntity[] HtmlToEntities(this Client _, ref string text, bool premium = false, IReadOnlyDictionary users = null) + public static MessageEntity[] HtmlToEntities(this Client _, ref string text, IReadOnlyDictionary users = null) { var entities = new List(); var sb = new StringBuilder(text); @@ -419,6 +424,7 @@ namespace TL case "code": ProcessEntity(); break; case "pre": ProcessEntity(); break; case "tg-emoji" when closing: ProcessEntity(); break; + case "tg-time" when closing: ProcessEntity(); break; case "blockquote": ProcessEntity(); break; case "blockquote expandable": entities.Add(new MessageEntityBlockquote { offset = offset, length = -1, flags = MessageEntityBlockquote.Flags.collapsed }); @@ -448,8 +454,15 @@ namespace TL if (entities.LastOrDefault(e => e.length == -1) is MessageEntityPre prevEntity) prevEntity.language = tag[21..^1]; } - else if (premium && (tag.StartsWith("tg-emoji emoji-id=\"") || tag.StartsWith("tg-emoji emoji-id='"))) - entities.Add(new MessageEntityCustomEmoji { offset = offset, length = -1, document_id = long.Parse(tag[(tag.IndexOf('=') + 2)..^1]) }); + else if (tag.StartsWith("tg-emoji emoji-id=\"") || tag.StartsWith("tg-emoji emoji-id='")) + entities.Add(new MessageEntityCustomEmoji { offset = offset, length = -1, document_id = long.Parse(tag[19..^1]) }); + else if ((tag.StartsWith("tg-time unix=\"") || tag.StartsWith("tg-time unix='")) && (end = tag.IndexOf(tag[13], 14)) > 0) + entities.Add(new MessageEntityFormattedDate + { + offset = offset, length = -1, + date = new DateTime((long.Parse(tag[14..end]) + 62135596800L) * 10000000, DateTimeKind.Utc), + flags = string.Compare(tag, end + 1, " format=", 0, 8) == 0 ? DateFlags(tag[(end + 10)..^1]) : 0 + }); break; } @@ -486,9 +499,8 @@ namespace TL /// Client, used only for getting current user ID in case of InputMessageEntityMentionName+InputUserSelf /// The plain text, typically obtained from /// The array of formatting entities, typically obtained from - /// Convert premium entities /// The message text with HTML formatting tags - public static string EntitiesToHtml(this Client client, string message, MessageEntity[] entities, bool premium = false) + public static string EntitiesToHtml(this Client client, string message, MessageEntity[] entities) { if (entities == null || entities.Length == 0) return Escape(message); var closings = new List<(int offset, string tag)>(); @@ -519,8 +531,7 @@ namespace TL tag = $""; } else if (nextEntity is MessageEntityCustomEmoji mecu) - if (premium) tag = $""; - else continue; + tag = $""; else if (nextEntity is MessageEntityPre mep && !string.IsNullOrEmpty(mep.language)) { closing.Item2 = ""; @@ -528,6 +539,8 @@ namespace TL } else if (nextEntity is MessageEntityBlockquote { flags: MessageEntityBlockquote.Flags.collapsed }) tag = "
"; + else if (nextEntity is MessageEntityFormattedDate mefd) + tag = $""; else tag = $"<{tag}>"; int index = ~closings.BinarySearch(closing, Comparer<(int, string)>.Create((x, y) => x.Item1.CompareTo(y.Item1) | 1)); @@ -559,6 +572,7 @@ namespace TL [typeof(MessageEntitySpoiler)] = "tg-spoiler", [typeof(MessageEntityCustomEmoji)] = "tg-emoji", [typeof(MessageEntityBlockquote)] = "blockquote", + [typeof(MessageEntityFormattedDate)] = "tg-time", }; /// Replace special HTML characters with their &xx; equivalent @@ -566,5 +580,15 @@ namespace TL /// The HTML-safe text, ready to be used in HtmlToEntities without problems public static string Escape(string text) => text?.Replace("&", "&").Replace("<", "<").Replace(">", ">"); + + internal static string DateFormat(MessageEntityFormattedDate.Flags flags) => flags.HasFlag(MessageEntityFormattedDate.Flags.relative) ? "r" : + ((flags & MessageEntityFormattedDate.Flags.day_of_week) != 0 ? "w" : "") + + ((flags & MessageEntityFormattedDate.Flags.short_date) != 0 ? "d" : "") + + ((flags & MessageEntityFormattedDate.Flags.long_date) != 0 ? "D" : "") + + ((flags & MessageEntityFormattedDate.Flags.short_time) != 0 ? "t" : "") + + ((flags & MessageEntityFormattedDate.Flags.long_time) != 0 ? "T" : ""); + + internal static MessageEntityFormattedDate.Flags DateFlags(string format) + => (MessageEntityFormattedDate.Flags)format.Sum(c => 1 << "rtTdDw".IndexOf(c)); } }