From 8d70f241ada695ef1f31b1c251818ba59946a3ef Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 18 Jan 2022 15:24:04 +0100 Subject: [PATCH] ChatFull Participants helpers --- src/TL.Helpers.cs | 9 +++++++++ src/TL.Schema.cs | 12 ++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index d446e76..a9d6930 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -103,6 +103,7 @@ namespace TL partial class ChatBase : IPeerInfo { + /// Is this chat among current user active chats? public abstract bool IsActive { get; } public abstract ChatPhoto Photo { get; } /// returns true if you're banned of any of these rights @@ -155,11 +156,19 @@ namespace TL public override string ToString() => $"ChannelForbidden {id} \"{title}\""; } + partial class ChatFullBase { public abstract int ParticipantsCount { get; } } + partial class ChatFull { public override int ParticipantsCount => participants.Participants.Length; } + partial class ChannelFull { public override int ParticipantsCount => participants_count; } + partial class ChatParticipantBase { public abstract bool IsAdmin { get; } } partial class ChatParticipant { public override bool IsAdmin => false; } partial class ChatParticipantCreator { public override bool IsAdmin => true; } partial class ChatParticipantAdmin { public override bool IsAdmin => true; } + partial class ChatParticipantsBase { public abstract ChatParticipantBase[] Participants { get; }} + partial class ChatParticipantsForbidden { public override ChatParticipantBase[] Participants => Array.Empty(); } + partial class ChatParticipants { public override ChatParticipantBase[] Participants => participants; } + partial class PhotoBase { public abstract long ID { get; } diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 8a21a0d..a6e239c 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1034,7 +1034,7 @@ namespace TL } /// Object containing detailed group info Derived classes: , See - public abstract class ChatFullBase : IObject + public abstract partial class ChatFullBase : IObject { /// ID of the chat public abstract long ID { get; } @@ -1066,7 +1066,7 @@ namespace TL } /// Detailed chat info See [TLDef(0xD18EE226)] - public class ChatFull : ChatFullBase + public partial class ChatFull : ChatFullBase { /// Flags, see TL conditional fields public Flags flags; @@ -1160,7 +1160,7 @@ namespace TL } /// Full info about a channel/supergroup See [TLDef(0xE13C3D20)] - public class ChannelFull : ChatFullBase + public partial class ChannelFull : ChatFullBase { /// Flags, see TL conditional fields public Flags flags; @@ -1363,14 +1363,14 @@ namespace TL } /// Object contains info on group members. Derived classes: , See - public abstract class ChatParticipantsBase : IObject + public abstract partial class ChatParticipantsBase : IObject { /// Group ID public abstract long ChatId { get; } } /// Info on members is unavailable See [TLDef(0x8763D3E1)] - public class ChatParticipantsForbidden : ChatParticipantsBase + public partial class ChatParticipantsForbidden : ChatParticipantsBase { /// Flags, see TL conditional fields public Flags flags; @@ -1390,7 +1390,7 @@ namespace TL } /// Group members. See [TLDef(0x3CBC93F8)] - public class ChatParticipants : ChatParticipantsBase + public partial class ChatParticipants : ChatParticipantsBase { /// Group identifier public long chat_id;