added Messages_GetAllDialogs. UserOrChat(null) returns null

This commit is contained in:
Wizou 2022-02-27 22:06:13 +01:00
parent f3a55385ab
commit 78d7e250f3
6 changed files with 81 additions and 65 deletions

View file

@ -117,7 +117,7 @@ long chatId = long.Parse(Console.ReadLine());
await client.SendMessageAsync(chats.chats[chatId], "Hello, World");
```
Notes:
- This list does not include discussions with other users. For this, you need to use [Messages_GetDialogs](#list-dialogs).
- This list does not include discussions with other users. For this, you need to use [Messages_GetAllDialogs](#list-dialogs).
- The list returned by Messages_GetAllChats contains the `access_hash` for those chats. Read [FAQ #4](FAQ.MD#access-hash) about this.
- If a small private chat group has been migrated to a supergroup, you may find both the old `Chat` and a `Channel` with different IDs in the `chats.chats` result,
but the old `Chat` will be marked with flag [deactivated] and should not be used anymore. See [Terminology in ReadMe](README.md#terminology).
@ -168,23 +168,16 @@ await client.SendAlbumAsync(InputPeer.Self, inputMedias, "My first album");
<a name="list-dialogs"></a>
### List all dialogs (chats/groups/channels/user chat) the user is in
```csharp
var dialogs = await client.Messages_GetDialogs();
while (dialogs.Dialogs.Length != 0)
{
foreach (var dialog in dialogs.Dialogs)
switch (dialogs.UserOrChat(dialog))
{
case User user when user.IsActive: Console.WriteLine("User " + user); break;
case ChatBase chat when chat.IsActive: Console.WriteLine(chat); break;
}
var lastDialog = dialogs.Dialogs[^1];
var lastMsg = dialogs.Messages.LastOrDefault(m => m.Peer.ID == lastDialog.Peer.ID && m.ID == lastDialog.TopMessage);
var offsetPeer = dialogs.UserOrChat(lastDialog).ToInputPeer();
dialogs = await client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.TopMessage, offsetPeer);
}
var dialogs = await client.Messages_GetAllDialogs();
foreach (var dialog in dialogs.dialogs)
switch (dialogs.UserOrChat(dialog))
{
case User user when user.IsActive: Console.WriteLine("User " + user); break;
case ChatBase chat when chat.IsActive: Console.WriteLine(chat); break;
}
```
*Note: the lists returned by Messages_GetDialogs contains the `access_hash` for those chats and users.*
*Note: the lists returned by Messages_GetAllDialogs contains the `access_hash` for those chats and users.*
See also the `Main` method in [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs).
<a name="list-members"></a>

View file

@ -44,8 +44,8 @@ namespace WTelegramClientTest
{
// Zero means the access hash for Durov's Channel was not collected yet.
// So we need to obtain it through Client API calls whose results contains the access_hash field, such as:
// - Messages_GetAllChats (see Program_GetAllChats.cs for an example on how to use it)
// - Messages_GetDialogs (see Program_ListenUpdates.cs for an example on how to use it)
// - Messages_GetAllChats (see Program_GetAllChats.cs for an example on how to use it)
// - Messages_GetAllDialogs (see Program_ListenUpdates.cs for an example on how to use it)
// - Contacts_ResolveUsername (see below for an example on how to use it)
// and many more API methods...
// The access_hash fields can be found inside instance of User, Channel, Photo, Document, etc..

View file

@ -25,16 +25,8 @@ namespace WTelegramClientTest
// Note that on login Telegram may sends a bunch of updates/messages that happened in the past and were not acknowledged
Console.WriteLine($"We are logged-in as {My.username ?? My.first_name + " " + My.last_name} (id {My.id})");
// We collect all infos about the users/chats so that updates can be printed with their names
var dialogsBase = await Client.Messages_GetDialogs(); // dialogs = groups/channels/users
if (dialogsBase is Messages_Dialogs dialogs)
while (dialogs.dialogs.Length != 0)
{
dialogs.CollectUsersChats(_users, _chats);
var lastDialog = dialogs.dialogs[^1];
var lastMsg = dialogs.messages.LastOrDefault(m => m.Peer.ID == lastDialog.Peer.ID && m.ID == lastDialog.TopMessage);
var offsetPeer = dialogs.UserOrChat(lastDialog).ToInputPeer();
dialogs = (Messages_Dialogs)await Client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.TopMessage, offsetPeer);
}
var dialogs = await Client.Messages_GetAllDialogs(); // dialogs = groups/channels/users
dialogs.CollectUsersChats(_users, _chats);
Console.ReadKey();
}
}
@ -64,7 +56,7 @@ namespace WTelegramClientTest
case UpdateUserStatus uus: Console.WriteLine($"{User(uus.user_id)} is now {uus.status.GetType().Name[10..]}"); break;
case UpdateUserName uun: Console.WriteLine($"{User(uun.user_id)} has changed profile name: @{uun.username} {uun.first_name} {uun.last_name}"); break;
case UpdateUserPhoto uup: Console.WriteLine($"{User(uup.user_id)} has changed profile photo"); break;
default: Console.WriteLine(update.GetType().Name); break;
default: Console.WriteLine(update.GetType().Name); break; // there are much more update types than the above cases
}
}

4
FAQ.md
View file

@ -55,7 +55,7 @@ However most common chat groups are not `Chat` but a `Channel` supergroup (witho
Some TL methods only applies to private `Chat`, some only applies to `Channel` and some to both.
The `access_hash` must usually be provided within the `Input...` structure you pass in argument to an API method (`InputPeer`, `InputChannel`, `InputUser`, etc...).
You obtain the `access_hash` through **description structures** like `Channel`, `User`, `Photo`, `Document` that you receive through updates or when you query them through API methods like `Messages_GetAllChats`, `Messages_GetDialogs`, `Contacts_ResolveUsername`, etc...
You obtain the `access_hash` through **description structures** like `Channel`, `User`, `Photo`, `Document` that you receive through updates or when you query them through API methods like `Messages_GetAllChats`, `Messages_GetAllDialogs`, `Contacts_ResolveUsername`, etc...
*(if you have a `Peer` object, you can convert it to a `User`/`Channel`/`Chat` via the `UserOrChat` helper from the root class that contained the peer)*
Once you obtained the description structure, there are 3 methods for building your `Input...` structure:
@ -157,7 +157,7 @@ API method [Messages_GetAllChats](https://corefork.telegram.org/method/messages.
Telegram Client API don't use these kind of IDs for chats. Remove the -100 prefix and try again with the rest (1234567890).
- You're trying to use a user ID instead of a chat ID.
Private messages with a user are not called "chats". See [Terminology in ReadMe](README.md#terminology).
To obtain the list of users (as well as chats and channels) the logged-in user is currenly engaged in a discussion with, you should [use the API method Messages_GetDialogs](EXAMPLES.md#list-dialogs)
To obtain the list of users (as well as chats and channels) the logged-in user is currenly engaged in a discussion with, you should [use the API method Messages_GetAllDialogs](EXAMPLES.md#list-dialogs)
- the `chats.chats` dictionary is empty.
This is the case if you are logged-in as a brand new user account (that hasn't join any chat groups/channels)
or if you are connected to a Test DC (a Telegram datacenter server for tests) instead of Production DC

View file

@ -1532,7 +1532,7 @@ namespace WTelegram
_parallelTransfers.Release();
}
if (fileBase is not Upload_File fileData)
throw new ApplicationException("Upload_GetFile returned unsupported " + fileBase.GetType().Name);
throw new ApplicationException("Upload_GetFile returned unsupported " + fileBase?.GetType().Name);
if (fileData.bytes.Length != FilePartSize) abort = true;
if (fileData.bytes.Length != 0)
{
@ -1623,6 +1623,37 @@ namespace WTelegram
return true;
}
/// <summary>Returns the current user dialog list. <para>Possible <see cref="RpcException"/> codes: 400 (<a href="https://corefork.telegram.org/method/messages.getDialogs#possible-errors">details</a>)</para></summary>
/// <param name="folder_id"><a href="https://corefork.telegram.org/api/folders#peer-folders">Peer folder ID, for more info click here</a></param>
/// <returns>See <a href="https://corefork.telegram.org/constructor/messages.dialogs"/></returns>
public async Task<Messages_Dialogs> Messages_GetAllDialogs(int? folder_id = null)
{
var dialogs = await this.Messages_GetDialogs(folder_id: folder_id);
switch (dialogs)
{
case Messages_DialogsSlice mds:
var dialogList = new List<DialogBase>();
var messageList = new List<MessageBase>();
while (dialogs.Dialogs.Length != 0)
{
dialogList.AddRange(dialogs.Dialogs);
messageList.AddRange(dialogs.Messages);
var lastDialog = dialogs.Dialogs[^1];
var lastMsg = dialogs.Messages.LastOrDefault(m => m.Peer.ID == lastDialog.Peer.ID && m.ID == lastDialog.TopMessage);
var offsetPeer = dialogs.UserOrChat(lastDialog).ToInputPeer();
dialogs = await this.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.TopMessage, offsetPeer, folder_id: folder_id);
if (dialogs is not Messages_Dialogs md) break;
foreach (var (key, value) in md.chats) mds.chats[key] = value;
foreach (var (key, value) in md.users) mds.users[key] = value;
}
mds.dialogs = dialogList.ToArray();
mds.messages = messageList.ToArray();
return mds;
case Messages_Dialogs md: return md;
default: throw new ApplicationException("Messages_GetDialogs returned unexpected " + dialogs?.GetType().Name);
}
}
/// <summary>Helper method that tries to fetch all participants from a Channel (beyond Telegram server-side limitations)</summary>
/// <param name="channel">The channel to query</param>
/// <param name="includeKickBan">Also fetch the kicked/banned members?</param>

View file

@ -2723,7 +2723,7 @@ namespace TL
/// <summary>List of users</summary>
public Dictionary<long, User> users;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>Incomplete list of blocked users. <para>See <a href="https://corefork.telegram.org/constructor/contacts.blockedSlice"/></para></summary>
[TLDef(0xE1664194)]
@ -2761,7 +2761,7 @@ namespace TL
/// <summary>List of last messages from each chat</summary>
public override MessageBase[] Messages => messages;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public override IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>Incomplete list of dialogs with messages and auxiliary data. <para>See <a href="https://corefork.telegram.org/constructor/messages.dialogsSlice"/></para></summary>
[TLDef(0x71E094F3)]
@ -2805,7 +2805,7 @@ namespace TL
/// <summary>List of messages</summary>
public override MessageBase[] Messages => messages;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public override IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>Incomplete list of messages and auxiliary data. <para>See <a href="https://corefork.telegram.org/constructor/messages.messagesSlice"/></para></summary>
[TLDef(0x3A54685E)]
@ -2860,7 +2860,7 @@ namespace TL
/// <summary>Found messages</summary>
public override MessageBase[] Messages => messages;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public override IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>No new messages matching the query were found <para>See <a href="https://corefork.telegram.org/constructor/messages.messagesNotModified"/></para></summary>
[TLDef(0x74535F21)]
@ -2900,7 +2900,7 @@ namespace TL
/// <summary>List of users mentioned above</summary>
public Dictionary<long, User> users;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>Affected part of communication history with the user or in a chat. <para>See <a href="https://corefork.telegram.org/constructor/messages.affectedHistory"/></para></summary>
@ -4168,7 +4168,7 @@ namespace TL
/// <summary>List of updates</summary>
public override Update[] OtherUpdates => other_updates;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public override IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>Incomplete list of occurred events. <para>See <a href="https://corefork.telegram.org/constructor/updates.differenceSlice"/></para></summary>
[TLDef(0xA8FB1981)]
@ -4194,7 +4194,7 @@ namespace TL
/// <summary>List of updates</summary>
public override Update[] OtherUpdates => other_updates;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public override IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>The difference is <a href="https://corefork.telegram.org/api/updates#recovering-gaps">too long</a>, and the specified state must be used to refetch updates. <para>See <a href="https://corefork.telegram.org/constructor/updates.differenceTooLong"/></para></summary>
[TLDef(0x4AFE8F6D)]
@ -4374,7 +4374,7 @@ namespace TL
/// <summary>Current date</summary>
public override DateTime Date => date;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public override IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>Full constructor of updates <para>See <a href="https://corefork.telegram.org/constructor/updates"/></para></summary>
[TLDef(0x74AE4240)]
@ -4394,7 +4394,7 @@ namespace TL
/// <summary>Current date</summary>
public override DateTime Date => date;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public override IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>Shortened constructor containing info on one outgoing message to a contact (the destination chat has to be extracted from the method call that returned this object). <para>See <a href="https://corefork.telegram.org/constructor/updateShortSentMessage"/></para></summary>
[TLDef(0x9015E101)]
@ -5178,7 +5178,7 @@ namespace TL
/// <summary>List of users</summary>
public Dictionary<long, User> users;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>Privacy key <para>See <a href="https://corefork.telegram.org/type/InputPrivacyKey"/></para></summary>
@ -5320,7 +5320,7 @@ namespace TL
/// <summary>Users to which the rules apply</summary>
public Dictionary<long, User> users;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>Time to live in days of the current account <para>See <a href="https://corefork.telegram.org/constructor/accountDaysTTL"/></para></summary>
@ -6334,7 +6334,7 @@ namespace TL
/// <summary>Users</summary>
public Dictionary<long, User> users;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the result</summary>
public IPeerInfo UserOrChat => peer.UserOrChat(users, chats);
public IPeerInfo UserOrChat => peer?.UserOrChat(users, chats);
}
/// <summary>Indicates a range of chat messages <para>See <a href="https://corefork.telegram.org/constructor/messageRange"/></para></summary>
@ -6399,7 +6399,7 @@ namespace TL
has_timeout = 0x2,
}
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public override IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>The new updates <para>See <a href="https://corefork.telegram.org/constructor/updates.channelDifference"/></para></summary>
[TLDef(0x2064674E)]
@ -6428,7 +6428,7 @@ namespace TL
has_timeout = 0x2,
}
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public override IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>Filter for getting only certain types of channel messages <para>See <a href="https://corefork.telegram.org/constructor/channelMessagesFilter"/></para></summary>
@ -6627,7 +6627,7 @@ namespace TL
/// <summary>Users mentioned in participant info</summary>
public Dictionary<long, User> users;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>Represents a channel participant <para>See <a href="https://corefork.telegram.org/constructor/channels.channelParticipant"/></para></summary>
@ -6641,7 +6641,7 @@ namespace TL
/// <summary>Users</summary>
public Dictionary<long, User> users;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>Info about the latest telegram Terms Of Service <para>See <a href="https://corefork.telegram.org/constructor/help.termsOfService"/></para></summary>
@ -7457,7 +7457,7 @@ namespace TL
/// <summary>Current <a href="https://corefork.telegram.org/api/updates">update state of dialog</a></summary>
public Updates_State state;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>Top peer <para>See <a href="https://corefork.telegram.org/constructor/topPeer"/></para></summary>
@ -7517,7 +7517,7 @@ namespace TL
/// <summary>Users</summary>
public Dictionary<long, User> users;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>Top peers disabled <para>See <a href="https://corefork.telegram.org/constructor/contacts.topPeersDisabled"/></para></summary>
[TLDef(0xB52C939D)]
@ -9434,7 +9434,7 @@ namespace TL
/// <summary>Users mentioned in events</summary>
public Dictionary<long, User> users;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>Filter only certain admin log events <para>See <a href="https://corefork.telegram.org/constructor/channelAdminLogEventsFilter"/></para></summary>
@ -9555,7 +9555,7 @@ namespace TL
/// <summary>Users</summary>
public Dictionary<long, User> users;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>A single media in an <a href="https://corefork.telegram.org/api/files#albums-grouped-media">album or grouped media</a> sent with <a href="https://corefork.telegram.org/method/messages.sendMultiMedia">messages.sendMultiMedia</a>. <para>See <a href="https://corefork.telegram.org/constructor/inputSingleMedia"/></para></summary>
@ -11146,7 +11146,7 @@ namespace TL
/// <summary>Users mentioned in the chat list</summary>
public Dictionary<long, User> users;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>Basic theme settings <para>See <a href="https://corefork.telegram.org/type/BaseTheme"/></para></summary>
@ -11547,7 +11547,7 @@ namespace TL
has_psa_message = 0x4,
}
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the result</summary>
public IPeerInfo UserOrChat => peer.UserOrChat(users, chats);
public IPeerInfo UserOrChat => peer?.UserOrChat(users, chats);
}
/// <summary><a href="https://corefork.telegram.org/api/files#animated-profile-pictures">Animated profile picture</a> in MPEG4 format <para>See <a href="https://corefork.telegram.org/constructor/videoSize"/></para></summary>
@ -11758,7 +11758,7 @@ namespace TL
/// <summary>Users mentioned in constructor</summary>
public Dictionary<long, User> users;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>Information about a <a href="https://corefork.telegram.org/api/threads">message thread</a> <para>See <a href="https://corefork.telegram.org/constructor/messages.discussionMessage"/></para></summary>
@ -11792,7 +11792,7 @@ namespace TL
has_read_outbox_max_id = 0x4,
}
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>Message replies and <a href="https://corefork.telegram.org/api/threads">thread</a> information <para>See <a href="https://corefork.telegram.org/constructor/messageReplyHeader"/></para></summary>
@ -12037,7 +12037,7 @@ namespace TL
/// <summary>Users mentioned in the participants vector</summary>
public Dictionary<long, User> users;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>Info about the participants of a group call or livestream <para>See <a href="https://corefork.telegram.org/constructor/phone.groupParticipants"/></para></summary>
@ -12057,7 +12057,7 @@ namespace TL
/// <summary>Version info</summary>
public int version;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>Type of the chat from which the inline query was sent. <para>See <a href="https://corefork.telegram.org/type/InlineQueryPeerType"/></para></summary>
@ -12244,7 +12244,7 @@ namespace TL
/// <summary>Users mentioned in the peers vector</summary>
public Dictionary<long, User> users;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>An invite to a group call or livestream <para>See <a href="https://corefork.telegram.org/constructor/phone.exportedGroupCallInvite"/></para></summary>
@ -12396,7 +12396,7 @@ namespace TL
/// <summary>Users mentioned in the sponsored messages</summary>
public Dictionary<long, User> users;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary><para>See <a href="https://corefork.telegram.org/constructor/searchResultsCalendarPeriod"/></para></summary>
@ -12435,7 +12435,7 @@ namespace TL
has_offset_id_offset = 0x2,
}
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>Information about a message in a specific position <para>Derived classes: <see cref="SearchResultPosition"/></para> <para>See <a href="https://corefork.telegram.org/type/SearchResultsPosition"/></para></summary>
@ -12468,7 +12468,7 @@ namespace TL
/// <summary>Mentioned users</summary>
public Dictionary<long, User> users;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>Full user information <para>See <a href="https://corefork.telegram.org/constructor/users.userFull"/></para></summary>
@ -12482,7 +12482,7 @@ namespace TL
/// <summary>Mentioned users</summary>
public Dictionary<long, User> users;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>Peer settings <para>See <a href="https://corefork.telegram.org/constructor/messages.peerSettings"/></para></summary>
@ -12496,7 +12496,7 @@ namespace TL
/// <summary>Mentioned users</summary>
public Dictionary<long, User> users;
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>Authentication token to be used on subsequent authorizations <para>See <a href="https://corefork.telegram.org/constructor/auth.loggedOut"/></para></summary>
@ -12578,7 +12578,7 @@ namespace TL
has_next_offset = 0x1,
}
/// <summary>returns a <see cref="User"/> or <see cref="ChatBase"/> for the given Peer</summary>
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
/// <summary>Animations associated with a message reaction <para>See <a href="https://corefork.telegram.org/constructor/availableReaction"/></para></summary>