diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs
index f9adc37..115f05a 100644
--- a/src/Client.Helpers.cs
+++ b/src/Client.Helpers.cs
@@ -579,6 +579,29 @@ namespace WTelegram
}
}
+ /// Helper simplified method: Get the admin log of a channel/supergroup See Possible codes: 400,403 (details)
+ /// Channel
+ /// Search query, can be empty
+ /// Event filter
+ /// Only show events from this admin
+ public async Task Channels_GetAdminLog(InputChannelBase channel, ChannelAdminLogEventsFilter.Flags events_filter = 0, string q = null, InputUserBase admin = null)
+ {
+ var admins = admin == null ? null : new[] { admin };
+ var result = await this.Channels_GetAdminLog(channel, q, events_filter: events_filter, admins: admins);
+ if (result.events.Length < 100) return result;
+ var resultFull = result;
+ List events = new(result.events);
+ do
+ {
+ result = await this.Channels_GetAdminLog(channel, q, max_id: result.events[^1].id, events_filter: events_filter, admins: admins);
+ events.AddRange(result.events);
+ foreach (var kvp in result.chats) resultFull.chats[kvp.Key] = kvp.Value;
+ foreach (var kvp in result.users) resultFull.users[kvp.Key] = kvp.Value;
+ } while (result.events.Length >= 100);
+ resultFull.events = events.ToArray();
+ return resultFull;
+ }
+
private const string OnlyChatChannel = "This method works on Chat & Channel only";
/// Generic helper: Adds a single user to a Chat or Channel See
and Possible codes: 400,403
/// Chat/Channel
diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs
index 21adbde..625fdae 100644
--- a/src/TL.Helpers.cs
+++ b/src/TL.Helpers.cs
@@ -562,6 +562,11 @@ namespace TL
partial class PhoneCallBase { public static implicit operator InputPhoneCall(PhoneCallBase call) => new() { id = call.ID, access_hash = call.AccessHash }; }
+ partial class ChannelAdminLogEventsFilter
+ {
+ public static implicit operator ChannelAdminLogEventsFilter(Flags flags) => new() { flags = flags };
+ }
+
partial class InputMessage
{
public static implicit operator InputMessage(int id) => new InputMessageID { id = id };
diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs
index 72c0a58..f747ec7 100644
--- a/src/TL.Schema.cs
+++ b/src/TL.Schema.cs
@@ -10108,7 +10108,7 @@ namespace TL
/// Filter only certain admin log events See
[TLDef(0xEA107AE4)]
- public class ChannelAdminLogEventsFilter : IObject
+ public partial class ChannelAdminLogEventsFilter : IObject
{
/// Flags, see TL conditional fields
public Flags flags;