From e6dde325380b489f7d5f1e78eef07efbd888e42c Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 28 Jan 2025 13:46:06 +0100 Subject: [PATCH] Fix Messages_GetAllChats to include only your chats --- README.md | 2 +- src/Client.Helpers.cs | 6 +++++- src/WTelegramClient.csproj | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2279602..d43c617 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. -© 2024 Olivier Marcoux +© 2021-2025 Olivier Marcoux diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 69d3b22..25124ea 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -504,7 +504,11 @@ namespace WTelegram public async Task Messages_GetAllChats() { var dialogs = await Messages_GetAllDialogs(); - return new Messages_Chats { chats = dialogs.chats }; + var result = new Messages_Chats { chats = [] }; + foreach (var dialog in dialogs.dialogs) + if (dialog.Peer is (PeerChat or PeerChannel) and { ID: var id }) + result.chats[id] = dialogs.chats[id]; + return result; } /// Returns the current user dialog list. Possible codes: 400 (details) diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 819a3c0..5cd6031 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -17,7 +17,7 @@ Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) - Copyright © Olivier Marcoux 2021-2024 + Copyright © Olivier Marcoux 2021-2025 MIT https://wiz0u.github.io/WTelegramClient logo.png