diff --git a/EXAMPLES.md b/EXAMPLES.md index 3b5c93d..455aa6b 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -369,7 +369,7 @@ static StreamWriter WTelegramLogs = new StreamWriter("WTelegram.log", true, Enco ... WTelegram.Helpers.Log = (lvl, str) => WTelegramLogs.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss} [{"TDIWE!"[lvl]}] {str}"); -// • In an ASP.NET service, you will typically send logs to a `ILogger`: +// • In an ASP.NET service, you will typically send logs to a ILogger: WTelegram.Helpers.Log = (lvl, str) => _logger.Log((LogLevel)lvl, str); ``` diff --git a/src/Client.cs b/src/Client.cs index 2749097..7c88cdc 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1659,9 +1659,10 @@ namespace WTelegram /// Also fetch the kicked/banned members? /// first letters used to search for in participants names
(default values crafted with ♥ to find most latin and cyrillic names) /// second (and further) letters used to search for in participants names + /// Can be used to abort the work of this method /// Field count indicates the total count of members. Field participants contains those that were successfully fetched /// ⚠ This method can take a few minutes to complete on big broadcast channels. It likely won't be able to obtain the full total count of members - public async Task Channels_GetAllParticipants(InputChannelBase channel, bool includeKickBan = false, string alphabet1 = "АБCДЕЄЖФГHИІJКЛМНОПQРСТУВWХЦЧШЩЫЮЯЗ", string alphabet2 = "АCЕHИJЛМНОРСТУВWЫ") + public async Task Channels_GetAllParticipants(InputChannelBase channel, bool includeKickBan = false, string alphabet1 = "АБCДЕЄЖФГHИІJКЛМНОПQРСТУВWХЦЧШЩЫЮЯЗ", string alphabet2 = "АCЕHИJЛМНОРСТУВWЫ", CancellationToken cancellationToken = default) { alphabet2 ??= alphabet1; var result = new Channels_ChannelParticipants { chats = new(), users = new() }; @@ -1689,6 +1690,7 @@ namespace WTelegram int maxCount = 0; for (int offset = 0; ;) { + cancellationToken.ThrowIfCancellationRequested(); ccp = await this.Channels_GetParticipants(channel, filter, offset, 1024, 0); if (ccp.count > maxCount) maxCount = ccp.count; foreach (var kvp in ccp.chats) result.chats[kvp.Key] = kvp.Value;