mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2025-12-06 06:52:01 +01:00
coherent null behaviour for UserOrChat helpers
This commit is contained in:
parent
4d8c0843d9
commit
1ffbca1b51
Binary file not shown.
1
FAQ.md
1
FAQ.md
|
|
@ -100,6 +100,7 @@ You can get these kind of problems if you abuse Telegram [Terms of Service](http
|
|||
|
||||
You can try to wait more between the requests, wait for a day or two to see if the requests become possible again.
|
||||
>ℹ️ For FLOOD_WAIT_X with X < 60 seconds (see `client.FloodRetryThreshold`), WTelegramClient will automatically wait the specified delay and retry the request for you.
|
||||
For longer delays, you can catch the thrown `RpcException` and check the value of property X.
|
||||
|
||||
An account that was restricted due to reported spam might receive PEER_FLOOD errors. Read [Telegram Spam FAQ](https://telegram.org/faq_spam) to learn more.
|
||||
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ namespace TL
|
|||
}
|
||||
}
|
||||
|
||||
partial class Contacts_Blocked { public IPeerInfo UserOrChat(PeerBlocked peer) => peer.peer_id.UserOrChat(users, chats); }
|
||||
partial class Contacts_Blocked { public IPeerInfo UserOrChat(PeerBlocked peer) => peer.peer_id?.UserOrChat(users, chats); }
|
||||
partial class Messages_DialogsBase { public IPeerInfo UserOrChat(DialogBase dialog) => UserOrChat(dialog.Peer);
|
||||
public abstract int TotalCount { get; } }
|
||||
partial class Messages_Dialogs { public override int TotalCount => dialogs.Length; }
|
||||
|
|
@ -437,7 +437,7 @@ namespace TL
|
|||
|
||||
partial class Contacts_ResolvedPeer
|
||||
{
|
||||
public static implicit operator InputPeer(Contacts_ResolvedPeer resolved) => resolved.UserOrChat.ToInputPeer();
|
||||
public static implicit operator InputPeer(Contacts_ResolvedPeer resolved) => resolved?.UserOrChat.ToInputPeer();
|
||||
/// <returns>A <see cref="TL.User"/>, or <see langword="null"/> if the username was for a channel</returns>
|
||||
public User User => peer is PeerUser pu ? users[pu.user_id] : null;
|
||||
/// <returns>A <see cref="Channel"/> or <see cref="ChannelForbidden"/>, or <see langword="null"/> if the username was for a user</returns>
|
||||
|
|
@ -493,7 +493,7 @@ namespace TL
|
|||
partial class ChannelParticipantBanned { public override long UserID => peer is PeerUser pu ? pu.user_id : 0; }
|
||||
partial class ChannelParticipantLeft { public override long UserID => peer is PeerUser pu ? pu.user_id : 0; }
|
||||
|
||||
partial class Messages_PeerDialogs { public IPeerInfo UserOrChat(DialogBase dialog) => dialog.Peer.UserOrChat(users, chats); }
|
||||
partial class Messages_PeerDialogs { public IPeerInfo UserOrChat(DialogBase dialog) => dialog.Peer?.UserOrChat(users, chats); }
|
||||
|
||||
partial class WebDocument { public static implicit operator InputWebFileLocation(WebDocument doc) => new() { url = doc.url, access_hash = doc.access_hash }; }
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue