diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs
index ff9e5d7..f500746 100644
--- a/Examples/Program_ListenUpdates.cs
+++ b/Examples/Program_ListenUpdates.cs
@@ -80,7 +80,6 @@ namespace WTelegramClientTest
case UpdateEditMessage uem: Console.Write("(Edit): "); DisplayMessage(uem.message); break;
case UpdateDeleteChannelMessages udcm: Console.WriteLine($"{udcm.messages.Length} message(s) deleted in {AChat(udcm.channel_id)}"); break;
case UpdateDeleteMessages udm: Console.WriteLine($"{udm.messages.Length} message(s) deleted"); break;
- case UpdateEditChannelMessage uecm: Console.Write("(Edit): "); DisplayMessage(uecm.message); break;
case UpdateUserTyping uut: Console.WriteLine($"{AUser(uut.user_id)} is {uut.action.GetType().Name[11..^6]}"); break;
case UpdateChatUserTyping ucut: Console.WriteLine($"{APeer(ucut.from_id)} is {ucut.action.GetType().Name[11..^6]} in {AChat(ucut.chat_id)}"); break;
case UpdateChannelUserTyping ucut2: Console.WriteLine($"{APeer(ucut2.from_id)} is {ucut2.action.GetType().Name[11..^6]} in {AChat(ucut2.channel_id)}"); break;
diff --git a/src/Generator.cs b/src/Generator.cs
index aa4aec3..c5c0189 100644
--- a/src/Generator.cs
+++ b/src/Generator.cs
@@ -231,9 +231,8 @@ namespace WTelegram
var genericType = typeInfo.ReturnName.Length == 1 ? $"<{typeInfo.ReturnName}>" : null;
bool needNewLine = true;
int commonFields = 0;
- for (int i = 0; i < typeInfo.Structs.Count; i++)
+ foreach (var ctor in typeInfo.Structs)
{
- var ctor = typeInfo.Structs[i];
if (ctor.layer != layer) continue;
int ctorId = ctor.ID;
string className = CSharpName(ctor.predicate) + genericType;
@@ -267,12 +266,12 @@ namespace WTelegram
}
else
{
- for (int j = i - 1; j >= 0; j--)
+ foreach (var other in typeInfo.Structs)
{
- var otherParams = typeInfo.Structs[j].@params;
+ if (other == ctor) continue;
+ var otherParams = other.@params;
if (otherParams.Length <= commonFields) continue;
- var otherPredicate = typeInfo.Structs[j].predicate;
- if (!IsDerivedName(ctor.predicate, otherPredicate)) continue;
+ if (!IsDerivedName(ctor.predicate, other.predicate)) continue;
if (HasPrefix(ctor, otherParams))
{
parms = ctor.@params.Skip(otherParams.Length).ToArray();
@@ -283,10 +282,9 @@ namespace WTelegram
parms = ctor.@params.Take(ctor.@params.Length - otherParams.Length).ToArray();
tldefReverse = ", inheritAfter = true";
}
-
else continue;
commonFields = otherParams.Length;
- parentClass = CSharpName(otherPredicate) + genericType;
+ parentClass = CSharpName(other.predicate) + genericType;
}
}
if (currentJson != "TL.MTProto")
diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs
index 18d5e73..fd5e6fd 100644
--- a/src/TL.Schema.cs
+++ b/src/TL.Schema.cs
@@ -1491,9 +1491,8 @@ namespace TL
}
///See
[TLDef(0x83487AF0)]
- public partial class UpdateChatUserTyping : Update
+ public partial class UpdateChatUserTyping : UpdateChat
{
- public long chat_id;
public Peer from_id;
public SendMessageAction action;
}
@@ -1552,9 +1551,8 @@ namespace TL
}
///See
[TLDef(0x3DDA5451)]
- public partial class UpdateChatParticipantAdd : Update
+ public partial class UpdateChatParticipantAdd : UpdateChat
{
- public long chat_id;
public long user_id;
public long inviter_id;
public DateTime date;
@@ -1562,9 +1560,8 @@ namespace TL
}
///See
[TLDef(0xE32F3D77)]
- public partial class UpdateChatParticipantDelete : Update
+ public partial class UpdateChatParticipantDelete : UpdateChat
{
- public long chat_id;
public long user_id;
public int version;
}
@@ -1681,9 +1678,8 @@ namespace TL
}
///See
[TLDef(0xD7CA61A2)]
- public partial class UpdateChatParticipantAdmin : Update
+ public partial class UpdateChatParticipantAdmin : UpdateChat
{
- public long chat_id;
public long user_id;
public bool is_admin;
public int version;
@@ -1732,12 +1728,7 @@ namespace TL
}
///See
[TLDef(0x1B3F4DF7)]
- public partial class UpdateEditChannelMessage : Update
- {
- public MessageBase message;
- public int pts;
- public int pts_count;
- }
+ public partial class UpdateEditChannelMessage : UpdateEditMessage { }
///See
[TLDef(0xB9CFC48D)]
public partial class UpdateBotCallbackQuery : Update