added InputUserBase.UserId helper property

This commit is contained in:
Wizou 2022-03-23 13:50:43 +01:00
parent b31c9b4366
commit 073056c079
3 changed files with 18 additions and 8 deletions

View file

@ -46,6 +46,8 @@ namespace WTelegram
public bool IsMainDC => (_dcSession?.DataCenter?.id ?? 0) == _session.MainDC;
/// <summary>Has this Client established connection been disconnected?</summary>
public bool Disconnected => _tcpClient != null && !(_tcpClient.Client?.Connected ?? false);
/// <summary>ID of the current logged-in user or 0</summary>
public long UserId => _session.UserId;
/// <summary>Used to indicate progression of file download/upload</summary>
/// <param name="totalSize">total size of file in bytes, or 0 if unknown</param>

View file

@ -14,11 +14,19 @@ namespace TL
InputPeer ToInputPeer();
}
partial class InputPeer { public static InputPeerSelf Self => new(); }
partial class InputUser { public static InputUserSelf Self => new(); }
partial class InputPeerChannel { public static implicit operator InputChannel(InputPeerChannel channel) => new() { channel_id = channel.channel_id, access_hash = channel.access_hash }; }
partial class InputPeerUser { public static implicit operator InputUser(InputPeerUser user) => new() { user_id = user.user_id, access_hash = user.access_hash }; }
partial class InputUser { public static implicit operator InputPeerUser(InputUser user) => new() { user_id = user.user_id, access_hash = user.access_hash }; }
partial class InputPeer { public static InputPeerSelf Self => new(); }
partial class InputPeerChannel { public static implicit operator InputChannel(InputPeerChannel channel) => new() { channel_id = channel.channel_id, access_hash = channel.access_hash }; }
partial class InputPeerUser { public static implicit operator InputUser(InputPeerUser user) => new() { user_id = user.user_id, access_hash = user.access_hash }; }
partial class InputUserBase { public abstract long? UserId { get; } }
partial class InputUserSelf { public override long? UserId => null; }
partial class InputUserFromMessage { public override long? UserId => user_id; }
partial class InputUser
{
public override long? UserId => user_id;
public static InputUserSelf Self => new();
public static implicit operator InputPeerUser(InputUser user) => new() { user_id = user.user_id, access_hash = user.access_hash };
}
partial class InputFileBase
{

View file

@ -87,10 +87,10 @@ namespace TL
/// <summary>Defines a user for subsequent interaction. <para>Derived classes: <see cref="InputUserSelf"/>, <see cref="InputUser"/>, <see cref="InputUserFromMessage"/></para> <para>See <a href="https://corefork.telegram.org/type/InputUser"/></para></summary>
/// <remarks>a <c>null</c> value means <a href="https://corefork.telegram.org/constructor/inputUserEmpty">inputUserEmpty</a></remarks>
public abstract class InputUserBase : IObject { }
public abstract partial class InputUserBase : IObject { }
/// <summary>Defines the current user. <para>See <a href="https://corefork.telegram.org/constructor/inputUserSelf"/></para></summary>
[TLDef(0xF7C1B13F)]
public class InputUserSelf : InputUserBase { }
public partial class InputUserSelf : InputUserBase { }
/// <summary>Defines a user for further interaction. <para>See <a href="https://corefork.telegram.org/constructor/inputUser"/></para></summary>
[TLDef(0xF21158C6)]
public partial class InputUser : InputUserBase
@ -102,7 +102,7 @@ namespace TL
}
/// <summary>Defines a <a href="https://corefork.telegram.org/api/min">min</a> user that was seen in a certain message of a certain chat. <para>See <a href="https://corefork.telegram.org/constructor/inputUserFromMessage"/></para></summary>
[TLDef(0x1DA448E2)]
public class InputUserFromMessage : InputUserBase
public partial class InputUserFromMessage : InputUserBase
{
/// <summary>The chat where the user was seen</summary>
public InputPeer peer;