mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2025-12-06 06:52:01 +01:00
Collect: Fix Channel losing participants_count
This commit is contained in:
parent
9693037ef2
commit
4ccfddd22e
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -566,7 +566,7 @@ namespace WTelegram
|
|||
|
||||
/// <summary>Save the current state of the manager to JSON file</summary>
|
||||
/// <param name="statePath">File path to write</param>
|
||||
/// <remarks>Note: This does not save the the content of collected Users/Chats dictionaries</remarks>
|
||||
/// <remarks>Note: This does not save the content of collected Users/Chats dictionaries</remarks>
|
||||
public void SaveState(string statePath)
|
||||
=> System.IO.File.WriteAllText(statePath, System.Text.Json.JsonSerializer.Serialize(State, Helpers.JsonOptions));
|
||||
public static Dictionary<long, MBoxState> LoadState(string statePath) => !System.IO.File.Exists(statePath) ? null
|
||||
|
|
|
|||
Loading…
Reference in a new issue