mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2025-12-06 06:52:01 +01:00
More helpers (reordered), notably UserOrChat
This commit is contained in:
parent
08ba766e5c
commit
c9ccaf2d17
|
|
@ -76,14 +76,14 @@ if (dialogsBase is Messages_Dialogs dialogs)
|
|||
while (dialogs.dialogs.Length != 0)
|
||||
{
|
||||
foreach (var dialog in dialogs.dialogs)
|
||||
switch (dialogs.GetUserOrChat(dialog))
|
||||
switch (dialogs.UserOrChat(dialog))
|
||||
{
|
||||
case UserBase 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.GetUserOrChat(lastDialog).ToInputPeer();
|
||||
var offsetPeer = dialogs.UserOrChat(lastDialog).ToInputPeer();
|
||||
dialogs = (Messages_Dialogs)await client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.TopMessage, offsetPeer, 500, 0);
|
||||
}
|
||||
```
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace WTelegramClientTest
|
|||
foreach (var (id, chat) in dialogs.chats) chats[id] = chat;
|
||||
var lastDialog = dialogs.dialogs[^1];
|
||||
var lastMsg = dialogs.messages.LastOrDefault(m => m.Peer.ID == lastDialog.Peer.ID && m.ID == lastDialog.TopMessage);
|
||||
var offsetPeer = dialogs.GetUserOrChat(lastDialog).ToInputPeer();
|
||||
var offsetPeer = dialogs.UserOrChat(lastDialog).ToInputPeer();
|
||||
dialogs = (Messages_Dialogs)await client.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.TopMessage, offsetPeer, 500, 0);
|
||||
}
|
||||
Console.ReadKey();
|
||||
|
|
|
|||
|
|
@ -180,6 +180,7 @@ namespace WTelegram
|
|||
typeInfo.Structs.Insert(0, typeInfo.MainClass);
|
||||
typeInfo.ReturnName = typeInfo.MainClass.predicate;
|
||||
}
|
||||
typeInfo.AbstractUserOrChat = AbstractUserOrChatTypes.Contains(typeInfo.ReturnName);
|
||||
}
|
||||
}
|
||||
var layers = schema.constructors.Select(c => c.layer).Distinct().ToList();
|
||||
|
|
@ -320,14 +321,14 @@ namespace WTelegram
|
|||
}
|
||||
sw.Write(" : ");
|
||||
sw.Write(parentClass);
|
||||
if (parms.Length == 0)
|
||||
if (parms.Length == 0 && !typeInfo.AbstractUserOrChat)
|
||||
{
|
||||
sw.WriteLine(" { }");
|
||||
commonFields = typeInfo.CommonFields;
|
||||
continue;
|
||||
}
|
||||
var hasFlagEnum = parms.Any(p => p.type.StartsWith("flags."));
|
||||
bool multiline = hasFlagEnum || parms.Length > 1;
|
||||
bool multiline = hasFlagEnum || parms.Length > 1 || typeInfo.AbstractUserOrChat;
|
||||
if (multiline)
|
||||
{
|
||||
sw.WriteLine();
|
||||
|
|
@ -380,6 +381,20 @@ namespace WTelegram
|
|||
}
|
||||
if (multiline) sw.WriteLine();
|
||||
}
|
||||
var hasUsersChats = parms.Contains(ParamUsers) && parms.Contains(ParamChats);
|
||||
if (hasUsersChats || (typeInfo.AbstractUserOrChat && (ctor == typeInfo.MainClass || parentClass == typeInfo.ReturnName)))
|
||||
{
|
||||
var modifier = !typeInfo.AbstractUserOrChat ? null : ctorId == 0 ? "abstract " : "override ";
|
||||
sw.Write($"{tabIndent}\tpublic {modifier}IPeerInfo UserOrChat");
|
||||
if (!hasUsersChats || ctor.@params.Length != 3 || !parms.Contains(ParamPeer))
|
||||
sw.Write("(Peer peer)");
|
||||
if (modifier == "abstract ")
|
||||
sw.WriteLine(";");
|
||||
else if (hasUsersChats)
|
||||
sw.WriteLine(" => peer.UserOrChat(users, chats);");
|
||||
else
|
||||
sw.WriteLine(" => null;");
|
||||
}
|
||||
|
||||
if (multiline)
|
||||
sw.WriteLine(tabIndent + "}");
|
||||
|
|
@ -388,6 +403,12 @@ namespace WTelegram
|
|||
commonFields = typeInfo.CommonFields;
|
||||
}
|
||||
}
|
||||
static readonly Param ParamPeer = new() { name = "peer", type = "Peer" };
|
||||
static readonly Param ParamUsers = new() { name = "users", type = "Vector<User>" };
|
||||
static readonly Param ParamChats = new() { name = "chats", type = "Vector<Chat>" };
|
||||
static readonly HashSet<string> AbstractUserOrChatTypes = new() {
|
||||
"Messages_MessagesBase", "Updates_DifferenceBase", "Updates_ChannelDifferenceBase"
|
||||
};
|
||||
|
||||
private static bool IsDerivedName(string derived, string basename)
|
||||
{
|
||||
|
|
@ -715,6 +736,7 @@ namespace WTelegram
|
|||
public List<Constructor> Structs = new();
|
||||
internal int CommonFields; // n fields are common among all those classes
|
||||
internal bool AsEnum;
|
||||
internal bool AbstractUserOrChat;
|
||||
}
|
||||
|
||||
#pragma warning disable IDE1006 // Naming Styles
|
||||
|
|
@ -739,6 +761,8 @@ namespace WTelegram
|
|||
{
|
||||
public string name { get; set; }
|
||||
public string type { get; set; }
|
||||
public override bool Equals(object obj) => obj is Param other && other.name == name && other.type == type;
|
||||
public override int GetHashCode() => HashCode.Combine(name, type);
|
||||
}
|
||||
|
||||
public class Method
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
|
@ -6,15 +7,82 @@ using System.Web;
|
|||
|
||||
namespace TL
|
||||
{
|
||||
partial class InputPeer { public static InputPeerSelf Self => new(); }
|
||||
partial class InputUser { public static InputUserSelf Self => new(); }
|
||||
|
||||
public interface IPeerInfo {
|
||||
public interface IPeerInfo
|
||||
{
|
||||
long ID { get; }
|
||||
bool IsActive { get; }
|
||||
InputPeer ToInputPeer();
|
||||
}
|
||||
|
||||
partial class InputPeer { public static InputPeerSelf Self => new(); }
|
||||
partial class InputUser { public static InputUserSelf Self => new(); }
|
||||
|
||||
partial class InputFileBase
|
||||
{
|
||||
public abstract InputEncryptedFileBase ToInputEncryptedFile(int key_fingerprint);
|
||||
public abstract InputSecureFileBase ToInputSecureFile(byte[] file_hash, byte[] secret);
|
||||
}
|
||||
partial class InputFile
|
||||
{
|
||||
public override InputEncryptedFileBase ToInputEncryptedFile(int key_fingerprint) => new InputEncryptedFileUploaded { id = id, parts = parts, md5_checksum = md5_checksum, key_fingerprint = key_fingerprint };
|
||||
public override InputSecureFileBase ToInputSecureFile(byte[] file_hash, byte[] secret) => new InputSecureFileUploaded { id = id, parts = parts, md5_checksum = md5_checksum, file_hash = file_hash, secret = secret };
|
||||
}
|
||||
partial class InputFileBig
|
||||
{
|
||||
public override InputEncryptedFileBase ToInputEncryptedFile(int key_fingerprint) => new InputEncryptedFileBigUploaded { id = id, parts = parts, key_fingerprint = key_fingerprint };
|
||||
public override InputSecureFileBase ToInputSecureFile(byte[] file_hash, byte[] secret) => new InputSecureFileUploaded { id = id, parts = parts, file_hash = file_hash, secret = secret };
|
||||
}
|
||||
|
||||
partial class Peer
|
||||
{
|
||||
public abstract long ID { get; }
|
||||
abstract internal IPeerInfo UserOrChat(Dictionary<long, UserBase> users, Dictionary<long, ChatBase> chats);
|
||||
}
|
||||
partial class PeerUser
|
||||
{
|
||||
public override string ToString() => "user " + user_id;
|
||||
public override long ID => user_id;
|
||||
internal override IPeerInfo UserOrChat(Dictionary<long, UserBase> users, Dictionary<long, ChatBase> chats) => users[user_id];
|
||||
}
|
||||
partial class PeerChat
|
||||
{
|
||||
public override string ToString() => "chat " + chat_id;
|
||||
public override long ID => chat_id;
|
||||
internal override IPeerInfo UserOrChat(Dictionary<long, UserBase> users, Dictionary<long, ChatBase> chats) => chats[chat_id];
|
||||
}
|
||||
partial class PeerChannel
|
||||
{
|
||||
public override string ToString() => "channel " + channel_id;
|
||||
public override long ID => channel_id;
|
||||
internal override IPeerInfo UserOrChat(Dictionary<long, UserBase> users, Dictionary<long, ChatBase> chats) => chats[channel_id];
|
||||
}
|
||||
|
||||
partial class UserBase : IPeerInfo
|
||||
{
|
||||
public abstract long ID { get; }
|
||||
public abstract bool IsActive { get; }
|
||||
public abstract InputPeer ToInputPeer();
|
||||
protected abstract InputUserBase ToInputUser();
|
||||
public static implicit operator InputPeer(UserBase user) => user.ToInputPeer();
|
||||
public static implicit operator InputUserBase(UserBase user) => user.ToInputUser();
|
||||
}
|
||||
partial class UserEmpty
|
||||
{
|
||||
public override long ID => id;
|
||||
public override bool IsActive => false;
|
||||
public override string ToString() => null;
|
||||
public override InputPeer ToInputPeer() => null;
|
||||
protected override InputUserBase ToInputUser() => null;
|
||||
}
|
||||
partial class User
|
||||
{
|
||||
public override long ID => id;
|
||||
public override bool IsActive => (flags & Flags.deleted) == 0;
|
||||
public override string ToString() => username != null ? '@' + username : last_name == null ? first_name : $"{first_name} {last_name}";
|
||||
public override InputPeer ToInputPeer() => new InputPeerUser { user_id = id, access_hash = access_hash };
|
||||
protected override InputUserBase ToInputUser() => new InputUser { user_id = id, access_hash = access_hash };
|
||||
}
|
||||
|
||||
partial class ChatBase : IPeerInfo
|
||||
{
|
||||
public abstract long ID { get; }
|
||||
|
|
@ -73,79 +141,24 @@ namespace TL
|
|||
public override string ToString() => $"ChannelForbidden {id} \"{title}\"";
|
||||
}
|
||||
|
||||
partial class UserBase : IPeerInfo
|
||||
partial class ChatParticipantBase
|
||||
{
|
||||
public abstract long ID { get; }
|
||||
public abstract bool IsActive { get; }
|
||||
public abstract InputPeer ToInputPeer();
|
||||
protected abstract InputUserBase ToInputUser();
|
||||
public static implicit operator InputPeer(UserBase user) => user.ToInputPeer();
|
||||
public static implicit operator InputUserBase(UserBase user) => user.ToInputUser();
|
||||
public abstract long UserId { get; }
|
||||
public abstract bool IsAdmin { get; }
|
||||
}
|
||||
partial class UserEmpty
|
||||
partial class ChatParticipant
|
||||
{
|
||||
public override long ID => id;
|
||||
public override bool IsActive => false;
|
||||
public override string ToString() => null;
|
||||
public override InputPeer ToInputPeer() => null;
|
||||
protected override InputUserBase ToInputUser() => null;
|
||||
public override long UserId => user_id;
|
||||
public override bool IsAdmin => false;
|
||||
}
|
||||
partial class User
|
||||
partial class ChatParticipantCreator
|
||||
{
|
||||
public override long ID => id;
|
||||
public override bool IsActive => (flags & Flags.deleted) == 0;
|
||||
public override string ToString() => username != null ? '@' + username : last_name == null ? first_name : $"{first_name} {last_name}";
|
||||
public override InputPeer ToInputPeer() => new InputPeerUser { user_id = id, access_hash = access_hash };
|
||||
protected override InputUserBase ToInputUser() => new InputUser { user_id = id, access_hash = access_hash };
|
||||
public override long UserId => user_id;
|
||||
public override bool IsAdmin => true;
|
||||
}
|
||||
|
||||
partial class Peer { public abstract long ID { get; } }
|
||||
partial class PeerUser { public override long ID => user_id; public override string ToString() => "user " + user_id; }
|
||||
partial class PeerChat { public override long ID => chat_id; public override string ToString() => "chat " + chat_id; }
|
||||
partial class PeerChannel { public override long ID => channel_id; public override string ToString() => "channel " + channel_id; }
|
||||
|
||||
partial class Contacts_ResolvedPeer
|
||||
partial class ChatParticipantAdmin
|
||||
{
|
||||
public static implicit operator InputPeer(Contacts_ResolvedPeer resolved) => resolved.UserOrChat.ToInputPeer();
|
||||
public UserBase User => peer is PeerUser pu ? users[pu.user_id] : null;
|
||||
public ChatBase Chat => peer is PeerChat or PeerChannel ? chats[peer.ID] : null;
|
||||
public IPeerInfo UserOrChat => peer switch
|
||||
{
|
||||
PeerUser pu => users[pu.user_id],
|
||||
PeerChat pc => chats[pc.chat_id],
|
||||
PeerChannel pch => chats[pch.channel_id],
|
||||
_ => null
|
||||
};
|
||||
}
|
||||
|
||||
partial class DialogBase
|
||||
{
|
||||
public abstract Peer Peer { get; }
|
||||
public abstract int TopMessage { get; }
|
||||
}
|
||||
partial class Dialog
|
||||
{
|
||||
public override Peer Peer => peer;
|
||||
public override int TopMessage => top_message;
|
||||
}
|
||||
partial class DialogFolder
|
||||
{
|
||||
public override Peer Peer => peer;
|
||||
public override int TopMessage => top_message;
|
||||
}
|
||||
|
||||
partial class Messages_Dialogs
|
||||
{
|
||||
/// <summary>Find the matching User/Chat object for a dialog</summary>
|
||||
/// <param name="dialog">The dialog which peer we want details on</param>
|
||||
/// <returns>a UserBase or ChatBase derived instance</returns>
|
||||
public IPeerInfo GetUserOrChat(DialogBase dialog) => dialog.Peer switch
|
||||
{
|
||||
PeerUser pu => users[pu.user_id],
|
||||
PeerChat pc => chats[pc.chat_id],
|
||||
PeerChannel pch => chats[pch.channel_id],
|
||||
_ => null,
|
||||
};
|
||||
public override bool IsAdmin => true;
|
||||
}
|
||||
|
||||
partial class MessageBase
|
||||
|
|
@ -173,6 +186,22 @@ namespace TL
|
|||
public override DateTime Date => date;
|
||||
}
|
||||
|
||||
partial class DialogBase
|
||||
{
|
||||
public abstract Peer Peer { get; }
|
||||
public abstract int TopMessage { get; }
|
||||
}
|
||||
partial class Dialog
|
||||
{
|
||||
public override Peer Peer => peer;
|
||||
public override int TopMessage => top_message;
|
||||
}
|
||||
partial class DialogFolder
|
||||
{
|
||||
public override Peer Peer => peer;
|
||||
public override int TopMessage => top_message;
|
||||
}
|
||||
|
||||
partial class PhotoBase
|
||||
{
|
||||
public abstract long ID { get; }
|
||||
|
|
@ -261,6 +290,83 @@ namespace TL
|
|||
}
|
||||
}
|
||||
|
||||
partial class Contacts_Blocked { public IPeerInfo UserOrChat(PeerBlocked peer) => peer.peer_id.UserOrChat(users, chats); }
|
||||
|
||||
partial class Messages_Dialogs
|
||||
{
|
||||
/// <summary>Find the matching User/Chat object for a dialog</summary>
|
||||
/// <param name="dialog">The dialog which peer we want details on</param>
|
||||
/// <returns>a UserBase or ChatBase derived instance</returns>
|
||||
public IPeerInfo UserOrChat(DialogBase dialog) => dialog.Peer.UserOrChat(users, chats);
|
||||
}
|
||||
|
||||
partial class Messages_MessagesBase
|
||||
{
|
||||
public abstract int Count { get; }
|
||||
public abstract MessageBase[] Messages { get; }
|
||||
}
|
||||
partial class Messages_Messages
|
||||
{
|
||||
public override int Count => messages.Length;
|
||||
public override MessageBase[] Messages => messages;
|
||||
}
|
||||
partial class Messages_MessagesSlice
|
||||
{
|
||||
public override int Count => count;
|
||||
}
|
||||
partial class Messages_ChannelMessages
|
||||
{
|
||||
public override int Count => count;
|
||||
public override MessageBase[] Messages => messages;
|
||||
}
|
||||
partial class Messages_MessagesNotModified
|
||||
{
|
||||
public override int Count => count;
|
||||
public override MessageBase[] Messages => null;
|
||||
}
|
||||
|
||||
partial class Updates_DifferenceBase
|
||||
{
|
||||
public abstract MessageBase[] NewMessages { get; }
|
||||
public abstract EncryptedMessageBase[] NewEncryptedMessages { get; }
|
||||
public abstract Update[] OtherUpdates { get; }
|
||||
public abstract Updates_State State { get; }
|
||||
}
|
||||
partial class Updates_DifferenceEmpty
|
||||
{
|
||||
public override MessageBase[] NewMessages => Array.Empty<MessageBase>();
|
||||
public override EncryptedMessageBase[] NewEncryptedMessages => Array.Empty<EncryptedMessageBase>();
|
||||
public override Update[] OtherUpdates => Array.Empty<Update>();
|
||||
public override Updates_State State => null;
|
||||
}
|
||||
partial class Updates_Difference
|
||||
{
|
||||
public override MessageBase[] NewMessages => new_messages;
|
||||
public override EncryptedMessageBase[] NewEncryptedMessages => new_encrypted_messages;
|
||||
public override Update[] OtherUpdates => other_updates;
|
||||
public override Updates_State State => state;
|
||||
}
|
||||
partial class Updates_DifferenceSlice
|
||||
{
|
||||
public override MessageBase[] NewMessages => new_messages;
|
||||
public override EncryptedMessageBase[] NewEncryptedMessages => new_encrypted_messages;
|
||||
public override Update[] OtherUpdates => other_updates;
|
||||
public override Updates_State State => intermediate_state;
|
||||
}
|
||||
partial class Updates_DifferenceTooLong
|
||||
{
|
||||
public override MessageBase[] NewMessages => null;
|
||||
public override EncryptedMessageBase[] NewEncryptedMessages => null;
|
||||
public override Update[] OtherUpdates => null;
|
||||
public override Updates_State State => null;
|
||||
}
|
||||
|
||||
partial class EncryptedFile
|
||||
{
|
||||
public static implicit operator InputEncryptedFile(EncryptedFile file) => file == null ? null : new InputEncryptedFile { id = file.id, access_hash = file.access_hash };
|
||||
public InputEncryptedFileLocation ToFileLocation() => new() { id = id, access_hash = access_hash };
|
||||
}
|
||||
|
||||
partial class DocumentBase
|
||||
{
|
||||
public abstract long ID { get; }
|
||||
|
|
@ -279,10 +385,68 @@ namespace TL
|
|||
public InputDocumentFileLocation ToFileLocation(PhotoSizeBase thumbSize = null) => new() { id = id, access_hash = access_hash, file_reference = file_reference, thumb_size = thumbSize?.Type };
|
||||
}
|
||||
|
||||
partial class EncryptedFile
|
||||
partial class SendMessageAction
|
||||
{
|
||||
public static implicit operator InputEncryptedFile(EncryptedFile file) => file == null ? null : new InputEncryptedFile { id = file.id, access_hash = file.access_hash };
|
||||
public InputEncryptedFileLocation ToFileLocation() => new() { id = id, access_hash = access_hash };
|
||||
public override string ToString()
|
||||
{
|
||||
var type = GetType().Name[11..^6];
|
||||
for (int i = 1; i < type.Length; i++)
|
||||
if (char.IsUpper(type[i]))
|
||||
return type.ToLowerInvariant().Insert(i, "ing ");
|
||||
return type.ToLowerInvariant();
|
||||
}
|
||||
}
|
||||
partial class SpeakingInGroupCallAction { public override string ToString() => "speaking in group call"; }
|
||||
partial class SendMessageTypingAction { public override string ToString() => "typing"; }
|
||||
partial class SendMessageCancelAction { public override string ToString() => "stopping"; }
|
||||
partial class SendMessageGeoLocationAction { public override string ToString() => "selecting a location"; }
|
||||
partial class SendMessageGamePlayAction { public override string ToString() => "playing a game"; }
|
||||
partial class SendMessageHistoryImportAction { public override string ToString() => "importing history"; }
|
||||
|
||||
partial class StickerSet
|
||||
{
|
||||
public static implicit operator InputStickerSetID(StickerSet stickerSet) => new() { id = stickerSet.id, access_hash = stickerSet.access_hash };
|
||||
}
|
||||
|
||||
partial class Contacts_ResolvedPeer
|
||||
{
|
||||
public static implicit operator InputPeer(Contacts_ResolvedPeer resolved) => resolved.UserOrChat.ToInputPeer();
|
||||
public UserBase User => peer is PeerUser pu ? users[pu.user_id] : null;
|
||||
public ChatBase Chat => peer is PeerChat or PeerChannel ? chats[peer.ID] : null;
|
||||
}
|
||||
|
||||
partial class Updates_ChannelDifferenceBase
|
||||
{
|
||||
public abstract MessageBase[] NewMessages { get; }
|
||||
public abstract Update[] OtherUpdates { get; }
|
||||
public abstract bool Final { get; }
|
||||
public abstract int Timeout { get; }
|
||||
}
|
||||
partial class Updates_ChannelDifferenceEmpty
|
||||
{
|
||||
public override MessageBase[] NewMessages => Array.Empty<MessageBase>();
|
||||
public override Update[] OtherUpdates => Array.Empty<Update>();
|
||||
public override bool Final => flags.HasFlag(Flags.final);
|
||||
public override int Timeout => timeout;
|
||||
}
|
||||
partial class Updates_ChannelDifference
|
||||
{
|
||||
public override MessageBase[] NewMessages => new_messages;
|
||||
public override Update[] OtherUpdates => other_updates;
|
||||
public override bool Final => flags.HasFlag(Flags.final);
|
||||
public override int Timeout => timeout;
|
||||
}
|
||||
partial class Updates_ChannelDifferenceTooLong
|
||||
{
|
||||
public override MessageBase[] NewMessages => messages;
|
||||
public override Update[] OtherUpdates => null;
|
||||
public override bool Final => flags.HasFlag(Flags.final);
|
||||
public override int Timeout => timeout;
|
||||
}
|
||||
|
||||
partial class Messages_PeerDialogs
|
||||
{
|
||||
public IPeerInfo UserOrChat(DialogBase dialog) => UserOrChat(dialog.Peer);
|
||||
}
|
||||
|
||||
partial class SecureFile
|
||||
|
|
@ -291,27 +455,6 @@ namespace TL
|
|||
public InputSecureFileLocation ToFileLocation() => new() { id = id, access_hash = access_hash };
|
||||
}
|
||||
|
||||
partial class InputFileBase
|
||||
{
|
||||
public abstract InputEncryptedFileBase ToInputEncryptedFile(int key_fingerprint);
|
||||
public abstract InputSecureFileBase ToInputSecureFile(byte[] file_hash, byte[] secret);
|
||||
}
|
||||
partial class InputFile
|
||||
{
|
||||
public override InputEncryptedFileBase ToInputEncryptedFile(int key_fingerprint) => new InputEncryptedFileUploaded { id = id, parts = parts, md5_checksum = md5_checksum, key_fingerprint = key_fingerprint };
|
||||
public override InputSecureFileBase ToInputSecureFile(byte[] file_hash, byte[] secret) => new InputSecureFileUploaded { id = id, parts = parts, md5_checksum = md5_checksum, file_hash = file_hash, secret = secret };
|
||||
}
|
||||
partial class InputFileBig
|
||||
{
|
||||
public override InputEncryptedFileBase ToInputEncryptedFile(int key_fingerprint) => new InputEncryptedFileBigUploaded { id = id, parts = parts, key_fingerprint = key_fingerprint };
|
||||
public override InputSecureFileBase ToInputSecureFile(byte[] file_hash, byte[] secret) => new InputSecureFileUploaded { id = id, parts = parts, file_hash = file_hash, secret = secret };
|
||||
}
|
||||
|
||||
partial class StickerSet
|
||||
{
|
||||
public static implicit operator InputStickerSetID(StickerSet stickerSet) => new() { id = stickerSet.id, access_hash = stickerSet.access_hash };
|
||||
}
|
||||
|
||||
partial class JsonObjectValue { public override string ToString() => $"{HttpUtility.JavaScriptStringEncode(key, true)}:{value}"; }
|
||||
partial class JsonNull { public override string ToString() => "null"; }
|
||||
partial class JsonBool { public override string ToString() => value ? "true" : "false"; }
|
||||
|
|
@ -337,23 +480,4 @@ namespace TL
|
|||
return sb.Append('}').ToString();
|
||||
}
|
||||
}
|
||||
|
||||
partial class SendMessageAction
|
||||
{
|
||||
public override string ToString()
|
||||
{
|
||||
var type = GetType().Name[11..^6];
|
||||
for (int i = 1; i < type.Length; i++)
|
||||
if (char.IsUpper(type[i]))
|
||||
return type.ToLowerInvariant().Insert(i, "ing ");
|
||||
return type.ToLowerInvariant();
|
||||
}
|
||||
}
|
||||
partial class SpeakingInGroupCallAction { public override string ToString() => "speaking in group call"; }
|
||||
partial class SendMessageTypingAction { public override string ToString() => "typing"; }
|
||||
partial class SendMessageCancelAction { public override string ToString() => "stopping"; }
|
||||
partial class SendMessageGeoLocationAction { public override string ToString() => "selecting a location"; }
|
||||
partial class SendMessageGamePlayAction { public override string ToString() => "playing a game"; }
|
||||
partial class SendMessageHistoryImportAction{ public override string ToString() => "importing history"; }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1278,6 +1278,7 @@ namespace TL
|
|||
public PeerBlocked[] blocked;
|
||||
public Dictionary<long, ChatBase> chats;
|
||||
public Dictionary<long, UserBase> users;
|
||||
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/contacts.blockedSlice"/></summary>
|
||||
[TLDef(0xE1664194, inheritAfter = true)]
|
||||
|
|
@ -1293,6 +1294,7 @@ namespace TL
|
|||
public MessageBase[] messages;
|
||||
public Dictionary<long, ChatBase> chats;
|
||||
public Dictionary<long, UserBase> users;
|
||||
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/messages.dialogsSlice"/></summary>
|
||||
[TLDef(0x71E094F3, inheritAfter = true)]
|
||||
|
|
@ -1302,7 +1304,10 @@ namespace TL
|
|||
public partial class Messages_DialogsNotModified : Messages_DialogsBase { public int count; }
|
||||
|
||||
///<summary>See <a href="https://corefork.telegram.org/type/messages.Messages"/></summary>
|
||||
public abstract partial class Messages_MessagesBase : ITLObject { }
|
||||
public abstract partial class Messages_MessagesBase : ITLObject
|
||||
{
|
||||
public abstract IPeerInfo UserOrChat(Peer peer);
|
||||
}
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/messages.messages"/></summary>
|
||||
[TLDef(0x8C718E87)]
|
||||
public partial class Messages_Messages : Messages_MessagesBase
|
||||
|
|
@ -1310,6 +1315,7 @@ namespace TL
|
|||
public MessageBase[] messages;
|
||||
public Dictionary<long, ChatBase> chats;
|
||||
public Dictionary<long, UserBase> users;
|
||||
public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/messages.messagesSlice"/></summary>
|
||||
[TLDef(0x3A54685E, inheritAfter = true)]
|
||||
|
|
@ -1333,10 +1339,15 @@ namespace TL
|
|||
public MessageBase[] messages;
|
||||
public Dictionary<long, ChatBase> chats;
|
||||
public Dictionary<long, UserBase> users;
|
||||
public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/messages.messagesNotModified"/></summary>
|
||||
[TLDef(0x74535F21)]
|
||||
public partial class Messages_MessagesNotModified : Messages_MessagesBase { public int count; }
|
||||
public partial class Messages_MessagesNotModified : Messages_MessagesBase
|
||||
{
|
||||
public int count;
|
||||
public override IPeerInfo UserOrChat(Peer peer) => null;
|
||||
}
|
||||
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/messages.chats"/></summary>
|
||||
[TLDef(0x64FF9FD5)]
|
||||
|
|
@ -1352,6 +1363,7 @@ namespace TL
|
|||
public ChatFullBase full_chat;
|
||||
public Dictionary<long, ChatBase> chats;
|
||||
public Dictionary<long, UserBase> users;
|
||||
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/messages.affectedHistory"/></summary>
|
||||
|
|
@ -2088,13 +2100,17 @@ namespace TL
|
|||
}
|
||||
|
||||
///<summary>See <a href="https://corefork.telegram.org/type/updates.Difference"/></summary>
|
||||
public abstract partial class Updates_DifferenceBase : ITLObject { }
|
||||
public abstract partial class Updates_DifferenceBase : ITLObject
|
||||
{
|
||||
public abstract IPeerInfo UserOrChat(Peer peer);
|
||||
}
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/updates.differenceEmpty"/></summary>
|
||||
[TLDef(0x5D75A138)]
|
||||
public partial class Updates_DifferenceEmpty : Updates_DifferenceBase
|
||||
{
|
||||
public DateTime date;
|
||||
public int seq;
|
||||
public override IPeerInfo UserOrChat(Peer peer) => null;
|
||||
}
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/updates.difference"/></summary>
|
||||
[TLDef(0x00F49CA0)]
|
||||
|
|
@ -2106,6 +2122,7 @@ namespace TL
|
|||
public Dictionary<long, ChatBase> chats;
|
||||
public Dictionary<long, UserBase> users;
|
||||
public Updates_State state;
|
||||
public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/updates.differenceSlice"/></summary>
|
||||
[TLDef(0xA8FB1981)]
|
||||
|
|
@ -2117,10 +2134,15 @@ namespace TL
|
|||
public Dictionary<long, ChatBase> chats;
|
||||
public Dictionary<long, UserBase> users;
|
||||
public Updates_State intermediate_state;
|
||||
public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/updates.differenceTooLong"/></summary>
|
||||
[TLDef(0x4AFE8F6D)]
|
||||
public partial class Updates_DifferenceTooLong : Updates_DifferenceBase { public int pts; }
|
||||
public partial class Updates_DifferenceTooLong : Updates_DifferenceBase
|
||||
{
|
||||
public int pts;
|
||||
public override IPeerInfo UserOrChat(Peer peer) => null;
|
||||
}
|
||||
|
||||
///<summary>See <a href="https://corefork.telegram.org/type/Updates"/></summary>
|
||||
public abstract partial class UpdatesBase : ITLObject { }
|
||||
|
|
@ -2183,6 +2205,7 @@ namespace TL
|
|||
public DateTime date;
|
||||
public int seq_start;
|
||||
public int seq;
|
||||
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/updates"/></summary>
|
||||
[TLDef(0x74AE4240)]
|
||||
|
|
@ -2193,6 +2216,7 @@ namespace TL
|
|||
public Dictionary<long, ChatBase> chats;
|
||||
public DateTime date;
|
||||
public int seq;
|
||||
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/updateShortSentMessage"/></summary>
|
||||
[TLDef(0x9015E101)]
|
||||
|
|
@ -2612,6 +2636,7 @@ namespace TL
|
|||
public Peer[] results;
|
||||
public Dictionary<long, ChatBase> chats;
|
||||
public Dictionary<long, UserBase> users;
|
||||
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
|
||||
///<summary>See <a href="https://corefork.telegram.org/type/InputPrivacyKey"/></summary>
|
||||
|
|
@ -2717,6 +2742,7 @@ namespace TL
|
|||
public PrivacyRule[] rules;
|
||||
public Dictionary<long, ChatBase> chats;
|
||||
public Dictionary<long, UserBase> users;
|
||||
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/accountDaysTTL"/></summary>
|
||||
|
|
@ -3232,6 +3258,7 @@ namespace TL
|
|||
public Peer peer;
|
||||
public Dictionary<long, ChatBase> chats;
|
||||
public Dictionary<long, UserBase> users;
|
||||
public IPeerInfo UserOrChat => peer.UserOrChat(users, chats);
|
||||
}
|
||||
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/messageRange"/></summary>
|
||||
|
|
@ -3243,7 +3270,10 @@ namespace TL
|
|||
}
|
||||
|
||||
///<summary>See <a href="https://corefork.telegram.org/type/updates.ChannelDifference"/></summary>
|
||||
public abstract partial class Updates_ChannelDifferenceBase : ITLObject { }
|
||||
public abstract partial class Updates_ChannelDifferenceBase : ITLObject
|
||||
{
|
||||
public abstract IPeerInfo UserOrChat(Peer peer);
|
||||
}
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/updates.channelDifferenceEmpty"/></summary>
|
||||
[TLDef(0x3E11AFFB)]
|
||||
public partial class Updates_ChannelDifferenceEmpty : Updates_ChannelDifferenceBase
|
||||
|
|
@ -3252,6 +3282,7 @@ namespace TL
|
|||
public Flags flags;
|
||||
public int pts;
|
||||
[IfFlag(1)] public int timeout;
|
||||
public override IPeerInfo UserOrChat(Peer peer) => null;
|
||||
}
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/updates.channelDifferenceTooLong"/></summary>
|
||||
[TLDef(0xA4BCC6FE)]
|
||||
|
|
@ -3264,6 +3295,7 @@ namespace TL
|
|||
public MessageBase[] messages;
|
||||
public Dictionary<long, ChatBase> chats;
|
||||
public Dictionary<long, UserBase> users;
|
||||
public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/updates.channelDifference"/></summary>
|
||||
[TLDef(0x2064674E)]
|
||||
|
|
@ -3277,6 +3309,7 @@ namespace TL
|
|||
public Update[] other_updates;
|
||||
public Dictionary<long, ChatBase> chats;
|
||||
public Dictionary<long, UserBase> users;
|
||||
public override IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/channelMessagesFilter"/></summary>
|
||||
|
|
@ -3386,6 +3419,7 @@ namespace TL
|
|||
public ChannelParticipantBase[] participants;
|
||||
public Dictionary<long, ChatBase> chats;
|
||||
public Dictionary<long, UserBase> users;
|
||||
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/channels.channelParticipant"/></summary>
|
||||
|
|
@ -3395,6 +3429,7 @@ namespace TL
|
|||
public ChannelParticipantBase participant;
|
||||
public Dictionary<long, ChatBase> chats;
|
||||
public Dictionary<long, UserBase> users;
|
||||
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/help.termsOfService"/></summary>
|
||||
|
|
@ -3766,6 +3801,7 @@ namespace TL
|
|||
public Dictionary<long, ChatBase> chats;
|
||||
public Dictionary<long, UserBase> users;
|
||||
public Updates_State state;
|
||||
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/topPeer"/></summary>
|
||||
|
|
@ -3816,6 +3852,7 @@ namespace TL
|
|||
public TopPeerCategoryPeers[] categories;
|
||||
public Dictionary<long, ChatBase> chats;
|
||||
public Dictionary<long, UserBase> users;
|
||||
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/contacts.topPeersDisabled"/></summary>
|
||||
[TLDef(0xB52C939D)]
|
||||
|
|
@ -4865,6 +4902,7 @@ namespace TL
|
|||
public ChannelAdminLogEvent[] events;
|
||||
public Dictionary<long, ChatBase> chats;
|
||||
public Dictionary<long, UserBase> users;
|
||||
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/channelAdminLogEventsFilter"/></summary>
|
||||
|
|
@ -4920,6 +4958,7 @@ namespace TL
|
|||
public RecentMeUrl[] urls;
|
||||
public Dictionary<long, ChatBase> chats;
|
||||
public Dictionary<long, UserBase> users;
|
||||
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/inputSingleMedia"/></summary>
|
||||
|
|
@ -5807,6 +5846,7 @@ namespace TL
|
|||
public int[] dates;
|
||||
public Dictionary<long, ChatBase> chats;
|
||||
public Dictionary<long, UserBase> users;
|
||||
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
|
||||
///<summary>See <a href="https://corefork.telegram.org/type/BaseTheme"/></summary>
|
||||
|
|
@ -6031,6 +6071,7 @@ namespace TL
|
|||
public Dictionary<long, UserBase> users;
|
||||
[IfFlag(1)] public string psa_type;
|
||||
[IfFlag(2)] public string psa_message;
|
||||
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/videoSize"/></summary>
|
||||
|
|
@ -6155,6 +6196,7 @@ namespace TL
|
|||
public MessageViews[] views;
|
||||
public Dictionary<long, ChatBase> chats;
|
||||
public Dictionary<long, UserBase> users;
|
||||
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/messages.discussionMessage"/></summary>
|
||||
|
|
@ -6170,6 +6212,7 @@ namespace TL
|
|||
public int unread_count;
|
||||
public Dictionary<long, ChatBase> chats;
|
||||
public Dictionary<long, UserBase> users;
|
||||
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/messageReplyHeader"/></summary>
|
||||
|
|
@ -6275,6 +6318,7 @@ namespace TL
|
|||
public string participants_next_offset;
|
||||
public Dictionary<long, ChatBase> chats;
|
||||
public Dictionary<long, UserBase> users;
|
||||
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/phone.groupParticipants"/></summary>
|
||||
|
|
@ -6287,6 +6331,7 @@ namespace TL
|
|||
public Dictionary<long, ChatBase> chats;
|
||||
public Dictionary<long, UserBase> users;
|
||||
public int version;
|
||||
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
|
||||
///<summary>See <a href="https://corefork.telegram.org/type/InlineQueryPeerType"/></summary>
|
||||
|
|
@ -6399,6 +6444,7 @@ namespace TL
|
|||
public Peer[] peers;
|
||||
public Dictionary<long, ChatBase> chats;
|
||||
public Dictionary<long, UserBase> users;
|
||||
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
|
||||
///<summary>See <a href="https://corefork.telegram.org/constructor/phone.exportedGroupCallInvite"/></summary>
|
||||
|
|
@ -6502,6 +6548,7 @@ namespace TL
|
|||
public SponsoredMessage[] messages;
|
||||
public Dictionary<long, ChatBase> chats;
|
||||
public Dictionary<long, UserBase> users;
|
||||
public IPeerInfo UserOrChat(Peer peer) => peer.UserOrChat(users, chats);
|
||||
}
|
||||
|
||||
// ---functions---
|
||||
|
|
|
|||
Loading…
Reference in a new issue