From 823a4148393798e3b84dc02a424f53a4c2fb5fd0 Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Wed, 15 Jun 2022 12:21:22 +0200
Subject: [PATCH 001/390] Fix possible NullRef with _bareRpc
---
.github/dev.yml | 2 +-
src/Client.cs | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/dev.yml b/.github/dev.yml
index 1bb91a7..def4305 100644
--- a/.github/dev.yml
+++ b/.github/dev.yml
@@ -2,7 +2,7 @@ pr: none
trigger:
- master
-name: 2.5.1-dev.$(Rev:r)
+name: 2.5.2-dev.$(Rev:r)
pool:
vmImage: ubuntu-latest
diff --git a/src/Client.cs b/src/Client.cs
index 507c351..0e1c651 100644
--- a/src/Client.cs
+++ b/src/Client.cs
@@ -630,7 +630,7 @@ namespace WTelegram
}
else if (PullPendingRequest(badMsgNotification.bad_msg_id) is Rpc rpc)
{
- if (_bareRpc.msgId == badMsgNotification.bad_msg_id) _bareRpc = null;
+ if (_bareRpc?.msgId == badMsgNotification.bad_msg_id) _bareRpc = null;
rpc.tcs.SetException(new ApplicationException($"BadMsgNotification {badMsgNotification.error_code}"));
}
else
From 3f84e10f7fc76563561deda6804cb9d4686f5e36 Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Wed, 15 Jun 2022 19:16:11 +0200
Subject: [PATCH 002/390] Heroku example: ignore our own outgoing messages
---
Examples/Program_Heroku.cs | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/Examples/Program_Heroku.cs b/Examples/Program_Heroku.cs
index 2bfe4ca..31890cb 100644
--- a/Examples/Program_Heroku.cs
+++ b/Examples/Program_Heroku.cs
@@ -47,12 +47,13 @@ namespace WTelegramClientTest
{
Console.WriteLine(update.GetType().Name);
if (update is UpdateNewMessage { message: Message { peer_id: PeerUser { user_id: var user_id } } msg }) // private message
- if (Users.TryGetValue(user_id, out var user))
- {
- Console.WriteLine($"New message from {user}: {msg.message}");
- if (msg.message.Equals("Ping", StringComparison.OrdinalIgnoreCase))
- await Client.SendMessageAsync(user, "Pong");
- }
+ if (!msg.flags.HasFlag(Message.Flags.out_)) // ignore our own outgoing messages
+ if (Users.TryGetValue(user_id, out var user))
+ {
+ Console.WriteLine($"New message from {user}: {msg.message}");
+ if (msg.message.Equals("Ping", StringComparison.OrdinalIgnoreCase))
+ await Client.SendMessageAsync(user, "Pong");
+ }
}
}
}
From b1c8d225f2d1a5966430b78b852c399d0817247b Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Fri, 17 Jun 2022 15:12:50 +0200
Subject: [PATCH 003/390] implicit InputStickerSet from string shortName
---
EXAMPLES.md | 6 +++---
src/TL.Helpers.cs | 5 +++++
src/TL.Schema.cs | 2 +-
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/EXAMPLES.md b/EXAMPLES.md
index 547dc5f..517c79f 100644
--- a/EXAMPLES.md
+++ b/EXAMPLES.md
@@ -73,13 +73,13 @@ foreach (var stickerSet in allStickers.sets)
// • Send a random sticker from the user's favorites stickers
var favedStickers = await client.Messages_GetFavedStickers();
var stickerDoc = favedStickers.stickers[new Random().Next(favedStickers.stickers.Length)];
-await client.SendMessageAsync(InputPeer.Self, null, new InputMediaDocument { id = stickerDoc });
+await client.SendMessageAsync(InputPeer.Self, null, stickerDoc);
// • Send a specific sticker given the stickerset shortname and emoticon
-var friendlyPanda = await client.Messages_GetStickerSet(new InputStickerSetShortName { short_name = "Friendly_Panda" });
+var friendlyPanda = await client.Messages_GetStickerSet("Friendly_Panda");
var laughId = friendlyPanda.packs.First(p => p.emoticon == "😂").documents[0];
var laughDoc = friendlyPanda.documents.First(d => d.ID == laughId);
-await client.SendMessageAsync(InputPeer.Self, null, new InputMediaDocument { id = laughDoc });
+await client.SendMessageAsync(InputPeer.Self, null, laughDoc);
// • Send a GIF from an internet URL
await client.SendMessageAsync(InputPeer.Self, null, new InputMediaDocumentExternal
diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs
index d21f5a4..62b2c53 100644
--- a/src/TL.Helpers.cs
+++ b/src/TL.Helpers.cs
@@ -416,6 +416,11 @@ namespace TL
partial class SendMessageEmojiInteraction { public override string ToString() => "clicking on emoji"; }
partial class SendMessageEmojiInteractionSeen { public override string ToString() => "watching emoji reaction"; }
+ partial class InputStickerSet
+ {
+ public static implicit operator InputStickerSet(string shortName) => new InputStickerSetShortName { short_name = shortName };
+ }
+
partial class StickerSet
{
public static implicit operator InputStickerSetID(StickerSet stickerSet) => new() { id = stickerSet.id, access_hash = stickerSet.access_hash };
diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs
index 4237153..924911e 100644
--- a/src/TL.Schema.cs
+++ b/src/TL.Schema.cs
@@ -5954,7 +5954,7 @@ namespace TL
/// Represents a stickerset Derived classes: , , , , See
/// a null value means inputStickerSetEmpty
- public abstract class InputStickerSet : IObject { }
+ public abstract partial class InputStickerSet : IObject { }
/// Stickerset by ID See
[TLDef(0x9DE7A269)]
public class InputStickerSetID : InputStickerSet
From f62051475946a94ab07a6811dffd6be437b0ab91 Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Sun, 19 Jun 2022 18:08:19 +0200
Subject: [PATCH 004/390] fix issue with MTProxy and media dc_id
---
src/Client.cs | 5 +++--
src/Encryption.cs | 1 +
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/Client.cs b/src/Client.cs
index 0e1c651..bb6e5a6 100644
--- a/src/Client.cs
+++ b/src/Client.cs
@@ -355,7 +355,7 @@ namespace WTelegram
internal IObject ReadFrame(byte[] data, int dataLen)
{
- if (dataLen == 4 && data[3] == 0xFF)
+ if (dataLen < 8 && data[3] == 0xFF)
{
int error_code = -BinaryPrimitives.ReadInt32LittleEndian(data);
throw new RpcException(error_code, TransportError(error_code));
@@ -448,6 +448,7 @@ namespace WTelegram
{
404 => "Auth key not found",
429 => "Transport flood",
+ 444 => "Invalid DC",
_ => Enum.GetName(typeof(HttpStatusCode), error_code) ?? "Transport error"
};
}
@@ -708,7 +709,7 @@ namespace WTelegram
if (MTProxyUrl != null)
{
#if OBFUSCATION
- if (!IsMainDC) dcId = -dcId;
+ if (_dcSession.DataCenter?.flags.HasFlag(DcOption.Flags.media_only) == true) dcId = -dcId;
var parms = HttpUtility.ParseQueryString(MTProxyUrl[MTProxyUrl.IndexOf('?')..]);
var server = parms["server"];
int port = int.Parse(parms["port"]);
diff --git a/src/Encryption.cs b/src/Encryption.cs
index 1c65180..9211776 100644
--- a/src/Encryption.cs
+++ b/src/Encryption.cs
@@ -56,6 +56,7 @@ namespace WTelegram
new_nonce = new Int256(RNG),
dc = session.DataCenter?.id ?? 0
};
+ if (session.DataCenter?.flags.HasFlag(DcOption.Flags.media_only) == true) pqInnerData.dc = -pqInnerData.dc;
byte[] encrypted_data = null;
{
//4.1) RSA_PAD(data, server_public_key)
From aad40cf5dfad190320983cd53e8f91092a75aec4 Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Thu, 23 Jun 2022 01:49:07 +0200
Subject: [PATCH 005/390] parameters MessagesFilter filter are optional
---
src/Client.Helpers.cs | 10 +++++++++-
src/TL.Schema.cs | 24 ++++++++++++------------
src/TL.SchemaFuncs.cs | 18 +++++++++---------
3 files changed, 30 insertions(+), 22 deletions(-)
diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs
index 505003e..c0d0b2a 100644
--- a/src/Client.Helpers.cs
+++ b/src/Client.Helpers.cs
@@ -122,7 +122,7 @@ namespace WTelegram
}
}
- /// Search messages with filter and text See
+ /// Search messages in chat with filter and text See
/// See for a list of possible filter types
/// User or chat, histories with which are searched, or constructor for global search
/// Text search request
@@ -131,6 +131,14 @@ namespace WTelegram
public Task Messages_Search(InputPeer peer, string text = null, int offset_id = 0, int limit = int.MaxValue) where T : MessagesFilter, new()
=> this.Messages_Search(peer, text, new T(), offset_id: offset_id, limit: limit);
+ /// Search messages globally with filter and text See
+ /// See for a list of possible filter types
+ /// Text search request
+ /// Only return messages starting from the specified message ID
+ /// Number of results to return
+ public Task Messages_SearchGlobal(string text = null, int offset_id = 0, int limit = int.MaxValue) where T : MessagesFilter, new()
+ => this.Messages_SearchGlobal(text, new T(), offset_id: offset_id, limit: limit);
+
/// Helper function to send a media message more easily
/// Destination of message (chat group, channel, user chat, etc..)
/// Caption for the media (in plain text) or
diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs
index 924911e..1417301 100644
--- a/src/TL.Schema.cs
+++ b/src/TL.Schema.cs
@@ -50,7 +50,7 @@ namespace TL
{
/// User identifier
public long user_id;
- /// ⚠ REQUIRED FIELD. See how to obtain it
access_hash value from the constructor
+ /// ⚠ REQUIRED FIELD. See how to obtain it
access_hash value from the
public long access_hash;
}
/// Defines a channel for further interaction. See
@@ -59,7 +59,7 @@ namespace TL
{
/// Channel identifier
public long channel_id;
- /// ⚠ REQUIRED FIELD. See how to obtain it
access_hash value from the constructor
+ /// ⚠ REQUIRED FIELD. See how to obtain it
access_hash value from the
public long access_hash;
}
/// Defines a min user that was seen in a certain message of a certain chat. See
@@ -97,7 +97,7 @@ namespace TL
{
/// User identifier
public long user_id;
- /// ⚠ REQUIRED FIELD. See how to obtain it
access_hash value from the constructor
+ /// ⚠ REQUIRED FIELD. See how to obtain it
access_hash value from the
public long access_hash;
}
/// Defines a min user that was seen in a certain message of a certain chat. See
@@ -501,7 +501,7 @@ namespace TL
{
/// Photo identifier
public long id;
- /// ⚠ REQUIRED FIELD. See how to obtain it
access_hash value from the constructor
+ /// ⚠ REQUIRED FIELD. See how to obtain it
access_hash value from the
public long access_hash;
/// File reference
public byte[] file_reference;
@@ -537,7 +537,7 @@ namespace TL
{
/// Document ID
public long id;
- /// ⚠ REQUIRED FIELD. See how to obtain it
access_hash parameter from the constructor
+ /// ⚠ REQUIRED FIELD. See how to obtain it
access_hash parameter from the
public long access_hash;
/// File reference
public byte[] file_reference;
@@ -3099,9 +3099,9 @@ namespace TL
{
/// User identifier
public long user_id;
- /// New first name. Corresponds to the new value of real_first_name field of the constructor.
+ /// New first name. Corresponds to the new value of real_first_name field of the .
public string first_name;
- /// New last name. Corresponds to the new value of real_last_name field of the constructor.
+ /// New last name. Corresponds to the new value of real_last_name field of the .
public string last_name;
/// New username.
Parameter added in Layer 18.
public string username;
@@ -5086,7 +5086,7 @@ namespace TL
{
/// Document ID
public long id;
- /// ⚠ REQUIRED FIELD. See how to obtain it
access_hash parameter from the constructor
+ /// ⚠ REQUIRED FIELD. See how to obtain it
access_hash parameter from the
public long access_hash;
/// File reference
public byte[] file_reference;
@@ -6394,7 +6394,7 @@ namespace TL
/// Identifier of the user that was mentioned
public long user_id;
}
- /// Message entity that can be used to create a user user mention: received mentions use the constructor, instead. See
+ /// Message entity that can be used to create a user user mention: received mentions use the , instead. See
[TLDef(0x208E68C9, inheritBefore = true)]
public class InputMessageEntityMentionName : MessageEntity
{
@@ -6436,7 +6436,7 @@ namespace TL
{
/// Channel ID
public long channel_id;
- /// ⚠ REQUIRED FIELD. See how to obtain it
Access hash taken from the constructor
+ /// ⚠ REQUIRED FIELD. See how to obtain it
Access hash taken from the
public long access_hash;
/// Channel ID
@@ -8266,7 +8266,7 @@ namespace TL
[TLDef(0x804361EA)]
public class PageBlockAudio : PageBlock
{
- /// Audio ID (to be fetched from the container constructor
+ /// Audio ID (to be fetched from the container
public long audio_id;
/// Audio caption
public PageCaption caption;
@@ -12581,7 +12581,7 @@ namespace TL
public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats);
}
- /// Information about found messages sent on a specific day, used to split the messages in constructors by days. See
+ /// Information about found messages sent on a specific day, used to split the messages in s by days. See
[TLDef(0xC9B0539F)]
public class SearchResultsCalendarPeriod : IObject
{
diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs
index 6e3ffeb..7e6b6a8 100644
--- a/src/TL.SchemaFuncs.cs
+++ b/src/TL.SchemaFuncs.cs
@@ -961,7 +961,7 @@ namespace TL
});
/// Change authorization settings See Possible codes: 400 (details)
- /// Session ID from the constructor, fetchable using account.getAuthorizations
+ /// Session ID from the , fetchable using account.getAuthorizations
/// Whether to enable or disable receiving encrypted chats: if the flag is not set, the previous setting is not changed
/// Whether to enable or disable receiving calls: if the flag is not set, the previous setting is not changed
public static Task Account_ChangeAuthorizationSettings(this Client client, long hash, bool? encrypted_requests_disabled = default, bool? call_requests_disabled = default)
@@ -1274,7 +1274,7 @@ namespace TL
});
/// Gets back found messages See Possible codes: 400 (details)
- /// User or chat, histories with which are searched, or constructor for global search
+ /// User or chat, histories with which are searched, or for global search
/// Text search request
/// Only return messages sent by the specified user ID
/// Thread ID
@@ -1287,7 +1287,7 @@ namespace TL
/// Maximum message ID to return
/// Minimum message ID to return
/// Hash
- public static Task Messages_Search(this Client client, InputPeer peer, string q, MessagesFilter filter, DateTime min_date = default, DateTime max_date = default, int offset_id = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, long hash = default, InputPeer from_id = null, int? top_msg_id = null)
+ public static Task Messages_Search(this Client client, InputPeer peer, string q, MessagesFilter filter = null, DateTime min_date = default, DateTime max_date = default, int offset_id = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, long hash = default, InputPeer from_id = null, int? top_msg_id = null)
=> client.Invoke(new Messages_Search
{
flags = (Messages_Search.Flags)((from_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x2 : 0)),
@@ -1826,7 +1826,7 @@ namespace TL
/// Offsets for pagination, for more info click here
/// Offsets for pagination, for more info click here
/// Offsets for pagination, for more info click here
- public static Task Messages_SearchGlobal(this Client client, string q, MessagesFilter filter, DateTime min_date = default, DateTime max_date = default, int offset_rate = default, InputPeer offset_peer = null, int offset_id = default, int limit = int.MaxValue, int? folder_id = null)
+ public static Task Messages_SearchGlobal(this Client client, string q, MessagesFilter filter = null, DateTime min_date = default, DateTime max_date = default, int offset_rate = default, InputPeer offset_peer = null, int offset_id = default, int limit = int.MaxValue, int? folder_id = null)
=> client.Invoke(new Messages_SearchGlobal
{
flags = (Messages_SearchGlobal.Flags)(folder_id != null ? 0x1 : 0),
@@ -2936,7 +2936,7 @@ namespace TL
/// Message filter, , filters are not supported by this method.
/// Offsets for pagination, for more info click here
/// Offsets for pagination, for more info click here
- public static Task Messages_GetSearchResultsCalendar(this Client client, InputPeer peer, MessagesFilter filter, int offset_id = default, DateTime offset_date = default)
+ public static Task Messages_GetSearchResultsCalendar(this Client client, InputPeer peer, MessagesFilter filter = null, int offset_id = default, DateTime offset_date = default)
=> client.Invoke(new Messages_GetSearchResultsCalendar
{
peer = peer,
@@ -2950,7 +2950,7 @@ namespace TL
/// Message filter, , filters are not supported by this method.
/// Offsets for pagination, for more info click here
/// Maximum number of results to return, see pagination
- public static Task Messages_GetSearchResultsPositions(this Client client, InputPeer peer, MessagesFilter filter, int offset_id = default, int limit = int.MaxValue)
+ public static Task Messages_GetSearchResultsPositions(this Client client, InputPeer peer, MessagesFilter filter = null, int offset_id = default, int limit = int.MaxValue)
=> client.Invoke(new Messages_GetSearchResultsPositions
{
peer = peer,
@@ -3118,7 +3118,7 @@ namespace TL
/// Optional search query
/// Message filter
/// Maximum number of results to return (max 100).
- public static Task Messages_SearchSentMedia(this Client client, string q, MessagesFilter filter, int limit = int.MaxValue)
+ public static Task Messages_SearchSentMedia(this Client client, string q, MessagesFilter filter = null, int limit = int.MaxValue)
=> client.Invoke(new Messages_SearchSentMedia
{
q = q,
@@ -3429,7 +3429,7 @@ namespace TL
{
});
- /// Get changelog of current app.
Typically, an constructor will be returned, containing one or more updates with app-specific changelogs. See
+ /// Get changelog of current app.
Typically, an will be returned, containing one or more updates with app-specific changelogs. See
/// Previous app version
public static Task Help_GetAppChangelog(this Client client, string prev_app_version)
=> client.Invoke(new Help_GetAppChangelog
@@ -4708,7 +4708,7 @@ namespace TL
});
/// Load channel statistics graph asynchronously See Possible codes: 400 (details)
- /// Graph token from constructor
+ /// Graph token from
/// Zoom value, if required
public static Task Stats_LoadAsyncGraph(this Client client, string token, long? x = null)
=> client.Invoke(new Stats_LoadAsyncGraph
From 4d8c0843d93ef0378784c948d45efe7ea54713d3 Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Thu, 23 Jun 2022 01:51:55 +0200
Subject: [PATCH 006/390] revoke_history always true for DeleteChatUser helpers
(same behavior with channels)
---
src/Client.Helpers.cs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs
index c0d0b2a..9fc14e0 100644
--- a/src/Client.Helpers.cs
+++ b/src/Client.Helpers.cs
@@ -574,16 +574,16 @@ namespace WTelegram
_ => throw new ArgumentException("This method works on Chat & Channel only"),
};
- public Task DeleteChatUser(InputPeer peer, InputUser user, bool revoke_history = true) => peer switch
+ public Task DeleteChatUser(InputPeer peer, InputUser user) => peer switch
{
- InputPeerChat chat => this.Messages_DeleteChatUser(chat.chat_id, user, revoke_history),
+ InputPeerChat chat => this.Messages_DeleteChatUser(chat.chat_id, user, true),
InputPeerChannel channel => this.Channels_EditBanned(channel, user, new ChatBannedRights { flags = ChatBannedRights.Flags.view_messages }),
_ => throw new ArgumentException("This method works on Chat & Channel only"),
};
- public Task LeaveChat(InputPeer peer, bool revoke_history = true) => peer switch
+ public Task LeaveChat(InputPeer peer) => peer switch
{
- InputPeerChat chat => this.Messages_DeleteChatUser(chat.chat_id, InputUser.Self, revoke_history),
+ InputPeerChat chat => this.Messages_DeleteChatUser(chat.chat_id, InputUser.Self, true),
InputPeerChannel channel => this.Channels_LeaveChannel(channel),
_ => throw new ArgumentException("This method works on Chat & Channel only"),
};
From 1ffbca1b515b54520b9a1cb41cd62fad257e9144 Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Sat, 25 Jun 2022 17:05:27 +0200
Subject: [PATCH 007/390] coherent null behaviour for UserOrChat helpers
---
Examples/WinForms_app.zip | Bin 10756 -> 10757 bytes
FAQ.md | 1 +
src/TL.Helpers.cs | 6 +++---
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/Examples/WinForms_app.zip b/Examples/WinForms_app.zip
index e7cbfb3767c6a65eadc0a81b41a2ca9494fbf31a..35c9bc3b686c1063f9263f638706cb9553148eda 100644
GIT binary patch
delta 902
zcmZn(X$|2G@MdNaVE_Tyj++yC4F!Qz2tV76##u}Z41Vkk3<{GOg(N3t@Yd(wG7zbo
zzvX|z&(aA38jIIDX$UaN&*03C&%OH^0yOS2t@YZr
zO4oknTJ8D0dfZDoSol*8-f1e9yPEVwtiE;qUA;BTl5j^EVQ8Y)jqLZ{LXSN
zb6?$dN?%&Av~gk6B}t{I7rV}|EWe*%cr7^KaE^gO?XCYaWWMq(D6VKZ+%Y@3jZ^-Z
z!h@3nm1-6m=4`L!^cH6?<~HbS?k$trUsrKeYROG?R+p9wpS#m7+UID$o3<`i(CQ)A
zv0uCEm$`%pC8az_Kgk=@Jn_!8XU|+B4t%_|V#mvnx0!p6UNH%%ebDuCXRqGYiDpuw
zt@BGftDT!aWJIW{_AJ!YY5TF~!D36p1qZ5l(_N;-x!B*E`psm^&i6?o?UMg0_g=9|
zn)AHrTB1(3lQjFAWg&gu5$UyM0j+oaPAm4+#q{X!{a$ZyJ?&Q1&L`4rf#U0zaozYj
zb>+plh$wC&;coxBl=n8DW_v}-S1<0PS57;AEg9pqxPnHzf|z9s`QJTZg|cA+wpC?dvnXxw`Km(GEz)A8?*FmaPikW=bnc=wppj`
zXb|+l{hYz48*@1Ral2hx{i5gn0bj{!)*_}mS?1U?`ghFz!~P;^k*Lio$)L1^vKITF
z6ONs>j}BkC{=eU8le(wwz*yVN!MsnA8JKP-pHy+=JE0O8zog>^BZQuupee=)Ptudk
zRbBavriFtQh{w+X(jWzs7pTfH@i0$Ll#!Th&&)mfv8o@FDhHIyIXOfvlIgi1oO?kn
zi0Pd;kSjgeUOkk_Ruafmp1f1tkEsU2)X|7#a+3jyngdM|ne4BjF!`H?6eG)ILCt2S
UGKI+#6-*|d(llY)tpdt+0OA^!SpWb4
delta 913
zcmZn-X$j#C@MdNaVE}=ZiKiy=8Vcqmo(f@{8rw@
zk0-5M+IeoOo{x#9_rc7$rI++}vi%Bqnax?BoWZwRWd5|8O)63<63rKzIM_A!vD7Y9
z+3t0p&!B5|;Ya)P+^5?otW5qYwyd+}+Nr4?lMeNlv3)U(c>VEr?VD9!HX2l{t}nUl
zwMM!mVDfdx?TzR5t_ZKSdU1sFwaF5pIagguE-XF$=i2=Q)6n7xnPzg61!ZgB$n$((
zu)V(Fa9929>^9!_%M>0sPJZN4Frkd=*uA;#)1#&?&}A2XyQMC8k00-qJ*q4&Edi%D
zyIZu*sn*S|j}@?bEVS&^?nN#kB1uagE`Kbw=NYScFK@9D&w~o(kUL>oHy*aG5DlJ|
z@!I%;TT=Kmujqtuzo@ta$6j~uJ@qE-U69OQi`nzC&%Xys_|1ucj@Cb_GgMuvGr^W{Qvd>U!1e`4bEI4`^`QEk+;J=f9pkEe_Qh_dV7p8
zXUoJ%_lw&mzCYXfV1GiAO?TLDo;%AH?&}Ja_I~ks`7z_9wEqiBErW&LE!CDVx?sJ{
z{?~*fU;D$Co1Cvdo+@O2S-Erm|IM7t`xKdhsdw@z6-VCn8|1fas=2`krY9$8igUsf
z^kfTFS8j<9j71>%8wWxr$7xDVo}k7uS&EsDR|T90fXN+5b5A~?TEwKnG1-wrXL5p?
zAJa2IAX9PjMYSNNx8gvi#AI9b2qqgzFmr<>_vBsbeoWOcuGC~34L>GV8My3vjU*;!
Yc_c39WP8mprcwp4(0a`Pwq0QB0c>lT!Tℹ️ 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.
diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs
index 62b2c53..e8ad355 100644
--- a/src/TL.Helpers.cs
+++ b/src/TL.Helpers.cs
@@ -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();
/// A , or if the username was for a channel
public User User => peer is PeerUser pu ? users[pu.user_id] : null;
/// A or , or if the username was for a user
@@ -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 }; }
From 08f58e3d0a028c8838a64b547f86aaa8b3431cdf Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Fri, 1 Jul 2022 12:18:13 +0200
Subject: [PATCH 008/390] Fixed "ignoring old msg_id" warnings on session start
---
EXAMPLES.md | 15 +++++++++++++--
FAQ.md | 2 +-
src/Session.cs | 4 +++-
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/EXAMPLES.md b/EXAMPLES.md
index 517c79f..22d3cc2 100644
--- a/EXAMPLES.md
+++ b/EXAMPLES.md
@@ -123,7 +123,7 @@ 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_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.
+- The list returned by Messages_GetAllChats contains the `access_hash` for those chats. Read [FAQ #4](FAQ.md#access-hash) about this.
- If a basic 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).
- You can find a longer version of this method call in [Examples/Program_GetAllChats.cs](Examples/Program_GetAllChats.cs)
@@ -217,12 +217,23 @@ var participants = await client.Channels_GetAllParticipants(channel);
```
-### Join a channel/group by @channelname
+### Join a channel/group by their public name or invite link
+* For a public channel/group `@channelname`
+If you have a link of the form `https://t.me/channelname`, you need to extract the `channelname` from the URL.
+You can resolve the channel/group username and join it like this:
```csharp
var resolved = await client.Contacts_ResolveUsername("channelname"); // without the @
if (resolved.Chat is Channel channel)
await client.Channels_JoinChannel(channel);
```
+* For a private channel/group/chat, you need to have an invite link
+Telegram invite links can typically have two forms: `https://t․me/joinchat/HASH` or `https://t․me/+HASH` *(note the '+' prefix here)*
+To use them, you need to extract the `HASH` part from the URL and then you can use those two methods:
+```csharp
+var chatInvite = await client.Messages_CheckChatInvite("HASH"); // optional: get information before joining
+await client.Messages_ImportChatInvite("HASH"); // join the channel/group
+// Note: This works also with invite links of public channel/group
+```
### Add/Invite/Remove someone in a chat
diff --git a/FAQ.md b/FAQ.md
index 371e88b..b42ca53 100644
--- a/FAQ.md
+++ b/FAQ.md
@@ -82,7 +82,7 @@ After that, you should be able to see/install the pre-release versions in your N
This happens when you connect to Telegram Test servers instead of Production servers.
On these separate test servers, all created accounts and chats are periodically deleted, so you shouldn't use them under normal circumstances.
-You can verify this is your issue by looking at [WTelegram logs](EXAMPLES.MD#logging) on the line `Connected to (Test) DC x...`
+You can verify this is your issue by looking at [WTelegram logs](EXAMPLES.md#logging) on the line `Connected to (Test) DC x...`
This wrong-server problem typically happens when you use WTelegramClient Github source project in your application in DEBUG builds.
It is **not recommended** to use WTelegramClient in source code form.
diff --git a/src/Session.cs b/src/Session.cs
index 8b7a2c7..09d5a61 100644
--- a/src/Session.cs
+++ b/src/Session.cs
@@ -42,7 +42,9 @@ namespace WTelegram
if (msgIds == null)
{
msgIds = new long[msgIdsN];
- for (int i = 0; i < msgIdsN; i++) msgIds[i] = msg_id;
+ msgIds[0] = msg_id;
+ msg_id -= 300L << 32; // until the array is filled with real values, allow ids up to 300 seconds in the past
+ for (int i = 1; i < msgIdsN; i++) msgIds[i] = msg_id;
return true;
}
int newHead = (msgIdsHead + 1) % msgIdsN;
From 39b46d71f088cbe98a6120d6ea199e2565a347ba Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Mon, 4 Jul 2022 12:55:00 +0200
Subject: [PATCH 009/390] moving code around Client.Helpers.cs
---
.github/dev.yml | 2 +-
FAQ.md | 11 ++++++++++-
src/Client.Helpers.cs | 15 ++++++++++-----
src/Client.cs | 4 ----
4 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/.github/dev.yml b/.github/dev.yml
index def4305..2b26cff 100644
--- a/.github/dev.yml
+++ b/.github/dev.yml
@@ -2,7 +2,7 @@ pr: none
trigger:
- master
-name: 2.5.2-dev.$(Rev:r)
+name: 2.5.3-dev.$(Rev:r)
pool:
vmImage: ubuntu-latest
diff --git a/FAQ.md b/FAQ.md
index b42ca53..a00a912 100644
--- a/FAQ.md
+++ b/FAQ.md
@@ -132,7 +132,16 @@ Here are some advices from [another similar library](https://github.com/gotd/td/
* Do not abuse, spam or use it for other suspicious activities.
* Implement a rate limiting system.
-If your client displays Telegram channels to the user, you have to support and display [official sponsored messages](https://core.telegram.org/api/sponsored-messages).
+Some additional advices from me:
+
+5. Avoid repetitive polling or repetitive sequence of actions/requests: Save the initial results of your queries, and update those results when you're informed of a change through `Update` events.
+6. If a phone number is brand new, it will be closely monitored by Telegram for abuse, and it can even already be considered a bad user due to bad behavior from the previous owner of that phone number (which may happens often with VoIP or other easy-to-buy-online numbers, so expect fast ban)
+7. You may want to use your new phone number account with an official Telegram client and act like a normal user for some time (some weeks/months), before using it for automation with WTelegramClient.
+8. When creating a new API ID/Hash, I recommend you use your own phone number with long history of normal Telegram usage, rather than a brand new phone number with short history.
+In particular, DON'T create an API ID/Hash for every phone numbers you will control. One API ID/Hash represents your application, which can be used to control several user accounts.
+9. If you actually do use the library to spam, scam, or other stuff annoying to everybody, GTFO and don't cry that you got banned using WTelegramClient. Some people don't seem to realize by themselves that what they plan to do with the library is actually negative for the community and are surprised that they got caught.
+We don't support such use of the library, and will not help people asking for support if we suspect them of mass-user manipulation.
+10. If your client displays Telegram channels to your users, you have to support and display [official sponsored messages](https://core.telegram.org/api/sponsored-messages).
#### 9. Why the error `CHAT_ID_INVALID`?
diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs
index 9fc14e0..2cca82b 100644
--- a/src/Client.Helpers.cs
+++ b/src/Client.Helpers.cs
@@ -18,9 +18,11 @@ namespace WTelegram
#region Collect Access Hash system
/// Enable the collection of id/access_hash pairs (experimental)
public bool CollectAccessHash { get; set; }
- readonly Dictionary> _accessHashes = new();
- public IEnumerable> AllAccessHashesFor() where T : IObject
- => _accessHashes.GetValueOrDefault(typeof(T));
+ public IEnumerable> AllAccessHashesFor() where T : IObject => _accessHashes.GetValueOrDefault(typeof(T));
+ private readonly Dictionary> _accessHashes = new();
+ private static readonly FieldInfo userFlagsField = typeof(User).GetField("flags");
+ private static readonly FieldInfo channelFlagsField = typeof(Channel).GetField("flags");
+
/// Retrieve the access_hash associated with this id (for a TL class) if it was collected
/// This requires to be set to first.
///
See Examples/Program_CollectAccessHash.cs for how to use this
@@ -35,8 +37,6 @@ namespace WTelegram
lock (_accessHashes)
_accessHashes.GetOrCreate(typeof(T))[id] = access_hash;
}
- static readonly FieldInfo userFlagsField = typeof(User).GetField("flags");
- static readonly FieldInfo channelFlagsField = typeof(Channel).GetField("flags");
internal void CollectField(FieldInfo fieldInfo, object obj, object access_hash)
{
if (fieldInfo.Name != "access_hash") return;
@@ -55,6 +55,11 @@ namespace WTelegram
#endregion
#region Client TL Helpers
+ /// Used to indicate progression of file download/upload
+ /// transmitted bytes
+ /// total size of file in bytes, or 0 if unknown
+ public delegate void ProgressCallback(long transmitted, long totalSize);
+
/// Helper function to upload a file to Telegram
/// Path to the file to upload
/// (optional) Callback for tracking the progression of the transfer
diff --git a/src/Client.cs b/src/Client.cs
index bb6e5a6..585b230 100644
--- a/src/Client.cs
+++ b/src/Client.cs
@@ -51,10 +51,6 @@ namespace WTelegram
/// ID of the current logged-in user or 0
public long UserId => _session.UserId;
- /// Used to indicate progression of file download/upload
- /// total size of file in bytes, or 0 if unknown
- public delegate void ProgressCallback(long transmitted, long totalSize);
-
private readonly Func _config;
private readonly Session _session;
private string _apiHash;
From 4f1a6610aa9a8dee7b2c2b23635cf43667a7883b Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Fri, 8 Jul 2022 01:15:37 +0200
Subject: [PATCH 010/390] Option to prevent logout on failed resume
---
src/Client.cs | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/Client.cs b/src/Client.cs
index 585b230..6f62533 100644
--- a/src/Client.cs
+++ b/src/Client.cs
@@ -891,9 +891,10 @@ namespace WTelegram
///
(this method calls ConnectAsync if necessary)
/// Config callback is queried for: phone_number, verification_code
and eventually first_name, last_name (signup required), password (2FA auth), user_id (alt validation)
/// (optional) Preference for verification_code sending
+ /// Proceed to logout and login if active user session cannot be resumed successfully
/// Detail about the logged-in user
///
Most methods of this class are async (Task), so please use to get the result
- public async Task LoginUserIfNeeded(CodeSettings settings = null)
+ public async Task LoginUserIfNeeded(CodeSettings settings = null, bool reloginOnFailedResume = true)
{
await ConnectAsync();
string phone_number = null;
@@ -910,12 +911,15 @@ namespace WTelegram
_session.UserId = _dcSession.UserId = self.id;
return self;
}
- Helpers.Log(3, $"Current logged user {self.id} mismatched user_id or phone_number. Logging out and in...");
+ var mismatch = $"Current logged user {self.id} mismatched user_id or phone_number";
+ Helpers.Log(3, mismatch);
+ if (!reloginOnFailedResume) throw new ApplicationException(mismatch);
}
- catch (Exception ex)
+ catch (RpcException ex) when (reloginOnFailedResume)
{
- Helpers.Log(4, $"Error while verifying current user! ({ex.Message}) Proceeding to login...");
+ Helpers.Log(4, $"Error while fetching current user! ({ex.Message})");
}
+ Helpers.Log(3, $"Proceeding to logout and login...");
await this.Auth_LogOut();
_session.UserId = _dcSession.UserId = 0;
}
From 1299e27cab85289d6d88368feecc53e26e89cec8 Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Tue, 12 Jul 2022 01:31:18 +0200
Subject: [PATCH 011/390] Added method to DisableUpdates
---
README.md | 2 +-
src/Client.cs | 6 +++++-
src/Session.cs | 4 +++-
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index ff40e98..8ddcfd2 100644
--- a/README.md
+++ b/README.md
@@ -37,7 +37,7 @@ If the account already exists and has enabled two-step verification (2FA) a **pa
All these login scenarios are handled automatically within the call to `LoginUserIfNeeded`.
And that's it, you now have access to the **[full range of Telegram Client APIs](https://corefork.telegram.org/methods)**.
-All those API methods are available in the `TL` namespace *(with an underscore in the method name, instead of a dot)*, like this: `await client.Method_Name(...)`
+All those API methods require `using TL;` namespace and are called with an underscore instead of a dot in the method name, like this: `await client.Method_Name(...)`
# Saved session
If you run this program again, you will notice that only **api_hash** is requested, the other prompts are gone and you are automatically logged-on and ready to go.
diff --git a/src/Client.cs b/src/Client.cs
index 6f62533..b330d0c 100644
--- a/src/Client.cs
+++ b/src/Client.cs
@@ -164,6 +164,8 @@ namespace WTelegram
GC.SuppressFinalize(this);
}
+ public void DisableUpdates(bool disable = true) => _dcSession.DisableUpdates(disable);
+
/// Disconnect from Telegram (shouldn't be needed in normal usage)
/// Forget about logged-in user
/// Disconnect secondary sessions with other DCs
@@ -902,7 +904,7 @@ namespace WTelegram
{
try
{
- var users = await this.Users_GetUsers(new[] { InputUser.Self }); // this calls also reenable incoming Updates
+ var users = await this.Users_GetUsers(new[] { InputUser.Self }); // this call also reenable incoming Updates
var self = users[0] as User;
// check user_id or phone_number match currently logged-in user
if ((long.TryParse(_config("user_id"), out long id) && (id == -1 || self.id == id)) ||
@@ -1135,6 +1137,8 @@ namespace WTelegram
/// Wait for the reply and return the resulting object, or throws an RpcException if an error was replied
public async Task Invoke(IMethod query)
{
+ if (_dcSession.WithoutUpdates && query is not IMethod)
+ query = new TL.Methods.InvokeWithoutUpdates { query = query };
bool got503 = false;
retry:
var rpc = new Rpc { type = typeof(T) };
diff --git a/src/Session.cs b/src/Session.cs
index 09d5a61..dee39b2 100644
--- a/src/Session.cs
+++ b/src/Session.cs
@@ -28,12 +28,14 @@ namespace WTelegram
public long ServerTicksOffset;
public long LastSentMsgId;
public TL.DcOption DataCenter;
+ public bool WithoutUpdates;
internal Client Client;
internal int DcID => DataCenter?.id ?? 0;
internal IPEndPoint EndPoint => DataCenter == null ? null : new(IPAddress.Parse(DataCenter.ip_address), DataCenter.port);
internal void Renew() { Helpers.Log(3, $"Renewing session on DC {DcID}..."); Id = Helpers.RandomLong(); Seqno = 0; LastSentMsgId = 0; }
-
+ public void DisableUpdates(bool disable = true) { if (WithoutUpdates != disable) { WithoutUpdates = disable; Renew(); } }
+
const int msgIdsN = 512;
private long[] msgIds;
private int msgIdsHead;
From 000c35b256f86240a4efc3fd4d22c4fc4a81bd72 Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Sun, 24 Jul 2022 11:14:08 +0200
Subject: [PATCH 012/390] SendAlbumAsync now returns all the Message[] (#75)
---
src/Client.Helpers.cs | 16 +++++++++-------
src/TL.Schema.cs | 2 +-
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs
index 2cca82b..cf57217 100644
--- a/src/Client.Helpers.cs
+++ b/src/Client.Helpers.cs
@@ -228,13 +228,14 @@ namespace WTelegram
/// WTelegramClient proxy settings don't apply to HttpClient
/// * You may run into errors if you mix, in the same album, photos and file documents having no thumbnails/video attributes
///
- public async Task SendAlbumAsync(InputPeer peer, InputMedia[] medias, string caption = null, int reply_to_msg_id = 0, MessageEntity[] entities = null, DateTime schedule_date = default)
+ public async Task SendAlbumAsync(InputPeer peer, InputMedia[] medias, string caption = null, int reply_to_msg_id = 0, MessageEntity[] entities = null, DateTime schedule_date = default)
{
System.Net.Http.HttpClient httpClient = null;
var multiMedia = new InputSingleMedia[medias.Length];
+ var random_id = Helpers.RandomLong();
for (int i = 0; i < medias.Length; i++)
{
- var ism = multiMedia[i] = new InputSingleMedia { random_id = Helpers.RandomLong(), media = medias[i] };
+ var ism = multiMedia[i] = new InputSingleMedia { random_id = random_id + i, media = medias[i] };
retry:
switch (ism.media)
{
@@ -282,17 +283,18 @@ namespace WTelegram
var updates = await this.Messages_SendMultiMedia(peer, multiMedia, reply_to_msg_id: reply_to_msg_id, schedule_date: schedule_date);
OnUpdate(updates);
- int msgId = -1;
+ var msgIds = new int[medias.Length];
+ var result = new Message[medias.Length];
foreach (var update in updates.UpdateList)
{
switch (update)
{
- case UpdateMessageID updMsgId when updMsgId.random_id == lastMedia.random_id: msgId = updMsgId.id; break;
- case UpdateNewMessage { message: Message message } when message.id == msgId: return message;
- case UpdateNewScheduledMessage { message: Message schedMsg } when schedMsg.id == msgId: return schedMsg;
+ case UpdateMessageID updMsgId: msgIds[updMsgId.random_id - random_id] = updMsgId.id; break;
+ case UpdateNewMessage { message: Message message }: result[Array.IndexOf(msgIds, message.id)] = message; break;
+ case UpdateNewScheduledMessage { message: Message schedMsg }: result[Array.IndexOf(msgIds, schedMsg.id)] = schedMsg; break;
}
}
- return null;
+ return result;
}
private Peer InputToPeer(InputPeer peer) => peer switch
diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs
index 1417301..cb70955 100644
--- a/src/TL.Schema.cs
+++ b/src/TL.Schema.cs
@@ -4084,7 +4084,7 @@ namespace TL
[TLDef(0xC4870A49)]
public class UpdateBotStopped : Update
{
- /// The bot ID
+ /// The user ID
public long user_id;
/// When did this action occur
public DateTime date;
From 5743942a7f0c1a6e6ec75bf3ed67ad94a317681d Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Sun, 24 Jul 2022 15:03:13 +0200
Subject: [PATCH 013/390] Notify ReactorError before (not after) throwing
exception on pending APIs
---
FAQ.md | 3 ++-
src/Client.cs | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/FAQ.md b/FAQ.md
index a00a912..ed096f1 100644
--- a/FAQ.md
+++ b/FAQ.md
@@ -191,7 +191,8 @@ If Telegram servers decide to shutdown this secondary connection, it's not an is
This should be transparent and pending API calls should automatically be resent upon reconnection.
You can choose to increase `MaxAutoReconnects` if it happens too often because your Internet connection is unstable.
-3) If you reach `MaxAutoReconnects` disconnections, then the **Update** event handler will receive a `ReactorError` object to notify you of the problem.
+3) If you reach `MaxAutoReconnects` disconnections, then the **Update** event handler will receive a `ReactorError` object to notify you of the problem,
+and pending API calls throw the network IOException.
In this case, the recommended action would be to dispose the client and recreate one
4) In case of slow Internet connection or if you break in the debugger for some time,
diff --git a/src/Client.cs b/src/Client.cs
index b330d0c..c3d0132 100644
--- a/src/Client.cs
+++ b/src/Client.cs
@@ -329,6 +329,7 @@ namespace WTelegram
}
catch
{
+ OnUpdate(reactorError);
lock (_pendingRpcs) // abort all pending requests
{
foreach (var rpc in _pendingRpcs.Values)
@@ -336,7 +337,6 @@ namespace WTelegram
_pendingRpcs.Clear();
_bareRpc = null;
}
- OnUpdate(reactorError);
}
finally
{
From cf53520e0294d2f8f6c1ed59673840c3fff6ffe4 Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Fri, 29 Jul 2022 02:19:25 +0200
Subject: [PATCH 014/390] minor clarifications
---
EXAMPLES.md | 6 +++---
src/Client.cs | 4 +++-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/EXAMPLES.md b/EXAMPLES.md
index 22d3cc2..e4c6ccb 100644
--- a/EXAMPLES.md
+++ b/EXAMPLES.md
@@ -40,14 +40,14 @@ if (contacts.imported.Length > 0)
-### Send an HTML/Markdown formatted message to ourself (Saved Messages)
+### Convert message to/from HTML or Markdown, and send it to ourself (Saved Messages)
```csharp
// HTML-formatted text:
var text = $"Hello dear {HtmlText.Escape(myself.first_name)}\n" +
"Enjoy this userbot written with WTelegramClient";
var entities = client.HtmlToEntities(ref text);
var sent = await client.SendMessageAsync(InputPeer.Self, text, entities: entities);
-// if you need to convert a Message to HTML: (for easier storage)
+// if you need to convert a sent/received Message to HTML: (easier to store)
text = client.EntitiesToHtml(sent.message, sent.entities);
// Markdown-style text:
@@ -55,7 +55,7 @@ var text2 = $"Hello __dear *{Markdown.Escape(myself.first_name)}*__\n" +
"Enjoy this `userbot` written with [WTelegramClient](https://github.com/wiz0u/WTelegramClient)";
var entities2 = client.MarkdownToEntities(ref text2);
var sent2 = await client.SendMessageAsync(InputPeer.Self, text2, entities: entities2);
-// if you need to convert a Message to Markdown: (for easier storage)
+// if you need to convert a sent/received Message to Markdown: (easier to store)
text2 = client.EntitiesToMarkdown(sent2.message, sent2.entities);
```
See [MarkdownV2 formatting style](https://core.telegram.org/bots/api/#markdownv2-style) and [HTML formatting style](https://core.telegram.org/bots/api/#html-style) for details.
diff --git a/src/Client.cs b/src/Client.cs
index c3d0132..f8cc64c 100644
--- a/src/Client.cs
+++ b/src/Client.cs
@@ -313,7 +313,7 @@ namespace WTelegram
lock (_pendingRpcs) // retry all pending requests
{
foreach (var rpc in _pendingRpcs.Values)
- rpc.tcs.SetResult(reactorError);
+ rpc.tcs.SetResult(reactorError); // this leads to a retry (see Invoke method)
_pendingRpcs.Clear();
_bareRpc = null;
}
@@ -645,6 +645,8 @@ namespace WTelegram
rpc.tcs.SetResult(obj);
break;
}
+ else
+ Helpers.Log(4, $"Received a {obj.GetType()} incompatible with expected bare {rpc?.type}");
}
OnUpdate(obj);
break;
From 6977641b2d5123b7dc7dc44e31bcb9b60bb6994e Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Fri, 29 Jul 2022 02:21:05 +0200
Subject: [PATCH 015/390] Upgrade to layer 144: Premium gifts, custom emoji
stickers...
---
.github/dev.yml | 2 +-
.github/release.yml | 2 +-
README.md | 2 +-
src/TL.Schema.cs | 122 ++++++++++++++++++++++++++++++++++++++++--
src/TL.SchemaFuncs.cs | 105 ++++++++++++++++++++++++------------
src/TL.Table.cs | 20 +++++--
6 files changed, 206 insertions(+), 47 deletions(-)
diff --git a/.github/dev.yml b/.github/dev.yml
index 2b26cff..fce32d5 100644
--- a/.github/dev.yml
+++ b/.github/dev.yml
@@ -2,7 +2,7 @@ pr: none
trigger:
- master
-name: 2.5.3-dev.$(Rev:r)
+name: 2.6.1-dev.$(Rev:r)
pool:
vmImage: ubuntu-latest
diff --git a/.github/release.yml b/.github/release.yml
index 08ed80b..b6de330 100644
--- a/.github/release.yml
+++ b/.github/release.yml
@@ -1,7 +1,7 @@
pr: none
trigger: none
-name: 2.5.$(Rev:r)
+name: 2.6.$(Rev:r)
pool:
vmImage: ubuntu-latest
diff --git a/README.md b/README.md
index 8ddcfd2..591d69a 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
[](https://www.nuget.org/packages/WTelegramClient/)
[](https://dev.azure.com/wiz0u/WTelegramClient/_build?definitionId=7)
-[](https://corefork.telegram.org/methods)
+[](https://corefork.telegram.org/methods)
[](https://dev.azure.com/wiz0u/WTelegramClient/_artifacts/feed/WTelegramClient/NuGet/WTelegramClient)
[](https://t.me/WTelegramClient)
[](http://wizou.fr/donate.html)
diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs
index cb70955..b2d52b9 100644
--- a/src/TL.Schema.cs
+++ b/src/TL.Schema.cs
@@ -2104,6 +2104,14 @@ namespace TL
{
public string text;
}
+ /// See
+ [TLDef(0xABA0F5C6)]
+ public class MessageActionGiftPremium : MessageAction
+ {
+ public string currency;
+ public long amount;
+ public int months;
+ }
/// Chat info. Derived classes: , See
public abstract class DialogBase : IObject
@@ -2635,7 +2643,7 @@ namespace TL
}
/// Extended user info See
- [TLDef(0x8C72EA81)]
+ [TLDef(0xC4B1FC3F)]
public class UserFull : IObject
{
/// Flags, see TL conditional fields
@@ -2666,6 +2674,7 @@ namespace TL
[IfFlag(16)] public string private_forward_name;
[IfFlag(17)] public ChatAdminRights bot_group_admin_rights;
[IfFlag(18)] public ChatAdminRights bot_broadcast_admin_rights;
+ [IfFlag(19)] public PremiumGiftOption[] premium_gifts;
[Flags] public enum Flags : uint
{
@@ -2701,6 +2710,9 @@ namespace TL
has_bot_group_admin_rights = 0x20000,
/// Field has a value
has_bot_broadcast_admin_rights = 0x40000,
+ /// Field has a value
+ has_premium_gifts = 0x80000,
+ voice_messages_forbidden = 0x100000,
}
}
@@ -3393,6 +3405,7 @@ namespace TL
{
/// Whether the updated stickers are mask stickers
masks = 0x1,
+ emojis = 0x2,
}
}
/// Installed stickersets have changed, the client should refetch them using messages.getAllStickers See
@@ -4192,6 +4205,9 @@ namespace TL
pending = 0x1,
}
}
+ /// See
+ [TLDef(0xFB4C496C)]
+ public class UpdateReadFeaturedEmojiStickers : Update { }
/// Updates state. See
[TLDef(0xA56C2A3E)]
@@ -5294,6 +5310,8 @@ namespace TL
PhoneNumber = 0x0352DAFA,
///Whether people can add you to their contact list by your phone number
AddedByPhone = 0xD1219BDD,
+ ///See
+ VoiceMessages = 0xAEE69D68,
}
/// Privacy key See
@@ -5315,6 +5333,8 @@ namespace TL
PhoneNumber = 0xD19AE46D,
///Whether people can add you to their contact list by your phone number
AddedByPhone = 0x42FFD42B,
+ ///See
+ VoiceMessages = 0x0697F414,
}
/// Privacy rule Derived classes: , , , , , , , See
@@ -5518,6 +5538,19 @@ namespace TL
/// Whether the current document has stickers attached See
[TLDef(0x9801D2F7)]
public class DocumentAttributeHasStickers : DocumentAttribute { }
+ /// See
+ [TLDef(0xFD149899)]
+ public class DocumentAttributeCustomEmoji : DocumentAttribute
+ {
+ public Flags flags;
+ public string alt;
+ public InputStickerSet stickerset;
+
+ [Flags] public enum Flags : uint
+ {
+ free = 0x1,
+ }
+ }
/// Found stickers See
/// a null value means messages.stickersNotModified
@@ -5984,9 +6017,12 @@ namespace TL
/// Animated emoji reaction stickerset (contains animations to play when a user clicks on a given animated emoji) See
[TLDef(0x0CDE3739)]
public class InputStickerSetAnimatedEmojiAnimations : InputStickerSet { }
+ /// See
+ [TLDef(0xC88B3B02)]
+ public class InputStickerSetPremiumGifts : InputStickerSet { }
/// Represents a stickerset (stickerpack) See
- [TLDef(0xD7DF217A)]
+ [TLDef(0x2DD14EDC)]
public partial class StickerSet : IObject
{
/// Flags, see TL conditional fields
@@ -6007,6 +6043,7 @@ namespace TL
[IfFlag(4)] public int thumb_dc_id;
/// Thumbnail version
[IfFlag(4)] public int thumb_version;
+ [IfFlag(8)] public long thumb_document_id;
/// Number of stickers in pack
public int count;
/// Hash
@@ -6028,6 +6065,9 @@ namespace TL
animated = 0x20,
/// Is this a video stickerpack
videos = 0x40,
+ emojis = 0x80,
+ /// Field has a value
+ has_thumb_document_id = 0x100,
}
}
@@ -6422,6 +6462,12 @@ namespace TL
/// Message entity representing a spoiler See
[TLDef(0x32CA960F)]
public class MessageEntitySpoiler : MessageEntity { }
+ /// See
+ [TLDef(0xC8CF05F8, inheritBefore = true)]
+ public class MessageEntityCustomEmoji : MessageEntity
+ {
+ public long document_id;
+ }
/// Represents a channel Derived classes: , See
/// a null value means inputChannelEmpty
@@ -7729,9 +7775,10 @@ namespace TL
public int count;
}
/// Featured stickersets See
- [TLDef(0x84C02310)]
+ [TLDef(0xBE382906)]
public class Messages_FeaturedStickers : Messages_FeaturedStickersBase
{
+ public Flags flags;
/// Hash for pagination, for more info click here
public long hash;
/// Total number of featured stickers
@@ -7740,6 +7787,11 @@ namespace TL
public StickerSetCoveredBase[] sets;
/// IDs of new featured stickersets
public long[] unread;
+
+ [Flags] public enum Flags : uint
+ {
+ premium = 0x1,
+ }
}
/// Recently used stickers See
@@ -7810,6 +7862,16 @@ namespace TL
/// Stickerset
public override StickerSet Set => set;
}
+ /// See
+ [TLDef(0x1AED5EE5)]
+ public class StickerSetFullCovered : StickerSetCoveredBase
+ {
+ public StickerSet set;
+ public StickerPack[] packs;
+ public DocumentBase[] documents;
+
+ public override StickerSet Set => set;
+ }
/// Position on a photo where a mask should be placed See
[TLDef(0xAED6DBB2)]
@@ -8614,7 +8676,7 @@ namespace TL
}
/// Payment form See
- [TLDef(0xB0133B37)]
+ [TLDef(0xA0058751)]
public class Payments_PaymentForm : IObject
{
/// Flags, see TL conditional fields
@@ -8636,10 +8698,11 @@ namespace TL
[IfFlag(4)] public string native_provider;
/// Contains information about the payment provider, if available, to support it natively without the need for opening the URL.
A JSON object that can contain the following fields:
- apple_pay_merchant_id: Apple Pay merchant ID
- google_pay_public_key: Google Pay public key
- need_country: True, if the user country must be provided,
- need_zip: True, if the user ZIP/postal code must be provided,
- need_cardholder_name: True, if the cardholder name must be provided
[IfFlag(4)] public DataJSON native_params;
+ [IfFlag(6)] public PaymentFormMethod[] additional_methods;
/// Saved server-side order information
[IfFlag(0)] public PaymentRequestedInfo saved_info;
/// Contains information about saved card credentials
- [IfFlag(1)] public PaymentSavedCredentials saved_credentials;
+ [IfFlag(1)] public PaymentSavedCredentials[] saved_credentials;
/// Users
public Dictionary users;
@@ -8657,6 +8720,8 @@ namespace TL
has_native_provider = 0x10,
/// Field has a value
has_photo = 0x20,
+ /// Field has a value
+ has_additional_methods = 0x40,
}
}
@@ -13097,4 +13162,51 @@ namespace TL
public long monthly_amount;
public Dictionary users;
}
+
+ /// See
+ public abstract class InputStorePaymentPurpose : IObject { }
+ /// See
+ [TLDef(0xA6751E66)]
+ public class InputStorePaymentPremiumSubscription : InputStorePaymentPurpose
+ {
+ public Flags flags;
+
+ [Flags] public enum Flags : uint
+ {
+ restore = 0x1,
+ }
+ }
+ /// See
+ [TLDef(0x616F7FE8)]
+ public class InputStorePaymentGiftPremium : InputStorePaymentPurpose
+ {
+ public InputUserBase user_id;
+ public string currency;
+ public long amount;
+ }
+
+ /// See
+ [TLDef(0x74C34319)]
+ public class PremiumGiftOption : IObject
+ {
+ public Flags flags;
+ public int months;
+ public string currency;
+ public long amount;
+ public string bot_url;
+ [IfFlag(0)] public string store_product;
+
+ [Flags] public enum Flags : uint
+ {
+ has_store_product = 0x1,
+ }
+ }
+
+ /// See
+ [TLDef(0x88F8F21B)]
+ public class PaymentFormMethod : IObject
+ {
+ public string url;
+ public string title;
+ }
}
diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs
index 7e6b6a8..9a6dfee 100644
--- a/src/TL.SchemaFuncs.cs
+++ b/src/TL.SchemaFuncs.cs
@@ -415,10 +415,12 @@ namespace TL
/// Delete the user's account from the telegram servers. Can be used, for example, to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured. See Possible codes: 420 (details)
/// Why is the account being deleted, can be empty
- public static Task Account_DeleteAccount(this Client client, string reason)
+ public static Task Account_DeleteAccount(this Client client, string reason, InputCheckPasswordSRP password = null)
=> client.Invoke(new Account_DeleteAccount
{
+ flags = (Account_DeleteAccount.Flags)(password != null ? 0x1 : 0),
reason = reason,
+ password = password,
});
/// Get days to live of account See
@@ -1844,10 +1846,10 @@ namespace TL
/// Reorder installed stickersets See
/// Reorder mask stickersets
/// New stickerset order by stickerset IDs
- public static Task Messages_ReorderStickerSets(this Client client, long[] order, bool masks = false)
+ public static Task Messages_ReorderStickerSets(this Client client, long[] order, bool masks = false, bool emojis = false)
=> client.Invoke(new Messages_ReorderStickerSets
{
- flags = (Messages_ReorderStickerSets.Flags)(masks ? 0x1 : 0),
+ flags = (Messages_ReorderStickerSets.Flags)((masks ? 0x1 : 0) | (emojis ? 0x2 : 0)),
order = order,
});
@@ -2106,10 +2108,10 @@ namespace TL
/// Get mask stickers
/// Offsets for pagination, for more info click here
/// Maximum number of results to return, see pagination
- public static Task Messages_GetArchivedStickers(this Client client, long offset_id = default, int limit = int.MaxValue, bool masks = false)
+ public static Task Messages_GetArchivedStickers(this Client client, long offset_id = default, int limit = int.MaxValue, bool masks = false, bool emojis = false)
=> client.Invoke(new Messages_GetArchivedStickers
{
- flags = (Messages_GetArchivedStickers.Flags)(masks ? 0x1 : 0),
+ flags = (Messages_GetArchivedStickers.Flags)((masks ? 0x1 : 0) | (emojis ? 0x2 : 0)),
offset_id = offset_id,
limit = limit,
});
@@ -3221,6 +3223,28 @@ namespace TL
good = good,
});
+ /// See
+ public static Task Messages_GetCustomEmojiDocuments(this Client client, long[] document_id)
+ => client.Invoke(new Messages_GetCustomEmojiDocuments
+ {
+ document_id = document_id,
+ });
+
+ /// See
+ /// a null value means messages.allStickersNotModified
+ public static Task Messages_GetEmojiStickers(this Client client, long hash = default)
+ => client.Invoke(new Messages_GetEmojiStickers
+ {
+ hash = hash,
+ });
+
+ /// See
+ public static Task Messages_GetFeaturedEmojiStickers(this Client client, long hash = default)
+ => client.Invoke(new Messages_GetFeaturedEmojiStickers
+ {
+ hash = hash,
+ });
+
/// Returns a current state of updates. See [bots: ✓]
public static Task Updates_GetState(this Client client)
=> client.Invoke(new Updates_GetState
@@ -4158,32 +4182,26 @@ namespace TL
});
/// See
- public static Task Payments_AssignAppStoreTransaction(this Client client, string transaction_id, byte[] receipt, bool restore = false)
+ public static Task Payments_AssignAppStoreTransaction(this Client client, byte[] receipt, InputStorePaymentPurpose purpose)
=> client.Invoke(new Payments_AssignAppStoreTransaction
{
- flags = (Payments_AssignAppStoreTransaction.Flags)(restore ? 0x1 : 0),
- transaction_id = transaction_id,
receipt = receipt,
+ purpose = purpose,
});
/// See
- public static Task Payments_AssignPlayMarketTransaction(this Client client, string purchase_token)
+ public static Task Payments_AssignPlayMarketTransaction(this Client client, DataJSON receipt, InputStorePaymentPurpose purpose)
=> client.Invoke(new Payments_AssignPlayMarketTransaction
- {
- purchase_token = purchase_token,
- });
-
- /// See
- public static Task Payments_RestorePlayMarketReceipt(this Client client, byte[] receipt)
- => client.Invoke(new Payments_RestorePlayMarketReceipt
{
receipt = receipt,
+ purpose = purpose,
});
/// See
- public static Task Payments_CanPurchasePremium(this Client client)
+ public static Task Payments_CanPurchasePremium(this Client client, InputStorePaymentPurpose purpose)
=> client.Invoke(new Payments_CanPurchasePremium
{
+ purpose = purpose,
});
/// See
@@ -5057,10 +5075,17 @@ namespace TL.Methods
public InputPrivacyRule[] rules;
}
- [TLDef(0x418D4E0B)]
+ [TLDef(0xA2C0CF74)]
public class Account_DeleteAccount : IMethod
{
+ public Flags flags;
public string reason;
+ [IfFlag(0)] public InputCheckPasswordSRP password;
+
+ [Flags] public enum Flags : uint
+ {
+ has_password = 0x1,
+ }
}
[TLDef(0x08FC711D)]
@@ -6205,6 +6230,7 @@ namespace TL.Methods
[Flags] public enum Flags : uint
{
masks = 0x1,
+ emojis = 0x2,
}
}
@@ -6456,6 +6482,7 @@ namespace TL.Methods
[Flags] public enum Flags : uint
{
masks = 0x1,
+ emojis = 0x2,
}
}
@@ -7387,6 +7414,24 @@ namespace TL.Methods
public bool good;
}
+ [TLDef(0xD9AB0F54)]
+ public class Messages_GetCustomEmojiDocuments : IMethod
+ {
+ public long[] document_id;
+ }
+
+ [TLDef(0xFBFCA18F)]
+ public class Messages_GetEmojiStickers : IMethod
+ {
+ public long hash;
+ }
+
+ [TLDef(0x0ECF6736)]
+ public class Messages_GetFeaturedEmojiStickers : IMethod
+ {
+ public long hash;
+ }
+
[TLDef(0xEDD4882A)]
public class Updates_GetState : IMethod { }
@@ -8099,34 +8144,26 @@ namespace TL.Methods
public InputMedia invoice_media;
}
- [TLDef(0x0FEC13C6)]
+ [TLDef(0x80ED747D)]
public class Payments_AssignAppStoreTransaction : IMethod
{
- public Flags flags;
- public string transaction_id;
public byte[] receipt;
-
- [Flags] public enum Flags : uint
- {
- restore = 0x1,
- }
+ public InputStorePaymentPurpose purpose;
}
- [TLDef(0x4FAA4AED)]
+ [TLDef(0xDFFD50D3)]
public class Payments_AssignPlayMarketTransaction : IMethod
{
- public string purchase_token;
+ public DataJSON receipt;
+ public InputStorePaymentPurpose purpose;
}
- [TLDef(0xD164E36A)]
- public class Payments_RestorePlayMarketReceipt : IMethod
+ [TLDef(0x9FC19EB6)]
+ public class Payments_CanPurchasePremium : IMethod
{
- public byte[] receipt;
+ public InputStorePaymentPurpose purpose;
}
- [TLDef(0xAA6A90C8)]
- public class Payments_CanPurchasePremium : IMethod { }
-
[TLDef(0x146E958D)]
public class Payments_RequestRecurringPayment : IMethod
{
diff --git a/src/TL.Table.cs b/src/TL.Table.cs
index 6cadf0d..dd1244e 100644
--- a/src/TL.Table.cs
+++ b/src/TL.Table.cs
@@ -6,7 +6,7 @@ namespace TL
{
public static class Layer
{
- public const int Version = 143; // fetched 14/06/2022 23:30:05
+ public const int Version = 144; // fetched 28/07/2022 23:41:51
internal const uint VectorCtor = 0x1CB5C415;
internal const uint NullCtor = 0x56730BCC;
internal const uint RpcResultCtor = 0xF35C6D01;
@@ -187,6 +187,7 @@ namespace TL
[0xEBBCA3CB] = typeof(MessageActionChatJoinedByRequest),
[0x47DD8079] = typeof(MessageActionWebViewDataSentMe),
[0xB4C38CB5] = typeof(MessageActionWebViewDataSent),
+ [0xABA0F5C6] = typeof(MessageActionGiftPremium),
[0xA8EDD0F5] = typeof(Dialog),
[0x71BD134C] = typeof(DialogFolder),
[0x2331B22D] = typeof(PhotoEmpty),
@@ -212,7 +213,7 @@ namespace TL
[0xA518110D] = typeof(PeerSettings),
[0xA437C3ED] = typeof(WallPaper),
[0xE0804116] = typeof(WallPaperNoFile),
- [0x8C72EA81] = typeof(UserFull),
+ [0xC4B1FC3F] = typeof(UserFull),
[0x145ADE0B] = typeof(Contact),
[0xC13E3C50] = typeof(ImportedContact),
[0x16D9703B] = typeof(ContactStatus),
@@ -350,6 +351,7 @@ namespace TL
[0x14B85813] = typeof(UpdateBotMenuButton),
[0x74D8BE99] = typeof(UpdateSavedRingtones),
[0x0084CD5A] = typeof(UpdateTranscribedAudio),
+ [0xFB4C496C] = typeof(UpdateReadFeaturedEmojiStickers),
[0xA56C2A3E] = typeof(Updates_State),
[0x5D75A138] = typeof(Updates_DifferenceEmpty),
[0x00F49CA0] = typeof(Updates_Difference),
@@ -444,6 +446,7 @@ namespace TL
[0x9852F9C6] = typeof(DocumentAttributeAudio),
[0x15590068] = typeof(DocumentAttributeFilename),
[0x9801D2F7] = typeof(DocumentAttributeHasStickers),
+ [0xFD149899] = typeof(DocumentAttributeCustomEmoji),
[0xF1749A22] = null,//Messages_StickersNotModified
[0x30A6EC7E] = typeof(Messages_Stickers),
[0x12B299D4] = typeof(StickerPack),
@@ -472,7 +475,8 @@ namespace TL
[0x028703C8] = typeof(InputStickerSetAnimatedEmoji),
[0xE67F520E] = typeof(InputStickerSetDice),
[0x0CDE3739] = typeof(InputStickerSetAnimatedEmojiAnimations),
- [0xD7DF217A] = typeof(StickerSet),
+ [0xC88B3B02] = typeof(InputStickerSetPremiumGifts),
+ [0x2DD14EDC] = typeof(StickerSet),
[0xB60A24A6] = typeof(Messages_StickerSet),
[0xD3F924EB] = null,//Messages_StickerSetNotModified
[0xC27AC8C7] = typeof(BotCommand),
@@ -517,6 +521,7 @@ namespace TL
[0x020DF5D0] = typeof(MessageEntityBlockquote),
[0x761E6AF4] = typeof(MessageEntityBankCard),
[0x32CA960F] = typeof(MessageEntitySpoiler),
+ [0xC8CF05F8] = typeof(MessageEntityCustomEmoji),
[0xEE8C1E86] = null,//InputChannelEmpty
[0xF35AEC28] = typeof(InputChannel),
[0x5B934F9D] = typeof(InputChannelFromMessage),
@@ -588,7 +593,7 @@ namespace TL
[0x1B0C841A] = typeof(DraftMessageEmpty),
[0xFD8E711F] = typeof(DraftMessage),
[0xC6DC0C66] = typeof(Messages_FeaturedStickersNotModified),
- [0x84C02310] = typeof(Messages_FeaturedStickers),
+ [0xBE382906] = typeof(Messages_FeaturedStickers),
[0x0B17F890] = null,//Messages_RecentStickersNotModified
[0x88D37C56] = typeof(Messages_RecentStickers),
[0x4FCBA9C8] = typeof(Messages_ArchivedStickers),
@@ -596,6 +601,7 @@ namespace TL
[0x35E410A8] = typeof(Messages_StickerSetInstallResultArchive),
[0x6410A5D2] = typeof(StickerSetCovered),
[0x3407E51B] = typeof(StickerSetMultiCovered),
+ [0x1AED5EE5] = typeof(StickerSetFullCovered),
[0xAED6DBB2] = typeof(MaskCoords),
[0x4A992157] = typeof(InputStickeredMediaPhoto),
[0x0438865B] = typeof(InputStickeredMediaDocument),
@@ -662,7 +668,7 @@ namespace TL
[0xC239D686] = typeof(InputWebFileLocation),
[0x9F2221C9] = typeof(InputWebFileGeoPointLocation),
[0x21E753BC] = typeof(Upload_WebFile),
- [0xB0133B37] = typeof(Payments_PaymentForm),
+ [0xA0058751] = typeof(Payments_PaymentForm),
[0xD1451883] = typeof(Payments_ValidatedRequestedInfo),
[0x4E5F810D] = typeof(Payments_PaymentResult),
[0xD8411139] = typeof(Payments_PaymentVerificationNeeded),
@@ -980,6 +986,10 @@ namespace TL
[0xAED0CBD9] = typeof(Payments_ExportedInvoice),
[0x93752C52] = typeof(Messages_TranscribedAudio),
[0x8A4F3C29] = typeof(Help_PremiumPromo),
+ [0xA6751E66] = typeof(InputStorePaymentPremiumSubscription),
+ [0x616F7FE8] = typeof(InputStorePaymentGiftPremium),
+ [0x74C34319] = typeof(PremiumGiftOption),
+ [0x88F8F21B] = typeof(PaymentFormMethod),
// from TL.Secret:
[0xBB718624] = typeof(Layer66.SendMessageUploadRoundAction),
[0xE50511D8] = typeof(Layer45.DecryptedMessageMediaWebPage),
From 668b19e3e8a0627ed0d2a907ab19c9116ef8dd30 Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Fri, 29 Jul 2022 15:24:18 +0200
Subject: [PATCH 016/390] Renamed Update event to OnUpdate, returning Task (to
gracefully handle async exceptions)
---
EXAMPLES.md | 7 ++++---
Examples/Program_DownloadSavedMedia.cs | 4 ++--
Examples/Program_Heroku.cs | 4 ++--
Examples/Program_ListenUpdates.cs | 8 +++++---
FAQ.md | 4 ++--
README.md | 2 +-
src/Client.Helpers.cs | 4 ++--
src/Client.cs | 28 +++++++++++++-------------
8 files changed, 32 insertions(+), 29 deletions(-)
diff --git a/EXAMPLES.md b/EXAMPLES.md
index e4c6ccb..cf38563 100644
--- a/EXAMPLES.md
+++ b/EXAMPLES.md
@@ -312,14 +312,15 @@ finally
### Monitor all Telegram events happening for the user
-This is done through the `client.Update` callback event.
+This is done through the `client.OnUpdate` callback event.
+Your event handler implementation can either return `Task.CompletedTask` or be an `async Task` method.
See [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs).
### Monitor new messages being posted in chats
-You have to handle `client.Update` events containing an `UpdateNewMessage`.
+You have to handle `client.OnUpdate` events containing an `UpdateNewMessage`.
See the `DisplayMessage` method in [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs).
@@ -336,7 +337,7 @@ See [Examples/Program_DownloadSavedMedia.cs](Examples/Program_DownloadSavedMedia
### Collect Access Hash and save them for later use
-You can automate the collection of `access_hash` for the various resources obtained in response to API calls or Update events,
+You can automate the collection of `access_hash` for the various resources obtained in response to API calls or Updates,
so that you don't have to remember them by yourself or ask the API about them each time.
This is done by activating the experimental `client.CollectAccessHash` system.
diff --git a/Examples/Program_DownloadSavedMedia.cs b/Examples/Program_DownloadSavedMedia.cs
index 9ca7905..d8ca67d 100644
--- a/Examples/Program_DownloadSavedMedia.cs
+++ b/Examples/Program_DownloadSavedMedia.cs
@@ -15,10 +15,10 @@ namespace WTelegramClientTest
Console.WriteLine("The program will download photos/medias from messages you send/forward to yourself (Saved Messages)");
using var client = new WTelegram.Client(Environment.GetEnvironmentVariable);
var user = await client.LoginUserIfNeeded();
- client.Update += Client_Update;
+ client.OnUpdate += Client_OnUpdate;
Console.ReadKey();
- async void Client_Update(IObject arg)
+ async Task Client_OnUpdate(IObject arg)
{
if (arg is not Updates { updates: var updates } upd) return;
foreach (var update in updates)
diff --git a/Examples/Program_Heroku.cs b/Examples/Program_Heroku.cs
index 31890cb..2eef6c3 100644
--- a/Examples/Program_Heroku.cs
+++ b/Examples/Program_Heroku.cs
@@ -30,7 +30,7 @@ namespace WTelegramClientTest
Client = new WTelegram.Client(store.Length == 0 ? null : Environment.GetEnvironmentVariable, store);
using (Client)
{
- Client.Update += Client_Update;
+ Client.OnUpdate += Client_OnUpdate;
My = await Client.LoginUserIfNeeded();
Console.WriteLine($"We are logged-in as {My.username ?? My.first_name + " " + My.last_name} (id {My.id})");
var dialogs = await Client.Messages_GetAllDialogs();
@@ -39,7 +39,7 @@ namespace WTelegramClientTest
}
}
- private static async void Client_Update(IObject arg)
+ private static async Task Client_OnUpdate(IObject arg)
{
if (arg is not UpdatesBase updates) return;
updates.CollectUsersChats(Users, Chats);
diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs
index 673754c..34567fb 100644
--- a/Examples/Program_ListenUpdates.cs
+++ b/Examples/Program_ListenUpdates.cs
@@ -20,7 +20,7 @@ namespace WTelegramClientTest
Client = new WTelegram.Client(Environment.GetEnvironmentVariable);
using (Client)
{
- Client.Update += Client_Update;
+ Client.OnUpdate += Client_OnUpdate;
My = await Client.LoginUserIfNeeded();
Users[My.id] = My;
// Note: on login, Telegram may sends a bunch of updates/messages that happened in the past and were not acknowledged
@@ -32,9 +32,10 @@ namespace WTelegramClientTest
}
}
- private static void Client_Update(IObject arg)
+ // in this example, we're not using async/await, so we just return Task.CompletedTask
+ private static Task Client_OnUpdate(IObject arg)
{
- if (arg is not UpdatesBase updates) return;
+ if (arg is not UpdatesBase updates) return Task.CompletedTask;
updates.CollectUsersChats(Users, Chats);
foreach (var update in updates.UpdateList)
switch (update)
@@ -52,6 +53,7 @@ namespace WTelegramClientTest
case UpdateUserPhoto uup: Console.WriteLine($"{User(uup.user_id)} has changed profile photo"); break;
default: Console.WriteLine(update.GetType().Name); break; // there are much more update types than the above cases
}
+ return Task.CompletedTask;
}
private static void DisplayMessage(MessageBase messageBase, bool edit = false)
diff --git a/FAQ.md b/FAQ.md
index ed096f1..6a08d53 100644
--- a/FAQ.md
+++ b/FAQ.md
@@ -134,7 +134,7 @@ Here are some advices from [another similar library](https://github.com/gotd/td/
Some additional advices from me:
-5. Avoid repetitive polling or repetitive sequence of actions/requests: Save the initial results of your queries, and update those results when you're informed of a change through `Update` events.
+5. Avoid repetitive polling or repetitive sequence of actions/requests: Save the initial results of your queries, and update those results when you're informed of a change through `OnUpdate` events.
6. If a phone number is brand new, it will be closely monitored by Telegram for abuse, and it can even already be considered a bad user due to bad behavior from the previous owner of that phone number (which may happens often with VoIP or other easy-to-buy-online numbers, so expect fast ban)
7. You may want to use your new phone number account with an official Telegram client and act like a normal user for some time (some weeks/months), before using it for automation with WTelegramClient.
8. When creating a new API ID/Hash, I recommend you use your own phone number with long history of normal Telegram usage, rather than a brand new phone number with short history.
@@ -191,7 +191,7 @@ If Telegram servers decide to shutdown this secondary connection, it's not an is
This should be transparent and pending API calls should automatically be resent upon reconnection.
You can choose to increase `MaxAutoReconnects` if it happens too often because your Internet connection is unstable.
-3) If you reach `MaxAutoReconnects` disconnections, then the **Update** event handler will receive a `ReactorError` object to notify you of the problem,
+3) If you reach `MaxAutoReconnects` disconnections, then the **OnUpdate** event handler will receive a `ReactorError` object to notify you of the problem.
and pending API calls throw the network IOException.
In this case, the recommended action would be to dispose the client and recreate one
diff --git a/README.md b/README.md
index 591d69a..1ff7205 100644
--- a/README.md
+++ b/README.md
@@ -130,7 +130,7 @@ In the API, Telegram uses some terms/classnames that can be confusing as they di
# Other things to know
-The Client class also offers an `Update` event that is triggered when Telegram servers sends Updates (like new messages or status), independently of your API requests. See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs)
+The Client class also offers an `OnUpdate` event that is triggered when Telegram servers sends Updates (like new messages or status), independently of your API requests. See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs)
An invalid API request can result in a `RpcException` being raised, reflecting the [error code and status text](https://revgram.github.io/errors.html) of the problem.
diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs
index cf57217..7d4ea98 100644
--- a/src/Client.Helpers.cs
+++ b/src/Client.Helpers.cs
@@ -189,7 +189,7 @@ namespace WTelegram
else
updates = await this.Messages_SendMedia(peer, media, text, random_id, entities: entities,
reply_to_msg_id: reply_to_msg_id == 0 ? null : reply_to_msg_id, schedule_date: schedule_date == default ? null : schedule_date);
- OnUpdate(updates);
+ RaiseUpdate(updates);
int msgId = -1;
foreach (var update in updates.UpdateList)
{
@@ -282,7 +282,7 @@ namespace WTelegram
if (entities != null) lastMedia.flags = InputSingleMedia.Flags.has_entities;
var updates = await this.Messages_SendMultiMedia(peer, multiMedia, reply_to_msg_id: reply_to_msg_id, schedule_date: schedule_date);
- OnUpdate(updates);
+ RaiseUpdate(updates);
var msgIds = new int[medias.Length];
var result = new Message[medias.Length];
foreach (var update in updates.UpdateList)
diff --git a/src/Client.cs b/src/Client.cs
index f8cc64c..d4dd9fb 100644
--- a/src/Client.cs
+++ b/src/Client.cs
@@ -25,8 +25,8 @@ namespace WTelegram
public partial class Client : IDisposable
{
/// This event will be called when unsollicited updates/messages are sent by Telegram servers
- /// See Examples/Program_ListenUpdate.cs for how to use this
- public event Action Update;
+ /// Make your handler , or return
See Examples/Program_ListenUpdate.cs for how to use this
+ public event Func OnUpdate;
/// Used to create a TcpClient connected to the given address/port, or throw an exception on failure
public TcpFactory TcpHandler { get; set; } = DefaultTcpHandler;
public delegate Task TcpFactory(string host, int port);
@@ -150,7 +150,7 @@ namespace WTelegram
public static void LoadPublicKey(string pem) => Encryption.LoadPublicKey(pem);
/// Builds a structure that is used to validate a 2FA password
- /// Password validation configuration. You can obtain this though an Update event as part of the login process
+ /// Password validation configuration. You can obtain this via Account_GetPassword or through OnUpdate as part of the login process
/// The password to validate
public static Task InputCheckPassword(Account_Password accountPassword, string password)
=> Check2FA(accountPassword, () => Task.FromResult(password));
@@ -321,7 +321,7 @@ namespace WTelegram
if (IsMainDC)
{
var updatesState = await this.Updates_GetState(); // this call reenables incoming Updates
- OnUpdate(updatesState);
+ RaiseUpdate(updatesState);
}
}
else
@@ -329,7 +329,7 @@ namespace WTelegram
}
catch
{
- OnUpdate(reactorError);
+ RaiseUpdate(reactorError);
lock (_pendingRpcs) // abort all pending requests
{
foreach (var rpc in _pendingRpcs.Values)
@@ -633,7 +633,7 @@ namespace WTelegram
rpc.tcs.SetException(new ApplicationException($"BadMsgNotification {badMsgNotification.error_code}"));
}
else
- OnUpdate(obj);
+ RaiseUpdate(obj);
break;
default:
if (_bareRpc != null)
@@ -648,7 +648,7 @@ namespace WTelegram
else
Helpers.Log(4, $"Received a {obj.GetType()} incompatible with expected bare {rpc?.type}");
}
- OnUpdate(obj);
+ RaiseUpdate(obj);
break;
}
@@ -658,19 +658,19 @@ namespace WTelegram
if (rpc != null)
rpc.tcs.SetResult(result);
else
- OnUpdate(obj);
+ RaiseUpdate(obj);
}
}
- private void OnUpdate(IObject obj)
+ private async void RaiseUpdate(IObject obj)
{
try
{
- Update?.Invoke(obj);
+ await OnUpdate?.Invoke(obj);
}
catch (Exception ex)
{
- Helpers.Log(4, $"{nameof(Update)} callback on {obj.GetType().Name} raised {ex}");
+ Helpers.Log(4, $"{nameof(OnUpdate)}({obj?.GetType().Name}) raised {ex}");
}
}
@@ -943,7 +943,7 @@ namespace WTelegram
{
resent:
var timeout = DateTime.UtcNow + TimeSpan.FromSeconds(sentCode.timeout);
- OnUpdate(sentCode);
+ RaiseUpdate(sentCode);
Helpers.Log(3, $"A verification code has been sent via {sentCode.type.GetType().Name[17..]}");
for (int retry = 1; authorization == null; retry++)
try
@@ -973,7 +973,7 @@ namespace WTelegram
try
{
var accountPassword = await this.Account_GetPassword();
- OnUpdate(accountPassword);
+ RaiseUpdate(accountPassword);
var checkPasswordSRP = await Check2FA(accountPassword, () => ConfigAsync("password"));
authorization = await this.Auth_CheckPassword(checkPasswordSRP);
}
@@ -992,7 +992,7 @@ namespace WTelegram
if (authorization is Auth_AuthorizationSignUpRequired signUpRequired)
{
var waitUntil = DateTime.UtcNow.AddSeconds(3);
- OnUpdate(signUpRequired); // give caller the possibility to read and accept TOS
+ RaiseUpdate(signUpRequired); // give caller the possibility to read and accept TOS
var first_name = Config("first_name");
var last_name = Config("last_name");
var wait = waitUntil - DateTime.UtcNow;
From 3e1506d0a77262db5f186b61ee810b3fbf2ccfb4 Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Mon, 1 Aug 2022 19:06:31 +0200
Subject: [PATCH 017/390] Throw exception if calling API without connecting
first.
---
EXAMPLES.md | 2 +-
Examples/Program_ListenUpdates.cs | 15 ++++++++-------
FAQ.md | 6 +++---
src/Client.cs | 1 +
4 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/EXAMPLES.md b/EXAMPLES.md
index cf38563..e0ac068 100644
--- a/EXAMPLES.md
+++ b/EXAMPLES.md
@@ -345,7 +345,7 @@ See [Examples/Program_CollectAccessHash.cs](Examples/Program_CollectAccessHash.c
### Use a proxy to connect to Telegram
-SOCKS/HTTP proxies can be used through the `client.TcpHandler` delegate and a proxy library like [StarkSoftProxy](https://www.nuget.org/packages/StarkSoftProxy/):
+SOCKS/HTTPS proxies can be used through the `client.TcpHandler` delegate and a proxy library like [StarkSoftProxy](https://www.nuget.org/packages/StarkSoftProxy/):
```csharp
using var client = new WTelegram.Client(Environment.GetEnvironmentVariable);
client.TcpHandler = async (address, port) =>
diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs
index 34567fb..9060e7b 100644
--- a/Examples/Program_ListenUpdates.cs
+++ b/Examples/Program_ListenUpdates.cs
@@ -32,16 +32,16 @@ namespace WTelegramClientTest
}
}
- // in this example, we're not using async/await, so we just return Task.CompletedTask
- private static Task Client_OnUpdate(IObject arg)
+ // if not using async/await, we could just return Task.CompletedTask
+ private static async Task Client_OnUpdate(IObject arg)
{
- if (arg is not UpdatesBase updates) return Task.CompletedTask;
+ if (arg is not UpdatesBase updates) return;
updates.CollectUsersChats(Users, Chats);
foreach (var update in updates.UpdateList)
switch (update)
{
- case UpdateNewMessage unm: DisplayMessage(unm.message); break;
- case UpdateEditMessage uem: DisplayMessage(uem.message, true); break;
+ case UpdateNewMessage unm: await DisplayMessage(unm.message); break;
+ case UpdateEditMessage uem: await DisplayMessage(uem.message, true); break;
case UpdateDeleteChannelMessages udcm: Console.WriteLine($"{udcm.messages.Length} message(s) deleted in {Chat(udcm.channel_id)}"); break;
case UpdateDeleteMessages udm: Console.WriteLine($"{udm.messages.Length} message(s) deleted"); break;
case UpdateUserTyping uut: Console.WriteLine($"{User(uut.user_id)} is {uut.action}"); break;
@@ -53,10 +53,10 @@ namespace WTelegramClientTest
case UpdateUserPhoto uup: Console.WriteLine($"{User(uup.user_id)} has changed profile photo"); break;
default: Console.WriteLine(update.GetType().Name); break; // there are much more update types than the above cases
}
- return Task.CompletedTask;
}
- private static void DisplayMessage(MessageBase messageBase, bool edit = false)
+ // in this example method, we're not using async/await, so we just return Task.CompletedTask
+ private static Task DisplayMessage(MessageBase messageBase, bool edit = false)
{
if (edit) Console.Write("(Edit): ");
switch (messageBase)
@@ -64,6 +64,7 @@ namespace WTelegramClientTest
case Message m: Console.WriteLine($"{Peer(m.from_id) ?? m.post_author} in {Peer(m.peer_id)}> {m.message}"); break;
case MessageService ms: Console.WriteLine($"{Peer(ms.from_id)} in {Peer(ms.peer_id)} [{ms.action.GetType().Name[13..]}]"); break;
}
+ return Task.CompletedTask;
}
private static string User(long id) => Users.TryGetValue(id, out var user) ? user.ToString() : $"User {id}";
diff --git a/FAQ.md b/FAQ.md
index 6a08d53..50f1d90 100644
--- a/FAQ.md
+++ b/FAQ.md
@@ -177,7 +177,7 @@ To help determine if `chats.chats` is empty or does not contain a certain chat,
or simply use a debugger: Place a breakpoint after the Messages_GetAllChats call, run the program up to there, and use a Watch pane to display the content of the chats.chats dictionary.
-#### 10. I get "Connection shut down" errors in my logs
+#### 11. I get "Connection shut down" errors in my logs
There are various reasons why you may get this error. Here are the explanation and how to solve it:
@@ -200,7 +200,7 @@ you might also get Connection shutdown because your client couldn't send Pings t
In this case, you can use the `PingInterval` property to increase the delay between pings *(for example 300 seconds instead of 60)*.
-#### 11. How to migrate from TLSharp? How to sign-in/sign-up/register account properly?
+#### 12. How to migrate from TLSharp? How to sign-in/sign-up/register account properly?
First, make sure you read the [ReadMe documentation](README.md) completely, it contains essential information and a quick tutorial to easily understand how to correctly use the library.
@@ -226,7 +226,7 @@ In particular, it will detect and handle automatically and properly the various
Contrary to TLSharp, WTelegramClient supports MTProto v2.0 (more secured), transport obfuscation, protocol security checks, MTProto Proxy, real-time updates, multiple DC connections, API documentation in Intellisense...
-#### 12. How to host my userbot online?
+#### 13. How to host my userbot online?
If you need your userbot to run 24/7, you would typically design your userbot as a Console program, compiled for Linux or Windows,
and hosted online on any [VPS Hosting](https://www.google.com/search?q=vps+hosting) (Virtual Private Server).
diff --git a/src/Client.cs b/src/Client.cs
index d4dd9fb..d189979 100644
--- a/src/Client.cs
+++ b/src/Client.cs
@@ -1046,6 +1046,7 @@ namespace WTelegram
private async Task SendAsync(IObject msg, bool isContent, Rpc rpc = null)
{
+ if (_reactorTask == null) throw new ApplicationException("You must connect to Telegram first");
isContent &= _dcSession.AuthKeyID != 0;
(long msgId, int seqno) = NewMsgId(isContent);
if (rpc != null)
From ee0a777685cff066f1262dba110830add25b899e Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Thu, 4 Aug 2022 00:20:42 +0200
Subject: [PATCH 018/390] Added to layer 144: Album covers
---
src/TL.Schema.cs | 26 ++++++++++++++++----------
src/TL.Table.cs | 3 ++-
2 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs
index b2d52b9..b4e24b1 100644
--- a/src/TL.Schema.cs
+++ b/src/TL.Schema.cs
@@ -8621,11 +8621,7 @@ namespace TL
}
/// Location of remote file Derived classes: , See
- public abstract class InputWebFileLocationBase : IObject
- {
- /// Access hash
- public abstract long AccessHash { get; }
- }
+ public abstract class InputWebFileLocationBase : IObject { }
/// Location of a remote HTTP(s) file See
[TLDef(0xC239D686)]
public class InputWebFileLocation : InputWebFileLocationBase
@@ -8634,9 +8630,6 @@ namespace TL
public string url;
/// ⚠ REQUIRED FIELD. See how to obtain it
Access hash
public long access_hash;
-
- /// Access hash
- public override long AccessHash => access_hash;
}
/// Geolocation See
[TLDef(0x9F2221C9)]
@@ -8654,9 +8647,22 @@ namespace TL
public int zoom;
/// Map scale; 1-3
public int scale;
+ }
+ /// See
+ [TLDef(0xF46FE924)]
+ public class InputWebFileAudioAlbumThumbLocation : InputWebFileLocationBase
+ {
+ public Flags flags;
+ [IfFlag(0)] public InputDocument document;
+ [IfFlag(1)] public string title;
+ [IfFlag(1)] public string performer;
- /// Access hash
- public override long AccessHash => access_hash;
+ [Flags] public enum Flags : uint
+ {
+ has_document = 0x1,
+ has_title = 0x2,
+ small = 0x4,
+ }
}
/// Represents a chunk of an HTTP webfile downloaded through telegram's secure MTProto servers See
diff --git a/src/TL.Table.cs b/src/TL.Table.cs
index dd1244e..52a1fbd 100644
--- a/src/TL.Table.cs
+++ b/src/TL.Table.cs
@@ -6,7 +6,7 @@ namespace TL
{
public static class Layer
{
- public const int Version = 144; // fetched 28/07/2022 23:41:51
+ public const int Version = 144; // fetched 03/08/2022 22:13:22
internal const uint VectorCtor = 0x1CB5C415;
internal const uint NullCtor = 0x56730BCC;
internal const uint RpcResultCtor = 0xF35C6D01;
@@ -667,6 +667,7 @@ namespace TL
[0x9BED434D] = typeof(InputWebDocument),
[0xC239D686] = typeof(InputWebFileLocation),
[0x9F2221C9] = typeof(InputWebFileGeoPointLocation),
+ [0xF46FE924] = typeof(InputWebFileAudioAlbumThumbLocation),
[0x21E753BC] = typeof(Upload_WebFile),
[0xA0058751] = typeof(Payments_PaymentForm),
[0xD1451883] = typeof(Payments_ValidatedRequestedInfo),
From 46c3cf3d9a4d5a33a109b9bc8b84150782b92315 Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Sat, 6 Aug 2022 13:06:46 +0200
Subject: [PATCH 019/390] Fix crash on null OnUpdate
---
.github/dev.yml | 2 +-
README.md | 17 ++++++++++-------
src/Client.cs | 3 ++-
3 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/.github/dev.yml b/.github/dev.yml
index fce32d5..34d9eb6 100644
--- a/.github/dev.yml
+++ b/.github/dev.yml
@@ -2,7 +2,7 @@ pr: none
trigger:
- master
-name: 2.6.1-dev.$(Rev:r)
+name: 2.6.2-dev.$(Rev:r)
pool:
vmImage: ubuntu-latest
diff --git a/README.md b/README.md
index 1ff7205..b2d895e 100644
--- a/README.md
+++ b/README.md
@@ -70,11 +70,13 @@ using var client = new WTelegram.Client(Config);
```
There are other configuration items that are queried to your method but returning `null` let WTelegramClient choose a default adequate value.
Those shown above are the only ones that have no default values and should be provided by your method.
-Returning `null` for verification_code or password will show a prompt for console apps, or an error otherwise.
-Returning `""` for verification_code requests resending the code through another method (SMS or Call).
-Another simple approach is to pass `Environment.GetEnvironmentVariable` as the config callback and define the configuration items as environment variables.
-Undefined variables get the default `null` behavior.
+Returning `null` for verification_code or password will show a prompt for console apps, or an error otherwise
+*(see [FAQ #3](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#GUI) for WinForms)*
+Returning `""` for verification_code requests the resending of the code through another system (SMS or Call).
+
+Another simple approach is to pass `Environment.GetEnvironmentVariable` as the config callback and define the configuration items as environment variables
+*(undefined variables get the default `null` behavior)*.
Finally, if you want to redirect the library logs to your logger instead of the Console, you can install a delegate in the `WTelegram.Helpers.Log` static property.
Its `int` argument is the log severity, compatible with the [LogLevel enum](https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel)
@@ -123,10 +125,11 @@ In the API, Telegram uses some terms/classnames that can be confusing as they di
- `Chat` : A private [basic chat group](https://corefork.telegram.org/api/channel#basic-groups) with less than 200 members (it may be migrated to a supergroup `Channel` with a new ID when it gets bigger or public, in which case the old `Chat` will still exist but be `deactivated`)
**⚠️ Most chat groups you see are really of type `Channel`, not `Chat`!**
- chats : In plural or general meaning, it means either `Chat` or `Channel`
-- `Peer` : Either a `Chat`, `Channel` or a private chat with a `User`
-- Dialog : The current status of a chat with a `Peer` *(draft, last message, unread count, pinned...)*. It represents each line from your Telegram chat list.
+- `Peer` : Either a `Chat`, a `Channel` or a `User`
+- Dialog : Status of chat with a `Peer` *(draft, last message, unread count, pinned...)*. It represents each line from your Telegram chat list.
- DC (DataCenter) : There are a few datacenters depending on where in the world the user (or an uploaded media file) is from.
-- Access Hash : Telegram requires you to provide a specific `access_hash` for users, channels, and other resources before interacting with them. See [FAQ #4](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#access-hash) to learn more about it.
+- Access Hash : Telegram requires you to provide a specific `access_hash` for users, channels, and other resources before interacting with them.
+See [FAQ #4](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#access-hash) to learn more about it.
# Other things to know
diff --git a/src/Client.cs b/src/Client.cs
index d189979..d766895 100644
--- a/src/Client.cs
+++ b/src/Client.cs
@@ -666,7 +666,8 @@ namespace WTelegram
{
try
{
- await OnUpdate?.Invoke(obj);
+ var task = OnUpdate?.Invoke(obj);
+ if (task != null) await task;
}
catch (Exception ex)
{
From 9b7e4293d877f680347f7d69da69078781758204 Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Thu, 11 Aug 2022 19:39:18 +0200
Subject: [PATCH 020/390] Removed compatibility with legacy (pre-2.0.0) session
files
---
.github/dev.yml | 2 +-
EXAMPLES.md | 3 +-
src/Client.Helpers.cs | 2 +-
src/Session.cs | 1 -
src/TL.Schema.cs | 218 +++++++++++++++++++++++++++++++-----------
src/TL.SchemaFuncs.cs | 157 ++++++++++++++++++------------
6 files changed, 263 insertions(+), 120 deletions(-)
diff --git a/.github/dev.yml b/.github/dev.yml
index 34d9eb6..052762e 100644
--- a/.github/dev.yml
+++ b/.github/dev.yml
@@ -2,7 +2,7 @@ pr: none
trigger:
- master
-name: 2.6.2-dev.$(Rev:r)
+name: 2.6.3-dev.$(Rev:r)
pool:
vmImage: ubuntu-latest
diff --git a/EXAMPLES.md b/EXAMPLES.md
index e0ac068..5f0bc5f 100644
--- a/EXAMPLES.md
+++ b/EXAMPLES.md
@@ -49,7 +49,8 @@ var entities = client.HtmlToEntities(ref text);
var sent = await client.SendMessageAsync(InputPeer.Self, text, entities: entities);
// if you need to convert a sent/received Message to HTML: (easier to store)
text = client.EntitiesToHtml(sent.message, sent.entities);
-
+```
+```csharp
// Markdown-style text:
var text2 = $"Hello __dear *{Markdown.Escape(myself.first_name)}*__\n" +
"Enjoy this `userbot` written with [WTelegramClient](https://github.com/wiz0u/WTelegramClient)";
diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs
index 7d4ea98..796d9a0 100644
--- a/src/Client.Helpers.cs
+++ b/src/Client.Helpers.cs
@@ -175,7 +175,7 @@ namespace WTelegram
/// The plain text of the message (or media caption)
/// An instance of InputMedia-derived class, or if there is no associated media
/// Your message is a reply to an existing message with this ID, in the same chat
- /// Text formatting entities. You can use MarkdownToEntities to create these
+ /// Text formatting entities. You can use HtmlToEntities or MarkdownToEntities to create these
/// UTC timestamp when the message should be sent
/// Should website/media preview be shown or not, for URLs in your message
/// The transmitted message as confirmed by Telegram
diff --git a/src/Session.cs b/src/Session.cs
index dee39b2..71c2e7d 100644
--- a/src/Session.cs
+++ b/src/Session.cs
@@ -168,7 +168,6 @@ namespace WTelegram
{
var position = BinaryPrimitives.ReadInt32LittleEndian(_header);
var length = BinaryPrimitives.ReadInt32LittleEndian(_header.AsSpan(4));
- if (position < 0 || length < 0 || position >= 65536 || length >= 32768) { position = 0; length = (int)base.Length; }
base.Position = position;
Length = length;
_nextPosition = position + length;
diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs
index b4e24b1..34d84b3 100644
--- a/src/TL.Schema.cs
+++ b/src/TL.Schema.cs
@@ -776,6 +776,7 @@ namespace TL
/// If set, this user was reported by many users as a fake or scam user: be careful when interacting with them.
fake = 0x4000000,
bot_attach_menu = 0x8000000,
+ /// Whether this user is a Telegram Premium user
premium = 0x10000000,
attach_menu_enabled = 0x20000000,
}
@@ -993,7 +994,9 @@ namespace TL
gigagroup = 0x4000000,
/// Whether this channel or group is protected, thus does not allow forwarding messages from it
noforwards = 0x8000000,
+ /// Whether a user needs to join the supergroup before they can send messages: can be false only for discussion groups », toggle using channels.toggleJoinToSend
join_to_send = 0x10000000,
+ /// Whether a user's join request will have to be approved by administrators, toggle using channels.toggleJoinToSend
join_request = 0x20000000,
}
@@ -1173,6 +1176,7 @@ namespace TL
{
/// Flags, see TL conditional fields
public Flags flags;
+ /// Flags, see TL conditional fields
public Flags2 flags2;
/// ID of the channel
public long id;
@@ -1313,6 +1317,7 @@ namespace TL
[Flags] public enum Flags2 : uint
{
+ /// Can we delete this channel?
can_delete_channel = 0x1,
}
@@ -1725,6 +1730,7 @@ namespace TL
has_document = 0x1,
/// Field has a value
has_ttl_seconds = 0x4,
+ /// Whether this is a normal sticker, if not set this is a premium sticker and a premium sticker animation must be played.
nopremium = 0x8,
}
}
@@ -1834,7 +1840,7 @@ namespace TL
public string emoticon;
}
- /// Object describing actions connected to a service message. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , See
+ /// Object describing actions connected to a service message. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , See
/// a null value means messageActionEmpty
public abstract class MessageAction : IObject { }
/// Group created See
@@ -1955,17 +1961,20 @@ namespace TL
[TLDef(0x96163F56)]
public class MessageActionPaymentSent : MessageAction
{
+ /// Flags, see TL conditional fields
public Flags flags;
/// Three-letter ISO 4217 currency code
public string currency;
/// Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
public long total_amount;
+ /// An invoice slug taken from a t.me/invoice/ link or from the premium_invoice_slug app config parameter »
[IfFlag(0)] public string invoice_slug;
[Flags] public enum Flags : uint
{
/// Field has a value
has_invoice_slug = 0x1,
+ /// Whether this is a recurring payment
recurring_init = 0x4,
recurring_used = 0x8,
}
@@ -2104,12 +2113,15 @@ namespace TL
{
public string text;
}
- /// See
+ /// Info about a gifted Telegram Premium subscription See
[TLDef(0xABA0F5C6)]
public class MessageActionGiftPremium : MessageAction
{
+ /// Three-letter ISO 4217 currency code
public string currency;
+ /// Price of the gift in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
public long amount;
+ /// Duration of the gifted Telegram Premium subscription
public int months;
}
@@ -2485,8 +2497,11 @@ namespace TL
[IfFlag(1)] public bool silent;
/// Mute all notifications until this date
[IfFlag(2)] public int mute_until;
+ /// Notification sound for the official iOS application
[IfFlag(3)] public NotificationSound ios_sound;
+ /// Notification sound for the official android application
[IfFlag(4)] public NotificationSound android_sound;
+ /// Notification sound for other applications
[IfFlag(5)] public NotificationSound other_sound;
[Flags] public enum Flags : uint
@@ -2672,7 +2687,9 @@ namespace TL
[IfFlag(15)] public string theme_emoticon;
/// Anonymized text to be shown instead of the the user's name on forwarded messages
[IfFlag(16)] public string private_forward_name;
+ /// A suggested default set of administrator rights for the bot, to be shown when adding the bot as admin to a supergroup (only a suggestion, the admin right set may be modified by the user before adding the bot as admin)
[IfFlag(17)] public ChatAdminRights bot_group_admin_rights;
+ /// A suggested default set of administrator rights for the bot, to be shown when adding the bot as admin to a channel (only a suggestion, the admin right set may be modified by the user before adding the bot as admin)
[IfFlag(18)] public ChatAdminRights bot_broadcast_admin_rights;
[IfFlag(19)] public PremiumGiftOption[] premium_gifts;
@@ -2712,6 +2729,7 @@ namespace TL
has_bot_broadcast_admin_rights = 0x40000,
/// Field has a value
has_premium_gifts = 0x80000,
+ /// Whether this user doesn't allow sending voice messages in a private chat with them
voice_messages_forbidden = 0x100000,
}
}
@@ -3038,7 +3056,7 @@ namespace TL
[TLDef(0x1BB00451)]
public class InputMessagesFilterPinned : MessagesFilter { }
- /// Object contains info on events occurred. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , See
+ /// Object contains info on events occurred. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , See
public abstract class Update : IObject { }
/// New message in a private chat or in a basic group. See
[TLDef(0x1F2B0AFD)]
@@ -3405,6 +3423,7 @@ namespace TL
{
/// Whether the updated stickers are mask stickers
masks = 0x1,
+ /// Whether the updated stickers are custom emoji stickers
emojis = 0x2,
}
}
@@ -4171,7 +4190,7 @@ namespace TL
/// Reactions
public MessageReactions reactions;
}
- /// See
+ /// The list of added bot web apps » has changed, use messages.getAttachMenuBots to fetch the updated list. See
[TLDef(0x17B7A20B)]
public class UpdateAttachMenuBots : Update { }
/// See
@@ -4180,28 +4199,36 @@ namespace TL
{
public long query_id;
}
- /// See
+ /// The menu button behavior for the specified bot has changed See
[TLDef(0x14B85813)]
public class UpdateBotMenuButton : Update
{
+ /// Bot ID
public long bot_id;
+ /// New menu button
public BotMenuButtonBase button;
}
- /// See
+ /// The list of saved notification sounds has changed, use account.getSavedRingtones to fetch the new list. See
[TLDef(0x74D8BE99)]
public class UpdateSavedRingtones : Update { }
- /// See
+ /// A pending transcription initiated with messages.transcribeAudio was updated. See
[TLDef(0x0084CD5A)]
public class UpdateTranscribedAudio : Update
{
+ /// Flags, see TL conditional fields
public Flags flags;
+ /// Peer of the transcribed message
public Peer peer;
+ /// Transcribed message ID
public int msg_id;
+ /// Transcription ID
public long transcription_id;
+ /// Transcribed text
public string text;
[Flags] public enum Flags : uint
{
+ /// Whether this transcription is still pending and further about it will be sent in the future.
pending = 0x1,
}
}
@@ -4757,6 +4784,7 @@ namespace TL
has_static_maps_provider = 0x1000,
/// Whether pfs was used
pfs_enabled = 0x2000,
+ /// Whether to forcefully try connecting using IPv6
force_try_ipv6 = 0x4000,
}
}
@@ -5310,7 +5338,7 @@ namespace TL
PhoneNumber = 0x0352DAFA,
///Whether people can add you to their contact list by your phone number
AddedByPhone = 0xD1219BDD,
- ///See
+ ///Whether people can send you voice messages
VoiceMessages = 0xAEE69D68,
}
@@ -5333,7 +5361,7 @@ namespace TL
PhoneNumber = 0xD19AE46D,
///Whether people can add you to their contact list by your phone number
AddedByPhone = 0x42FFD42B,
- ///See
+ ///Whether the user accepts voice messages
VoiceMessages = 0x0697F414,
}
@@ -5445,7 +5473,7 @@ namespace TL
public int days;
}
- /// Various possible attributes of a document (used to define if it's a sticker, a GIF, a video, a mask sticker, an image, an audio, and so on) Derived classes: , , , , , , See
+ /// Various possible attributes of a document (used to define if it's a sticker, a GIF, a video, a mask sticker, an image, an audio, and so on) Derived classes: , , , , , , , See
public abstract class DocumentAttribute : IObject { }
/// Defines the width and height of an image uploaded as document See
[TLDef(0x6C37C15C)]
@@ -5538,12 +5566,15 @@ namespace TL
/// Whether the current document has stickers attached See
[TLDef(0x9801D2F7)]
public class DocumentAttributeHasStickers : DocumentAttribute { }
- /// See
+ /// Info about a custom emoji See
[TLDef(0xFD149899)]
public class DocumentAttributeCustomEmoji : DocumentAttribute
{
+ /// Flags, see TL conditional fields
public Flags flags;
+ /// The actual emoji
public string alt;
+ /// The emoji stickerset to which this emoji belongs.
public InputStickerSet stickerset;
[Flags] public enum Flags : uint
@@ -5878,7 +5909,7 @@ namespace TL
public int flags;
}
- /// Exported chat invite Derived classes: See
+ /// Exported chat invite Derived classes: , See
public abstract class ExportedChatInvite : IObject { }
/// Exported chat invite See
[TLDef(0x0AB4A819)]
@@ -5985,7 +6016,7 @@ namespace TL
public DateTime expires;
}
- /// Represents a stickerset Derived classes: , , , , See
+ /// Represents a stickerset Derived classes: , , , , , See
/// a null value means inputStickerSetEmpty
public abstract partial class InputStickerSet : IObject { }
/// Stickerset by ID See
@@ -6043,6 +6074,7 @@ namespace TL
[IfFlag(4)] public int thumb_dc_id;
/// Thumbnail version
[IfFlag(4)] public int thumb_version;
+ /// Document ID of custom emoji thumbnail, fetch the document using messages.getCustomEmojiDocuments
[IfFlag(8)] public long thumb_document_id;
/// Number of stickers in pack
public int count;
@@ -6065,6 +6097,7 @@ namespace TL
animated = 0x20,
/// Is this a video stickerpack
videos = 0x40,
+ /// This is a custom emoji stickerset
emojis = 0x80,
/// Field has a value
has_thumb_document_id = 0x100,
@@ -6098,15 +6131,19 @@ namespace TL
[TLDef(0x8F300B57)]
public class BotInfo : IObject
{
+ /// Flags, see TL conditional fields
public Flags flags;
/// ID of the bot
[IfFlag(0)] public long user_id;
/// Description of the bot
[IfFlag(1)] public string description;
+ /// Description photo
[IfFlag(4)] public PhotoBase description_photo;
+ /// Description animation in MPEG4 format
[IfFlag(5)] public DocumentBase description_document;
/// Bot commands that can be used in the chat
[IfFlag(2)] public BotCommand[] commands;
+ /// Indicates the action to execute when pressing the in-UI menu button for bots
[IfFlag(3)] public BotMenuButtonBase menu_button;
[Flags] public enum Flags : uint
@@ -6126,7 +6163,7 @@ namespace TL
}
}
- /// Bot or inline keyboard buttons Derived classes: , , , , , , , , , , , , See
+ /// Bot or inline keyboard buttons Derived classes: , , , , , , , , , , , , , , See
public abstract class KeyboardButtonBase : IObject
{
/// Button text
@@ -6378,12 +6415,12 @@ namespace TL
public KeyboardButtonRow[] rows;
}
- /// Message entities, representing styled text in a message Derived classes: , , , , , , , , , , , , , , , , , , , See
+ /// Message entities, representing styled text in a message Derived classes: , , , , , , , , , , , , , , , , , , , , See
public abstract class MessageEntity : IObject
{
- /// Offset of message entity within message (in UTF-8 codepoints)
+ /// Offset of message entity within message (in UTF-16 code units)
public int offset;
- /// Length of message entity within message (in UTF-8 codepoints)
+ /// Length of message entity within message (in UTF-16 code units)
public int length;
}
/// Unknown message entity See
@@ -6462,10 +6499,11 @@ namespace TL
/// Message entity representing a spoiler See
[TLDef(0x32CA960F)]
public class MessageEntitySpoiler : MessageEntity { }
- /// See
+ /// Represents a custom emoji See
[TLDef(0xC8CF05F8, inheritBefore = true)]
public class MessageEntityCustomEmoji : MessageEntity
{
+ /// Document ID of the custom emoji, use messages.getCustomEmojiDocuments to fetch the emoji animation and the actual emoji it represents.
public long document_id;
}
@@ -7778,6 +7816,7 @@ namespace TL
[TLDef(0xBE382906)]
public class Messages_FeaturedStickers : Messages_FeaturedStickersBase
{
+ /// Flags, see TL conditional fields
public Flags flags;
/// Hash for pagination, for more info click here
public long hash;
@@ -7790,6 +7829,7 @@ namespace TL
[Flags] public enum Flags : uint
{
+ /// Whether this is a premium stickerset
premium = 0x1,
}
}
@@ -7832,7 +7872,7 @@ namespace TL
public StickerSetCoveredBase[] sets;
}
- /// Stickerset, with a specific sticker as preview Derived classes: , See
+ /// Stickerset, with a specific sticker as preview Derived classes: , , See
public abstract class StickerSetCoveredBase : IObject
{
/// Stickerset
@@ -7850,7 +7890,7 @@ namespace TL
/// Stickerset
public override StickerSet Set => set;
}
- /// Stickerset, with a specific stickers as preview See
+ /// Stickerset, with a specific set of stickers as preview See
[TLDef(0x3407E51B)]
public class StickerSetMultiCovered : StickerSetCoveredBase
{
@@ -8453,6 +8493,7 @@ namespace TL
[IfFlag(8)] public long max_tip_amount;
/// A vector of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount.
[IfFlag(8)] public long[] suggested_tip_amounts;
+ /// Terms of service URL for the recurring payment
[IfFlag(9)] public string recurring_terms_url;
[Flags] public enum Flags : uint
@@ -8475,6 +8516,7 @@ namespace TL
email_to_provider = 0x80,
/// Field has a value
has_max_tip_amount = 0x100,
+ /// Whether this is a recurring payment
recurring = 0x200,
}
}
@@ -8620,7 +8662,7 @@ namespace TL
public DocumentAttribute[] attributes;
}
- /// Location of remote file Derived classes: , See
+ /// Location of remote file Derived classes: , , See
public abstract class InputWebFileLocationBase : IObject { }
/// Location of a remote HTTP(s) file See
[TLDef(0xC239D686)]
@@ -8652,6 +8694,7 @@ namespace TL
[TLDef(0xF46FE924)]
public class InputWebFileAudioAlbumThumbLocation : InputWebFileLocationBase
{
+ /// Flags, see TL conditional fields
public Flags flags;
[IfFlag(0)] public InputDocument document;
[IfFlag(1)] public string title;
@@ -8659,7 +8702,9 @@ namespace TL
[Flags] public enum Flags : uint
{
+ /// Field has a value
has_document = 0x1,
+ /// Field has a value
has_title = 0x2,
small = 0x4,
}
@@ -8691,8 +8736,11 @@ namespace TL
public long form_id;
/// Bot ID
public long bot_id;
+ /// Form title
public string title;
+ /// Description
public string description;
+ /// Product photo
[IfFlag(5)] public WebDocumentBase photo;
/// Invoice
public Invoice invoice;
@@ -8704,6 +8752,7 @@ namespace TL
[IfFlag(4)] public string native_provider;
/// Contains information about the payment provider, if available, to support it natively without the need for opening the URL.
A JSON object that can contain the following fields:
- apple_pay_merchant_id: Apple Pay merchant ID
- google_pay_public_key: Google Pay public key
- need_country: True, if the user country must be provided,
- need_zip: True, if the user ZIP/postal code must be provided,
- need_cardholder_name: True, if the cardholder name must be provided
[IfFlag(4)] public DataJSON native_params;
+ /// Additional payment methods
[IfFlag(6)] public PaymentFormMethod[] additional_methods;
/// Saved server-side order information
[IfFlag(0)] public PaymentRequestedInfo saved_info;
@@ -9120,6 +9169,7 @@ namespace TL
[TLDef(0x9CC123C7)]
public class PhoneConnection : PhoneConnectionBase
{
+ /// Flags, see TL conditional fields
public Flags flags;
/// Endpoint ID
public long id;
@@ -9134,6 +9184,7 @@ namespace TL
[Flags] public enum Flags : uint
{
+ /// Whether TCP should be used
tcp = 0x1,
}
@@ -11584,7 +11635,7 @@ namespace TL
public BankCardOpenUrl[] open_urls;
}
- /// Dialog filter (folders) Derived classes: See
+ /// Dialog filter (folder ») Derived classes: , See
public abstract class DialogFilterBase : IObject { }
/// Dialog filter AKA folder See
[TLDef(0x7438F7E8)]
@@ -12058,6 +12109,7 @@ namespace TL
has_reply_to_peer_id = 0x1,
/// Field has a value
has_reply_to_top_id = 0x2,
+ /// Whether this message replies to a scheduled message
reply_to_scheduled = 0x4,
}
}
@@ -12879,6 +12931,7 @@ namespace TL
inactive = 0x1,
/// Field has a value
has_around_animation = 0x2,
+ /// Whether this reaction can only be used by Telegram Premium users
premium = 0x4,
}
}
@@ -12957,65 +13010,84 @@ namespace TL
public string key;
}
- /// See
+ /// Represents an attachment menu icon color for bot web apps » See
[TLDef(0x4576F3F0)]
public class AttachMenuBotIconColor : IObject
{
+ /// One of the following values:
light_icon - Color of the attachment menu icon (light mode)
light_text - Color of the attachment menu label, once selected (light mode)
dark_icon - Color of the attachment menu icon (dark mode)
dark_text - Color of the attachment menu label, once selected (dark mode)
public string name;
+ /// Color in RGB24 format
public int color;
}
- /// See
+ /// Represents an attachment menu icon for bot web apps » See
[TLDef(0xB2A7386B)]
public class AttachMenuBotIcon : IObject
{
+ /// Flags, see TL conditional fields
public Flags flags;
+ /// One of the following values: note that animated icons must be played when the user clicks on the button, activating the bot web app.
default_static - Default attachment menu icon in SVG format
placeholder_static - Default placeholder for opened Web Apps in SVG format
ios_static - Attachment menu icon in SVG format for the official iOS app
ios_animated - Animated attachment menu icon in TGS format for the official iOS app
android_animated - Animated attachment menu icon in TGS format for the official Android app
macos_animated - Animated attachment menu icon in TGS format for the official native Mac OS app
public string name;
+ /// The actual icon file.
public DocumentBase icon;
+ /// Attachment menu icon colors.
[IfFlag(0)] public AttachMenuBotIconColor[] colors;
[Flags] public enum Flags : uint
{
+ /// Field has a value
has_colors = 0x1,
}
}
- /// See
+ /// Represents a bot web app that can be launched from the attachment menu » See
[TLDef(0xC8AA2CD2)]
public class AttachMenuBot : IObject
{
+ /// Flags, see TL conditional fields
public Flags flags;
+ /// Bot ID
public long bot_id;
+ /// Attachment menu item name
public string short_name;
+ /// List of peer types where this attachment should be shown
public AttachMenuPeerType[] peer_types;
+ /// Attachment menu icon
public AttachMenuBotIcon[] icons;
[Flags] public enum Flags : uint
{
+ /// Whether this bot attachment menu entry should be shown in the attachment menu (toggle using messages.toggleBotInAttachMenu)
inactive = 0x1,
+ /// True, if the bot supports the "settings_button_pressed" event
has_settings = 0x2,
}
}
- /// See
+ /// Represents a list of bot web apps that can be launched from the attachment menu » See
/// a null value means attachMenuBotsNotModified
[TLDef(0x3C4301C0)]
public class AttachMenuBots : IObject
{
+ /// Hash for pagination, for more info click here
public long hash;
+ /// List of bot web apps that can be launched from the attachment menu »
public AttachMenuBot[] bots;
+ /// Info about related users/bots
public Dictionary users;
}
- /// See
+ /// Represents a bot web app that can be launched from the attachment menu » See
[TLDef(0x93BF667F)]
public class AttachMenuBotsBot : IObject
{
+ /// Represents a bot web app that can be launched from the attachment menu »
public AttachMenuBot bot;
+ /// Info about related users and bots
public Dictionary users;
}
- /// See
+ /// Contains information about a Web App Derived classes: See
public abstract class WebViewResult : IObject { }
/// See
[TLDef(0x0C14557C)]
@@ -13025,7 +13097,7 @@ namespace TL
public string url;
}
- /// See
+ /// Contains the webview URL with appropriate theme and user info parameters added Derived classes: See
public abstract class SimpleWebViewResult : IObject { }
/// See
[TLDef(0x882F76BB)]
@@ -13038,16 +13110,18 @@ namespace TL
[TLDef(0x0C94511C)]
public class WebViewMessageSent : IObject
{
+ /// Flags, see TL conditional fields
public Flags flags;
[IfFlag(0)] public InputBotInlineMessageIDBase msg_id;
[Flags] public enum Flags : uint
{
+ /// Field has a value
has_msg_id = 0x1,
}
}
- /// See
+ /// Indicates the action to execute when pressing the in-UI menu button for bots Derived classes: , , See
public abstract class BotMenuButtonBase : IObject { }
/// See
[TLDef(0x7533A588)]
@@ -13055,126 +13129,150 @@ namespace TL
/// See
[TLDef(0x4258C205)]
public class BotMenuButtonCommands : BotMenuButtonBase { }
- /// See
+ /// Indicates the action to execute when pressing the in-UI menu button for bots See
[TLDef(0xC7B57CE6)]
public class BotMenuButton : BotMenuButtonBase
{
+ /// Title to be displayed on the menu button instead of 'Menu'
public string text;
+ /// URL of a web app to open when the user clicks on the button
public string url;
}
- /// See
+ /// A list of saved notification sounds See
/// a null value means account.savedRingtonesNotModified
[TLDef(0xC1E92CC5)]
public class Account_SavedRingtones : IObject
{
+ /// Hash for pagination, for more info click here
public long hash;
+ /// Saved notification sounds
public DocumentBase[] ringtones;
}
- /// See
+ /// Represents a notification sound Derived classes: , , , See
public abstract class NotificationSound : IObject { }
- /// See
+ /// Indicates the default notification sound should be used See
[TLDef(0x97E8BEBE)]
public class NotificationSoundDefault : NotificationSound { }
- /// See
+ /// No notification sound should be used See
[TLDef(0x6F0C34DF)]
public class NotificationSoundNone : NotificationSound { }
- /// See
+ /// Indicates a specific local notification sound should be used See
[TLDef(0x830B9AE4)]
public class NotificationSoundLocal : NotificationSound
{
+ /// Notification sound title
public string title;
+ /// Notification sound identifier (arbitrary data used by the client to identify a specific local notification sound)
public string data;
}
- /// See
+ /// A specific previously uploaded notification sound should be used See
[TLDef(0xFF6C8049)]
public class NotificationSoundRingtone : NotificationSound
{
+ /// Document ID of notification sound uploaded using account.uploadRingtone
public long id;
}
- /// See
+ /// The notification sound was already in MP3 format and was saved without any modification See
[TLDef(0xB7263F6D)]
public class Account_SavedRingtone : IObject { }
- /// See
+ /// The notification sound was not in MP3 format and was successfully converted and saved, use the returned to refer to the notification sound from now on See
[TLDef(0x1F307EB7)]
public class Account_SavedRingtoneConverted : Account_SavedRingtone
{
+ /// The converted notification sound
public DocumentBase document;
}
- /// See
+ /// Indicates a supported peer type for a bot web app attachment menu See
public enum AttachMenuPeerType : uint
{
- ///See
+ ///The bot attachment menu entry is available in the chat with the bot that offers it
SameBotPM = 0x7D6BE90E,
- ///See
+ ///The bot attachment menu entry is available in private chats with other bots
BotPM = 0xC32BFA1A,
- ///See
+ ///The bot attachment menu entry is available in private chats with other users
PM = 0xF146D31F,
- ///See
+ ///The bot attachment menu entry is available in groups and supergroups
Chat = 0x0509113F,
- ///See
+ ///The bot attachment menu entry is available in channels
Broadcast = 0x7BFBDEFC,
}
- /// See
+ /// An invoice Derived classes: , See
public abstract class InputInvoice : IObject { }
- /// See
+ /// An invoice contained in a message. See
[TLDef(0xC5B56859)]
public class InputInvoiceMessage : InputInvoice
{
+ /// Chat where the invoice was sent
public InputPeer peer;
+ /// Message ID
public int msg_id;
}
- /// See
+ /// An invoice slug taken from a t.me/invoice/ link or from the premium_invoice_slug app config parameter » See
[TLDef(0xC326CAEF)]
public class InputInvoiceSlug : InputInvoice
{
+ /// The invoice slug
public string slug;
}
- /// See
+ /// Exported invoice See
[TLDef(0xAED0CBD9)]
public class Payments_ExportedInvoice : IObject
{
+ /// Exported invoice URL
public string url;
}
- /// See
+ /// Transcribed text from a voice message See
[TLDef(0x93752C52)]
public class Messages_TranscribedAudio : IObject
{
+ /// Flags, see TL conditional fields
public Flags flags;
+ /// Transcription ID
public long transcription_id;
+ /// Transcripted text
public string text;
[Flags] public enum Flags : uint
{
+ /// Whether the transcription is partial because audio transcription is still in progress, if set the user may receive further updates with the updated transcription.
pending = 0x1,
}
}
- /// See
+ /// Telegram Premium promotion information See
[TLDef(0x8A4F3C29)]
public class Help_PremiumPromo : IObject
{
+ /// Description of the current state of the user's Telegram Premium subscription
public string status_text;
+ /// Message entities for styled text
public MessageEntity[] status_entities;
+ /// A list of premium feature identifiers », associated to each video
public string[] video_sections;
+ /// A list of videos
public DocumentBase[] videos;
+ /// Three-letter ISO 4217 currency code
public string currency;
+ /// Monthly price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
public long monthly_amount;
+ /// Related user information
public Dictionary users;
}
- /// See
+ /// Info about a Telegram Premium purchase Derived classes: , See
public abstract class InputStorePaymentPurpose : IObject { }
- /// See
+ /// Info about a Telegram Premium purchase See
[TLDef(0xA6751E66)]
public class InputStorePaymentPremiumSubscription : InputStorePaymentPurpose
{
+ /// Flags, see TL conditional fields
public Flags flags;
[Flags] public enum Flags : uint
@@ -13182,33 +13280,41 @@ namespace TL
restore = 0x1,
}
}
- /// See
+ /// Info about a gifted Telegram Premium purchase See
[TLDef(0x616F7FE8)]
public class InputStorePaymentGiftPremium : InputStorePaymentPurpose
{
+ /// The user to which the Telegram Premium subscription was gifted
public InputUserBase user_id;
+ /// Three-letter ISO 4217 currency code
public string currency;
+ /// Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
public long amount;
}
- /// See
+ /// Telegram Premium gift option See
[TLDef(0x74C34319)]
public class PremiumGiftOption : IObject
{
+ /// Flags, see TL conditional fields
public Flags flags;
+ /// Duration of gifted Telegram Premium subscription
public int months;
+ /// Three-letter ISO 4217 currency code
public string currency;
+ /// Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
public long amount;
public string bot_url;
[IfFlag(0)] public string store_product;
[Flags] public enum Flags : uint
{
+ /// Field has a value
has_store_product = 0x1,
}
}
- /// See
+ /// Represents a payment method See
[TLDef(0x88F8F21B)]
public class PaymentFormMethod : IObject
{
diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs
index 9a6dfee..2dc4f09 100644
--- a/src/TL.SchemaFuncs.cs
+++ b/src/TL.SchemaFuncs.cs
@@ -337,7 +337,7 @@ namespace TL
{
});
- /// Updates user profile. See Possible codes: 400 (details)
+ /// Updates user profile. See Possible codes: 400,403 (details)
/// New user first name
/// New user last name
/// New bio
@@ -350,7 +350,7 @@ namespace TL
about = about,
});
- /// Updates online user status. See
+ /// Updates online user status. See Possible codes: 403 (details)
/// If is transmitted, user status will change to .
public static Task Account_UpdateStatus(this Client client, bool offline)
=> client.Invoke(new Account_UpdateStatus
@@ -686,13 +686,13 @@ namespace TL
code = code,
});
- /// Resend the code to verify an email to use as 2FA recovery method. See
+ /// Resend the code to verify an email to use as 2FA recovery method. See Possible codes: 400 (details)
public static Task Account_ResendPasswordEmail(this Client client)
=> client.Invoke(new Account_ResendPasswordEmail
{
});
- /// Cancel the code that was sent to verify an email to use as 2FA recovery method. See
+ /// Cancel the code that was sent to verify an email to use as 2FA recovery method. See Possible codes: 400 (details)
public static Task Account_CancelPasswordEmail(this Client client)
=> client.Invoke(new Account_CancelPasswordEmail
{
@@ -919,7 +919,7 @@ namespace TL
settings = settings,
});
- /// Report a profile photo of a dialog See
+ /// Report a profile photo of a dialog See Possible codes: 400 (details)
/// The dialog
/// Dialog photo ID
/// Report reason
@@ -975,7 +975,8 @@ namespace TL
call_requests_disabled = call_requests_disabled.GetValueOrDefault(),
});
- /// See
+ /// Fetch saved notification sounds See
+ /// Hash for pagination, for more info click here
/// a null value means account.savedRingtonesNotModified
public static Task Account_GetSavedRingtones(this Client client, long hash = default)
=> client.Invoke(new Account_GetSavedRingtones
@@ -983,7 +984,9 @@ namespace TL
hash = hash,
});
- /// See
+ /// Save or remove saved notification sound. See
+ /// Notification sound uploaded using account.uploadRingtone
+ /// Whether to add or delete the notification sound
public static Task Account_SaveRingtone(this Client client, InputDocument id, bool unsave)
=> client.Invoke(new Account_SaveRingtone
{
@@ -991,7 +994,10 @@ namespace TL
unsave = unsave,
});
- /// See
+ /// Upload notification sound, use account.saveRingtone to convert it and add it to the list of saved notification sounds. See
+ /// Notification sound
+ /// File name
+ /// MIME type of file
public static Task Account_UploadRingtone(this Client client, InputFileBase file, string file_name, string mime_type)
=> client.Invoke(new Account_UploadRingtone
{
@@ -1016,7 +1022,7 @@ namespace TL
id = id,
});
- /// Notify the user that the sent passport data contains some errors The user will not be able to re-submit their Passport data to you until the errors are fixed (the contents of the field for which you returned the error must change). See [bots: ✓] Possible codes: 400 (details)
+ /// Notify the user that the sent passport data contains some errors The user will not be able to re-submit their Passport data to you until the errors are fixed (the contents of the field for which you returned the error must change). See [bots: ✓] Possible codes: 400,403 (details)
/// The user
/// Errors
public static Task Users_SetSecureValueErrors(this Client client, InputUserBase id, params SecureValueErrorBase[] errors)
@@ -1217,7 +1223,7 @@ namespace TL
msg_id = msg_id,
});
- /// Resolve a phone number to get user info, if their privacy settings allow it. See
+ /// Resolve a phone number to get user info, if their privacy settings allow it. See Possible codes: (details)
/// Phone number in international format, possibly obtained from a t.me/+number or tg://resolve?phone=number URI.
public static Task Contacts_ResolvePhone(this Client client, string phone)
=> client.Invoke(new Contacts_ResolvePhone
@@ -1772,7 +1778,7 @@ namespace TL
stickerset = stickerset,
});
- /// Start a conversation with a bot using a deep linking parameter See Possible codes: 400,500 (details)
+ /// Start a conversation with a bot using a deep linking parameter See Possible codes: 400,403,500 (details)
/// The bot
/// The chat where to start the bot, can be the bot's private chat or a group
/// Random ID to avoid resending the same message
@@ -1845,6 +1851,7 @@ namespace TL
/// Reorder installed stickersets See
/// Reorder mask stickersets
+ /// Reorder custom emoji stickersets
/// New stickerset order by stickerset IDs
public static Task Messages_ReorderStickerSets(this Client client, long[] order, bool masks = false, bool emojis = false)
=> client.Invoke(new Messages_ReorderStickerSets
@@ -2106,6 +2113,7 @@ namespace TL
/// Get all archived stickers See
/// Get mask stickers
+ /// Get custom emoji stickers
/// Offsets for pagination, for more info click here
/// Maximum number of results to return, see pagination
public static Task Messages_GetArchivedStickers(this Client client, long offset_id = default, int limit = int.MaxValue, bool masks = false, bool emojis = false)
@@ -2730,7 +2738,7 @@ namespace TL
read_max_id = read_max_id,
});
- /// Unpin all pinned messages See [bots: ✓]
+ /// Unpin all pinned messages See [bots: ✓] Possible codes: 400 (details)
/// Chat where to unpin
public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer)
=> client.Invoke(new Messages_UnpinAllMessages
@@ -2754,7 +2762,7 @@ namespace TL
flags = (Messages_DeletePhoneCallHistory.Flags)(revoke ? 0x1 : 0),
});
- /// Obtains information about a chat export file, generated by a foreign chat app, click here for more info about imported chats ». See
+ /// Obtains information about a chat export file, generated by a foreign chat app, click here for more info about imported chats ». See Possible codes: 400 (details)
/// Beginning of the message file; up to 100 lines.
public static Task Messages_CheckHistoryImport(this Client client, string import_head)
=> client.Invoke(new Messages_CheckHistoryImport
@@ -2799,7 +2807,7 @@ namespace TL
import_id = import_id,
});
- /// Get info about the chat invites of a specific chat See Possible codes: 400 (details)
+ /// Get info about the chat invites of a specific chat See Possible codes: 400,403 (details)
/// Whether to fetch revoked chat invites
/// Chat
/// Whether to only fetch chat invites from this admin
@@ -2817,7 +2825,7 @@ namespace TL
limit = limit,
});
- /// Get info about a chat invite See Possible codes: 400 (details)
+ /// Get info about a chat invite See Possible codes: 400,403 (details)
/// Chat
/// Invite link
public static Task Messages_GetExportedChatInvite(this Client client, InputPeer peer, string link)
@@ -2847,7 +2855,7 @@ namespace TL
title = title,
});
- /// Delete all revoked chat invites See
+ /// Delete all revoked chat invites See Possible codes: 400 (details)
/// Chat
/// ID of the admin that originally generated the revoked chat invites
public static Task Messages_DeleteRevokedExportedChatInvites(this Client client, InputPeer peer, InputUserBase admin_id)
@@ -2875,7 +2883,7 @@ namespace TL
peer = peer,
});
- /// Get info about the users that joined the chat using a specific chat invite See Possible codes: 400 (details)
+ /// Get info about the users that joined the chat using a specific chat invite See Possible codes: 400,403 (details)
/// If set, only returns info about users with pending join requests »
/// Chat
/// Invite link
@@ -2973,7 +2981,7 @@ namespace TL
user_id = user_id,
});
- /// Dismiss or approve all join requests related to a specific chat or channel. See
+ /// Dismiss or approve all join requests related to a specific chat or channel. See Possible codes: 400,403 (details)
/// Whether to dismiss or approve all chat join requests »
/// The chat or channel
/// Only dismiss or approve join requests » initiated using this invite link
@@ -3005,7 +3013,7 @@ namespace TL
send_as = send_as,
});
- /// React to message See Possible codes: 400 (details)
+ /// React to message See Possible codes: 400,403 (details)
/// Whether a bigger and longer reaction should be shown
/// Peer
/// Message ID to react to
@@ -3019,7 +3027,7 @@ namespace TL
reaction = reaction,
});
- /// Get message reactions » See [bots: ✓]
+ /// Get message reactions » See
/// Peer
/// Message IDs
public static Task Messages_GetMessagesReactions(this Client client, InputPeer peer, int[] id)
@@ -3029,7 +3037,7 @@ namespace TL
id = id,
});
- /// Get message reaction list, along with the sender of each reaction. See
+ /// Get message reaction list, along with the sender of each reaction. See Possible codes: 400,403 (details)
/// Peer
/// Message ID
/// Get only reactions of this type (UTF8 emoji)
@@ -3046,7 +3054,7 @@ namespace TL
limit = limit,
});
- /// Change the set of message reactions » that can be used in a certain group, supergroup or channel See
+ /// Change the set of message reactions » that can be used in a certain group, supergroup or channel See Possible codes: 400 (details)
/// Group where to apply changes
/// Allowed reaction emojis
public static Task Messages_SetChatAvailableReactions(this Client client, InputPeer peer, string[] available_reactions)
@@ -3073,7 +3081,7 @@ namespace TL
reaction = reaction,
});
- /// Translate a given text See [bots: ✓]
+ /// Translate a given text See Possible codes: 400 (details)
/// If the text is a chat message, the peer ID
/// If the text is a chat message, the message ID
/// The text to translate
@@ -3090,7 +3098,7 @@ namespace TL
to_lang = to_lang,
});
- /// Get unread reactions to messages you sent See [bots: ✓]
+ /// Get unread reactions to messages you sent See
/// Peer
/// Offsets for pagination, for more info click here
/// Offsets for pagination, for more info click here
@@ -3108,7 +3116,7 @@ namespace TL
min_id = min_id,
});
- /// Mark message reactions » as read See [bots: ✓]
+ /// Mark message reactions » as read See
/// Peer
public static Task Messages_ReadReactions(this Client client, InputPeer peer)
=> client.Invoke(new Messages_ReadReactions
@@ -3128,7 +3136,8 @@ namespace TL
limit = limit,
});
- /// See
+ /// Returns installed attachment menu bot web apps » See
+ /// Hash for pagination, for more info click here
/// a null value means attachMenuBotsNotModified
public static Task Messages_GetAttachMenuBots(this Client client, long hash = default)
=> client.Invoke(new Messages_GetAttachMenuBots
@@ -3136,14 +3145,17 @@ namespace TL
hash = hash,
});
- /// See
+ /// Returns attachment menu entry for a bot web app that can be launched from the attachment menu » See Possible codes: 400 (details)
+ /// Bot ID
public static Task Messages_GetAttachMenuBot(this Client client, InputUserBase bot)
=> client.Invoke(new Messages_GetAttachMenuBot
{
bot = bot,
});
- /// See
+ /// Enable or disable web bot attachment menu » See
+ /// Bot ID
+ /// Toggle
public static Task Messages_ToggleBotInAttachMenu(this Client client, InputUserBase bot, bool enabled)
=> client.Invoke(new Messages_ToggleBotInAttachMenu
{
@@ -3187,7 +3199,7 @@ namespace TL
theme_params = theme_params,
});
- /// ⚠ This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a See
+ /// ⚠ This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a See [bots: ✓] Possible codes: 400 (details)
public static Task Messages_SendWebViewResultMessage(this Client client, string bot_query_id, InputBotInlineResultBase result)
=> client.Invoke(new Messages_SendWebViewResultMessage
{
@@ -3205,7 +3217,9 @@ namespace TL
data = data,
});
- /// See
+ /// Transcribe voice message See
+ /// Peer ID where the voice message was sent
+ /// Voice message ID
public static Task Messages_TranscribeAudio(this Client client, InputPeer peer, int msg_id)
=> client.Invoke(new Messages_TranscribeAudio
{
@@ -3213,7 +3227,11 @@ namespace TL
msg_id = msg_id,
});
- /// See
+ /// Rate transcribed voice message See
+ /// Peer where the voice message was sent
+ /// Message ID
+ /// Transcription ID
+ /// Whether the transcription was correct
public static Task Messages_RateTranscribedAudio(this Client client, InputPeer peer, int msg_id, long transcription_id, bool good)
=> client.Invoke(new Messages_RateTranscribedAudio
{
@@ -3223,14 +3241,16 @@ namespace TL
good = good,
});
- /// See
+ /// Fetch info about custom emojis. See [bots: ✓]
+ /// Custom emoji IDs from a .
public static Task Messages_GetCustomEmojiDocuments(this Client client, long[] document_id)
=> client.Invoke(new Messages_GetCustomEmojiDocuments
{
document_id = document_id,
});
- /// See
+ /// Gets the list of currently installed custom emoji stickersets. See
+ /// Hash for pagination, for more info click here
/// a null value means messages.allStickersNotModified
public static Task Messages_GetEmojiStickers(this Client client, long hash = default)
=> client.Invoke(new Messages_GetEmojiStickers
@@ -3238,7 +3258,8 @@ namespace TL
hash = hash,
});
- /// See
+ /// Gets featured custom emoji stickersets. See
+ /// Hash for pagination, for more info click here
public static Task Messages_GetFeaturedEmojiStickers(this Client client, long hash = default)
=> client.Invoke(new Messages_GetFeaturedEmojiStickers
{
@@ -3390,7 +3411,7 @@ namespace TL
limit = limit,
});
- /// Request a reupload of a certain file to a CDN DC. See [bots: ✓] Possible codes: 400 (details)
+ /// Request a reupload of a certain file to a CDN DC. See [bots: ✓] Possible codes: 400,500 (details)
/// File token
/// Request token
public static Task Upload_ReuploadCdnFile(this Client client, byte[] file_token, byte[] request_token)
@@ -3594,7 +3615,7 @@ namespace TL
hash = hash,
});
- /// See
+ /// Get Telegram Premim promotion information See
public static Task Help_GetPremiumPromo(this Client client)
=> client.Invoke(new Help_GetPremiumPromo
{
@@ -3877,6 +3898,7 @@ namespace TL
});
/// Delete the history of a supergroup See Possible codes: 400 (details)
+ /// Whether the history should be deleted for everyone
/// Supergroup whose history must be deleted
/// ID of message up to which the history must be deleted
public static Task Channels_DeleteHistory(this Client client, InputChannelBase channel, int max_id = default, bool for_everyone = false)
@@ -3961,7 +3983,7 @@ namespace TL
{
});
- /// Convert a supergroup to a gigagroup, when requested by channel suggestions. See Possible codes: 400 (details)
+ /// Convert a supergroup to a gigagroup, when requested by channel suggestions. See Possible codes: 400,403 (details)
/// The supergroup to convert
public static Task Channels_ConvertToGigagroup(this Client client, InputChannelBase channel)
=> client.Invoke(new Channels_ConvertToGigagroup
@@ -3987,7 +4009,7 @@ namespace TL
channel = channel,
});
- /// Obtains a list of peers that can be used to send messages in a specific group See [bots: ✓] Possible codes: 400 (details)
+ /// Obtains a list of peers that can be used to send messages in a specific group See Possible codes: 400 (details)
/// The group where we intend to send messages
public static Task Channels_GetSendAs(this Client client, InputPeer peer)
=> client.Invoke(new Channels_GetSendAs
@@ -3995,7 +4017,7 @@ namespace TL
peer = peer,
});
- /// Delete all messages sent by a specific participant of a given supergroup See [bots: ✓] Possible codes: 400 (details)
+ /// Delete all messages sent by a specific participant of a given supergroup See Possible codes: 400,403 (details)
/// Supergroup
/// The participant whose messages should be deleted
public static Task Channels_DeleteParticipantHistory(this Client client, InputChannelBase channel, InputPeer participant)
@@ -4005,7 +4027,9 @@ namespace TL
participant = participant,
});
- /// See
+ /// Set whether all users should join a discussion group in order to comment on a post » See
+ /// Discussion group
+ /// Toggle
public static Task Channels_ToggleJoinToSend(this Client client, InputChannelBase channel, bool enabled)
=> client.Invoke(new Channels_ToggleJoinToSend
{
@@ -4013,7 +4037,9 @@ namespace TL
enabled = enabled,
});
- /// See
+ /// Set whether all users should request admin approval to join the group ». See
+ /// Group
+ /// Toggle
public static Task Channels_ToggleJoinRequest(this Client client, InputChannelBase channel, bool enabled)
=> client.Invoke(new Channels_ToggleJoinRequest
{
@@ -4063,7 +4089,7 @@ namespace TL
lang_code = lang_code,
});
- /// Obtain a list of bot commands for the specified bot scope and language code See [bots: ✓]
+ /// Obtain a list of bot commands for the specified bot scope and language code See [bots: ✓] Possible codes: 400 (details)
/// Command scope
/// Language code
public static Task Bots_GetBotCommands(this Client client, BotCommandScope scope, string lang_code)
@@ -4073,7 +4099,9 @@ namespace TL
lang_code = lang_code,
});
- /// See
+ /// Sets the menu button action for a given user or for all users See [bots: ✓]
+ /// User ID
+ /// Bot menu button action
public static Task Bots_SetBotMenuButton(this Client client, InputUserBase user_id, BotMenuButtonBase button)
=> client.Invoke(new Bots_SetBotMenuButton
{
@@ -4081,21 +4109,24 @@ namespace TL
button = button,
});
- /// See
+ /// Gets the menu button action for a given user or for all users, previously set using bots.setBotMenuButton; users can see this information in the . See [bots: ✓] Possible codes: 400 (details)
+ /// User ID or empty for the default menu button.
public static Task Bots_GetBotMenuButton(this Client client, InputUserBase user_id)
=> client.Invoke(new Bots_GetBotMenuButton
{
user_id = user_id,
});
- /// See
+ /// Set the default suggested admin rights for bots being added as admins to channels. See [bots: ✓] Possible codes: (details)
+ /// Admin rights
public static Task Bots_SetBotBroadcastDefaultAdminRights(this Client client, ChatAdminRights admin_rights)
=> client.Invoke(new Bots_SetBotBroadcastDefaultAdminRights
{
admin_rights = admin_rights,
});
- /// See
+ /// Set the default suggested admin rights for bots being added as admins to groups. See [bots: ✓] Possible codes: (details)
+ /// Admin rights
public static Task Bots_SetBotGroupDefaultAdminRights(this Client client, ChatAdminRights admin_rights)
=> client.Invoke(new Bots_SetBotGroupDefaultAdminRights
{
@@ -4103,6 +4134,7 @@ namespace TL
});
/// Get a payment form See Possible codes: 400 (details)
+ /// Invoice
/// A JSON object with the following keys, containing color theme information (integers, RGB24) to pass to the payment provider, to apply in eventual verification pages:
bg_color - Background color
text_color - Text color
hint_color - Hint text color
link_color - Link color
button_color - Button color
button_text_color - Button text color
public static Task Payments_GetPaymentForm(this Client client, InputInvoice invoice, DataJSON theme_params = null)
=> client.Invoke(new Payments_GetPaymentForm
@@ -4124,6 +4156,7 @@ namespace TL
/// Submit requested order information for validation See Possible codes: 400 (details)
/// Save order information to re-use it for future orders
+ /// Invoice
/// Requested order information
public static Task Payments_ValidateRequestedInfo(this Client client, InputInvoice invoice, PaymentRequestedInfo info, bool save = false)
=> client.Invoke(new Payments_ValidateRequestedInfo
@@ -4135,6 +4168,7 @@ namespace TL
/// Send compiled payment form See Possible codes: 400 (details)
/// Form ID
+ /// Invoice
/// ID of saved and validated
/// Chosen shipping option ID
/// Payment credentials
@@ -4174,7 +4208,8 @@ namespace TL
number = number,
});
- /// See
+ /// Export invoice See [bots: ✓] Possible codes: 400 (details)
+ /// Invoice
public static Task Payments_ExportInvoice(this Client client, InputMedia invoice_media)
=> client.Invoke(new Payments_ExportInvoice
{
@@ -4350,7 +4385,7 @@ namespace TL
peer = peer,
});
- /// Refuse or end running call See Possible codes: 400 (details)
+ /// Refuse or end running call See Possible codes: 400,500 (details)
/// Whether this is a video call
/// The phone call
/// Call duration
@@ -4416,7 +4451,7 @@ namespace TL
schedule_date = schedule_date.GetValueOrDefault(),
});
- /// Join a group call See Possible codes: 400 (details)
+ /// Join a group call See Possible codes: 400,403 (details)
/// If set, the user will be muted by default upon joining.
/// If set, the user's video will be disabled by default upon joining.
/// The group call
@@ -4453,7 +4488,7 @@ namespace TL
users = users,
});
- /// Terminate a group call See
+ /// Terminate a group call See Possible codes: 400 (details)
/// The group call to terminate
public static Task Phone_DiscardGroupCall(this Client client, InputGroupCall call)
=> client.Invoke(new Phone_DiscardGroupCall
@@ -4499,7 +4534,7 @@ namespace TL
limit = limit,
});
- /// Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs See
+ /// Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs See Possible codes: 400 (details)
/// Group call
/// Source IDs
public static Task Phone_CheckGroupCall(this Client client, InputGroupCall call, int[] sources)
@@ -4509,7 +4544,7 @@ namespace TL
sources = sources,
});
- /// Start or stop recording a group call: the recorded audio and video streams will be automatically sent to Saved messages (the chat with ourselves). See
+ /// Start or stop recording a group call: the recorded audio and video streams will be automatically sent to Saved messages (the chat with ourselves). See Possible codes: 400,403 (details)
/// Whether to start or stop recording
/// Whether to also record video streams
/// The group call or livestream
@@ -4524,7 +4559,7 @@ namespace TL
video_portrait = video_portrait.GetValueOrDefault(),
});
- /// Edit information about a given group call participant See Possible codes: 400 (details)
+ /// Edit information about a given group call participant See Possible codes: 400,403 (details)
/// The group call
/// The group call participant (can also be the user itself)
/// Whether to mute or unmute the specified participant
@@ -4547,7 +4582,7 @@ namespace TL
presentation_paused = presentation_paused.GetValueOrDefault(),
});
- /// Edit the title of a group call or livestream See
+ /// Edit the title of a group call or livestream See Possible codes: 403 (details)
/// Group call
/// New title
public static Task Phone_EditGroupCallTitle(this Client client, InputGroupCall call, string title)
@@ -4557,7 +4592,7 @@ namespace TL
title = title,
});
- /// Get a list of peers that can be used to join a group call, presenting yourself as a specific user/channel. See
+ /// Get a list of peers that can be used to join a group call, presenting yourself as a specific user/channel. See Possible codes: 400 (details)
/// The dialog whose group call or livestream we're trying to join
public static Task Phone_GetGroupCallJoinAs(this Client client, InputPeer peer)
=> client.Invoke(new Phone_GetGroupCallJoinAs
@@ -4575,7 +4610,7 @@ namespace TL
call = call,
});
- /// Subscribe or unsubscribe to a scheduled group call See
+ /// Subscribe or unsubscribe to a scheduled group call See Possible codes: 403 (details)
/// Scheduled group call
/// Enable or disable subscription
public static Task Phone_ToggleGroupCallStartSubscription(this Client client, InputGroupCall call, bool subscribed)
@@ -4593,7 +4628,7 @@ namespace TL
call = call,
});
- /// Set the default peer that will be used to join a group call in a specific dialog. See
+ /// Set the default peer that will be used to join a group call in a specific dialog. See Possible codes: 400 (details)
/// The dialog
/// The default peer that will be used to join group calls in this dialog, presenting yourself as a specific user/channel.
public static Task Phone_SaveDefaultGroupCallJoinAs(this Client client, InputPeer peer, InputPeer join_as)
@@ -4629,7 +4664,7 @@ namespace TL
call = call,
});
- /// Get RTMP URL and stream key for RTMP livestreams. Can be used even before creating the actual RTMP livestream with phone.createGroupCall (the rtmp_stream flag must be set). See
+ /// Get RTMP URL and stream key for RTMP livestreams. Can be used even before creating the actual RTMP livestream with phone.createGroupCall (the rtmp_stream flag must be set). See Possible codes: 400 (details)
/// Peer to livestream into
/// Whether to revoke the previous stream key or simply return the existing one
public static Task Phone_GetGroupCallStreamRtmpUrl(this Client client, InputPeer peer, bool revoke)
@@ -4639,7 +4674,9 @@ namespace TL
revoke = revoke,
});
- /// See
+ /// Save phone call debug information See
+ /// Phone call
+ /// Logs
public static Task Phone_SaveCallLog(this Client client, InputPhoneCall peer, InputFileBase file)
=> client.Invoke(new Phone_SaveCallLog
{
@@ -4689,7 +4726,7 @@ namespace TL
lang_pack = lang_pack,
});
- /// Get information about a language in a localization pack See
+ /// Get information about a language in a localization pack See Possible codes: 400 (details)
/// Language pack name
/// Language code
public static Task Langpack_GetLanguage(this Client client, string lang_pack, string lang_code)
From f1448ac517355a2530763f73c316f78d15ba3941 Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Fri, 12 Aug 2022 21:19:10 +0200
Subject: [PATCH 021/390] minor documentation update
---
EXAMPLES.md | 34 +++++++++++++++----------------
Examples/Program_ListenUpdates.cs | 1 +
src/Client.cs | 6 +++---
3 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/EXAMPLES.md b/EXAMPLES.md
index 5f0bc5f..bbea892 100644
--- a/EXAMPLES.md
+++ b/EXAMPLES.md
@@ -59,7 +59,7 @@ var sent2 = await client.SendMessageAsync(InputPeer.Self, text2, entities: entit
// if you need to convert a sent/received Message to Markdown: (easier to store)
text2 = client.EntitiesToMarkdown(sent2.message, sent2.entities);
```
-See [MarkdownV2 formatting style](https://core.telegram.org/bots/api/#markdownv2-style) and [HTML formatting style](https://core.telegram.org/bots/api/#html-style) for details.
+See [HTML formatting style](https://core.telegram.org/bots/api/#html-style) and [MarkdownV2 formatting style](https://core.telegram.org/bots/api/#markdownv2-style) for details.
*Note: For the `tg://user?id=` notation to work, that user's access hash must have been collected first ([see below](#collect-access-hash))*
@@ -112,7 +112,7 @@ await Task.Delay(5000);
```
-### List all chats (groups/channels) the user is in and send a message to one
+### List all chats (groups/channels NOT users) that we joined and send a message to one
```csharp
var chats = await client.Messages_GetAllChats();
foreach (var (id, chat) in chats.chats)
@@ -129,6 +129,21 @@ Notes:
but the old `Chat` will be marked with flag [deactivated] and should not be used anymore. See [Terminology in ReadMe](README.md#terminology).
- You can find a longer version of this method call in [Examples/Program_GetAllChats.cs](Examples/Program_GetAllChats.cs)
+
+### List all dialogs (chats/groups/channels/user chat) we are currently in
+```csharp
+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_GetAllDialogs contains the `access_hash` for those chats and users.*
+See also the `Main` method in [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs).
+
### Schedule a message to be sent to a chat
```csharp
@@ -171,21 +186,6 @@ await client.SendAlbumAsync(InputPeer.Self, inputMedias, "My first album");
```
*Note: Don't mix Photos and file Documents in your album, it doesn't work well*
-
-### List all dialogs (chats/groups/channels/user chat) the user is in
-```csharp
-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_GetAllDialogs contains the `access_hash` for those chats and users.*
-See also the `Main` method in [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs).
-
### Get all members from a chat
For a basic Chat: *(see Terminology in [ReadMe](README.md#terminology))*
diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs
index 9060e7b..fd25eb6 100644
--- a/Examples/Program_ListenUpdates.cs
+++ b/Examples/Program_ListenUpdates.cs
@@ -42,6 +42,7 @@ namespace WTelegramClientTest
{
case UpdateNewMessage unm: await DisplayMessage(unm.message); break;
case UpdateEditMessage uem: await DisplayMessage(uem.message, true); break;
+ // Note: UpdateNewChannelMessage and UpdateEditChannelMessage are also handled by above cases
case UpdateDeleteChannelMessages udcm: Console.WriteLine($"{udcm.messages.Length} message(s) deleted in {Chat(udcm.channel_id)}"); break;
case UpdateDeleteMessages udm: Console.WriteLine($"{udm.messages.Length} message(s) deleted"); break;
case UpdateUserTyping uut: Console.WriteLine($"{User(uut.user_id)} is {uut.action}"); break;
diff --git a/src/Client.cs b/src/Client.cs
index d766895..a1be6f9 100644
--- a/src/Client.cs
+++ b/src/Client.cs
@@ -690,8 +690,8 @@ namespace WTelegram
return tcpClient;
}
- /// Establish connection to Telegram servers
- /// Config callback is queried for: server_address
+ /// Establish connection to Telegram servers without negociating a user session
+ /// Usually you shouldn't need to call this method: Use LoginUserIfNeeded instead.
Config callback is queried for: server_address
/// Most methods of this class are async (Task), so please use
public async Task ConnectAsync()
{
@@ -893,7 +893,7 @@ namespace WTelegram
}
/// Login as a user (if not already logged-in).
- ///
(this method calls ConnectAsync if necessary)
+ ///
(this method calls ConnectAsync if necessary)
/// Config callback is queried for: phone_number, verification_code
and eventually first_name, last_name (signup required), password (2FA auth), user_id (alt validation)
/// (optional) Preference for verification_code sending
/// Proceed to logout and login if active user session cannot be resumed successfully
From 97bd76cf0f9d692d4599de97f4f3e03ba98d0415 Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Sat, 13 Aug 2022 01:20:53 +0200
Subject: [PATCH 022/390] Minor code cleaning
---
src/Client.cs | 3 ---
src/Compat.cs | 2 +-
src/Encryption.cs | 12 ++++++------
src/TL.SchemaFuncs.cs | 3 ++-
4 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/src/Client.cs b/src/Client.cs
index a1be6f9..8b27bb0 100644
--- a/src/Client.cs
+++ b/src/Client.cs
@@ -17,9 +17,6 @@ using System.Web;
using TL;
using static WTelegram.Encryption;
-// necessary for .NET Standard 2.0 compilation:
-#pragma warning disable CA1835 // Prefer the 'Memory'-based overloads for 'ReadAsync' and 'WriteAsync'
-
namespace WTelegram
{
public partial class Client : IDisposable
diff --git a/src/Compat.cs b/src/Compat.cs
index c33a9bb..c4db45b 100644
--- a/src/Compat.cs
+++ b/src/Compat.cs
@@ -16,7 +16,7 @@ namespace WTelegram
internal static IPEndPoint IPEndPoint_Parse(string addr) => IPEndPoint.Parse(addr);
}
}
-#else
+#else // Compatibility shims for methods missing in netstandard2.0:
namespace WTelegram
{
static class Compat
diff --git a/src/Encryption.cs b/src/Encryption.cs
index 9211776..dd340f7 100644
--- a/src/Encryption.cs
+++ b/src/Encryption.cs
@@ -64,7 +64,7 @@ namespace WTelegram
using var writer = new BinaryWriter(clearStream, Encoding.UTF8);
byte[] aes_key = new byte[32], zero_iv = new byte[32];
var n = BigEndianInteger(publicKey.n);
- while (encrypted_data == null)
+ do
{
RNG.GetBytes(aes_key);
clearStream.Position = 0;
@@ -84,7 +84,7 @@ namespace WTelegram
var x = BigEndianInteger(clearBuffer);
if (x < n) // if good result, encrypt with RSA key:
encrypted_data = BigInteger.ModPow(x, BigEndianInteger(publicKey.e), n).To256Bytes();
- } // otherwise, repeat the steps
+ } while (encrypted_data == null); // otherwise, repeat the steps
}
var serverDHparams = await client.ReqDHParams(pqInnerData.nonce, pqInnerData.server_nonce, pqInnerData.p, pqInnerData.q, fingerprint, encrypted_data);
//5)
@@ -95,11 +95,11 @@ namespace WTelegram
var (tmp_aes_key, tmp_aes_iv) = ConstructTmpAESKeyIV(resPQ.server_nonce, pqInnerData.new_nonce);
var answer = AES_IGE_EncryptDecrypt(serverDHparamsOk.encrypted_answer, tmp_aes_key, tmp_aes_iv, false);
- using var encryptedReader = new TL.BinaryReader(new MemoryStream(answer), client);
- var answerHash = encryptedReader.ReadBytes(20);
- var answerObj = encryptedReader.ReadTLObject();
+ using var answerReader = new TL.BinaryReader(new MemoryStream(answer), client);
+ var answerHash = answerReader.ReadBytes(20);
+ var answerObj = answerReader.ReadTLObject();
if (answerObj is not ServerDHInnerData serverDHinnerData) throw new ApplicationException("not server_DH_inner_data");
- long padding = encryptedReader.BaseStream.Length - encryptedReader.BaseStream.Position;
+ long padding = answerReader.BaseStream.Length - answerReader.BaseStream.Position;
if (padding >= 16) throw new ApplicationException("Too much pad");
if (!Enumerable.SequenceEqual(sha1.ComputeHash(answer, 20, answer.Length - (int)padding - 20), answerHash))
throw new ApplicationException("Answer SHA1 mismatch");
diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs
index 2dc4f09..fe44547 100644
--- a/src/TL.SchemaFuncs.cs
+++ b/src/TL.SchemaFuncs.cs
@@ -413,8 +413,9 @@ namespace TL
rules = rules,
});
- /// Delete the user's account from the telegram servers. Can be used, for example, to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured. See Possible codes: 420 (details)
+ /// Delete the user's account from the telegram servers. See Possible codes: 420 (details)
/// Why is the account being deleted, can be empty
+ /// 2FA password: this field can be omitted even for accounts with 2FA enabled: in this case account account deletion will be delayed by 7 days as specified in the docs »
public static Task Account_DeleteAccount(this Client client, string reason, InputCheckPasswordSRP password = null)
=> client.Invoke(new Account_DeleteAccount
{
From ace31a3213e4d22b1c47985e31e296cb827ec197 Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Mon, 29 Aug 2022 02:37:30 +0200
Subject: [PATCH 023/390] Reset _bareRpc too
---
src/Client.cs | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/Client.cs b/src/Client.cs
index 8b27bb0..4ec2223 100644
--- a/src/Client.cs
+++ b/src/Client.cs
@@ -190,6 +190,7 @@ namespace WTelegram
#endif
_paddedMode = false;
_connecting = null;
+ _bareRpc = null;
if (resetSessions)
{
foreach (var altSession in _session.DCSessions.Values)
From 983c9a4c6b35fa1586beac5a920834d35e2952fe Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Tue, 30 Aug 2022 15:15:43 +0200
Subject: [PATCH 024/390] Safety check on bareRpc <-> unencrypted
---
src/Client.cs | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/src/Client.cs b/src/Client.cs
index 4ec2223..9e6fbc1 100644
--- a/src/Client.cs
+++ b/src/Client.cs
@@ -370,10 +370,11 @@ namespace WTelegram
int length = reader.ReadInt32();
dataLen -= 20;
if (length > dataLen || length < dataLen - (_paddedMode ? 15 : 0))
- throw new ApplicationException($"Unexpected unencrypted length {length} != {dataLen}");
+ throw new ApplicationException($"Unexpected unencrypted/padding length {dataLen} - {length}");
var obj = reader.ReadTLObject();
Helpers.Log(1, $"{_dcSession.DcID}>Receiving {obj.GetType().Name,-40} {MsgIdToStamp(msgId):u} clear{((msgId & 2) == 0 ? "" : " NAR")}");
+ if (_bareRpc == null) throw new ApplicationException("Shouldn't receive unencrypted packet at this point");
return obj;
}
else
@@ -384,7 +385,7 @@ namespace WTelegram
_sha256Recv.TransformBlock(_dcSession.AuthKey, 96, 32, null, 0);
_sha256Recv.TransformFinalBlock(decrypted_data, 0, decrypted_data.Length);
if (!data.AsSpan(8, 16).SequenceEqual(_sha256Recv.Hash.AsSpan(8, 16)))
- throw new ApplicationException($"Mismatch between MsgKey & decrypted SHA256");
+ throw new ApplicationException("Mismatch between MsgKey & decrypted SHA256");
_sha256Recv.Initialize();
using var reader = new TL.BinaryReader(new MemoryStream(decrypted_data), this);
var serverSalt = reader.ReadInt64(); // int64 salt
@@ -412,7 +413,7 @@ namespace WTelegram
_dcSession.Salt = serverSalt;
_saltChangeCounter += 20; // counter is decreased by KeepAlive every minute (we have margin of 10)
if (_saltChangeCounter >= 30)
- throw new ApplicationException($"Server salt changed too often! Security issue?");
+ throw new ApplicationException("Server salt changed too often! Security issue?");
}
if ((seqno & 1) != 0) lock (_msgsToAck) _msgsToAck.Add(msgId);
@@ -558,6 +559,15 @@ namespace WTelegram
private async Task HandleMessageAsync(IObject obj)
{
+ if (_bareRpc != null)
+ {
+ var rpc = PullPendingRequest(_bareRpc.msgId);
+ if ((rpc?.type.IsAssignableFrom(obj.GetType())) != true)
+ throw new ApplicationException($"Received a {obj.GetType()} incompatible with expected bare {rpc?.type}");
+ _bareRpc = null;
+ rpc.tcs.SetResult(obj);
+ return;
+ }
switch (obj)
{
case MsgContainer container:
@@ -634,18 +644,6 @@ namespace WTelegram
RaiseUpdate(obj);
break;
default:
- if (_bareRpc != null)
- {
- var rpc = PullPendingRequest(_bareRpc.msgId);
- if (rpc?.type.IsAssignableFrom(obj.GetType()) == true)
- {
- _bareRpc = null;
- rpc.tcs.SetResult(obj);
- break;
- }
- else
- Helpers.Log(4, $"Received a {obj.GetType()} incompatible with expected bare {rpc?.type}");
- }
RaiseUpdate(obj);
break;
}
@@ -1067,6 +1065,7 @@ namespace WTelegram
if (_dcSession.AuthKeyID == 0) // send unencrypted message
{
+ if (_bareRpc == null) throw new ApplicationException($"Shouldn't send a {msg.GetType().Name} unencrypted");
writer.Write(0L); // int64 auth_key_id = 0 (Unencrypted)
writer.Write(msgId); // int64 message_id
writer.Write(0); // int32 message_data_length (to be patched)
From 222d24c9a633e853863c0dc5f58c0230d84ad9f4 Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Fri, 2 Sep 2022 23:02:44 +0200
Subject: [PATCH 025/390] updated Intellisense / doc
---
EXAMPLES.md | 8 +-
Examples/Program_Heroku.cs | 10 +-
FAQ.md | 5 +-
README.md | 6 +-
src/Client.cs | 2 +-
src/TL.Schema.cs | 233 +++++++++++++++++++++----------------
src/TL.SchemaFuncs.cs | 143 ++++++++++++++---------
src/TL.Secret.cs | 4 +-
src/WTelegramClient.csproj | 2 +-
9 files changed, 235 insertions(+), 178 deletions(-)
diff --git a/EXAMPLES.md b/EXAMPLES.md
index bbea892..1415cd4 100644
--- a/EXAMPLES.md
+++ b/EXAMPLES.md
@@ -26,7 +26,7 @@ More examples can also be found in the [Examples folder](Examples) and in answer
var resolved = await client.Contacts_ResolveUsername("MyEch0_Bot"); // username without the @
await client.SendMessageAsync(resolved, "/start");
```
-*Note: This also works if the @username points to a channel/group, but you must already have joined that channel before posting there.
+*Note: This also works if the @username points to a channel/group, but you must already have joined that channel before sending a message to it.
If the username is invalid/unused, the API call raises an exception.*
@@ -210,7 +210,7 @@ for (int offset = 0; ;)
```
For big Channel/Group, Telegram servers might limit the number of members you can obtain with the normal above method.
-In this case, you can use this helper method, but it can take several minutes to complete:
+In this case, you can use the following helper method, but it can take several minutes to complete:
```csharp
var chats = await client.Messages_GetAllChats();
var channel = (Channel)chats.chats[1234567890]; // the channel we want
@@ -233,7 +233,7 @@ To use them, you need to extract the `HASH` part from the URL and then you can u
```csharp
var chatInvite = await client.Messages_CheckChatInvite("HASH"); // optional: get information before joining
await client.Messages_ImportChatInvite("HASH"); // join the channel/group
-// Note: This works also with invite links of public channel/group
+// Note: This works also with hash invite links of public channel/group
```
@@ -319,7 +319,7 @@ Your event handler implementation can either return `Task.CompletedTask` or be a
See [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs).
-### Monitor new messages being posted in chats
+### Monitor new messages being posted in chats in real-time
You have to handle `client.OnUpdate` events containing an `UpdateNewMessage`.
diff --git a/Examples/Program_Heroku.cs b/Examples/Program_Heroku.cs
index 2eef6c3..cfdb551 100644
--- a/Examples/Program_Heroku.cs
+++ b/Examples/Program_Heroku.cs
@@ -6,7 +6,7 @@ using System.Threading;
using System.Threading.Tasks;
using TL;
-// This is an example userbot designed to run on a free Heroku account with a free PostgreSQL database for session storage
+// This is an example userbot designed to run on a Heroku account with a PostgreSQL database for session storage
// This userbot simply answer "Pong" when someone sends him a "Ping" private message (or in Saved Messages)
// To use/install/deploy this userbot, follow the steps at the end of this file
// When run locally, close the window or type ALT-F4 to exit cleanly and save session (similar to Heroku SIGTERM)
@@ -126,8 +126,8 @@ namespace WTelegramClientTest
/******************************************************************************************************************************
HOW TO USE AND DEPLOY THIS EXAMPLE HEROKU USERBOT:
-- From your free Heroku.com account dashboard, create a new app (Free)
-- Navigate to the app Resources and add the add-on "Heroku Postgres" (Hobby Dev - Free)
+- From your Heroku.com account dashboard, create a new app
+- Navigate to the app Resources and add the add-on "Heroku Postgres"
- Navigate to the app Settings, click Reveal Config Vars and save the Heroku git URL and the value of DATABASE_URL
- Add a new var named "api_hash" with your api hash obtained from https://my.telegram.org/apps
- Add a new var named "phone_number" with the phone_number of the user this userbot will manage
@@ -146,9 +146,7 @@ HOW TO USE AND DEPLOY THIS EXAMPLE HEROKU USERBOT:
- Paste inside the line you copied, and replace the initial "web" with "worker:" (don't forget the colon)
- Commit and push the Git changes to Heroku. Wait until the deployment is complete.
- Verify that the Resources "web" line has changed to "worker" and is enabled (use the pencil icon if necessary)
-- Now your userbot should be running 24/7. Note however that a full month of usage is 31*24 = 744 dyno hours.
- By default a free account gets 550 free dyno hours per month after which your app is stopped. If you register
- a credit card with your account, 450 additional free dyno hours are offered at no charge, which should be enough for 24/7
+- Now your userbot should be running 24/7.
- To prevent AUTH_KEY_DUPLICATED issues, set a SESSION_NAME env variable in your local VS project with a value like "PC"
DISCLAIMER: I'm not affiliated nor expert with Heroku, so if you have any problem with the above I might not be able to help
******************************************************************************************************************************/
diff --git a/FAQ.md b/FAQ.md
index 50f1d90..a0af502 100644
--- a/FAQ.md
+++ b/FAQ.md
@@ -87,6 +87,7 @@ You can verify this is your issue by looking at [WTelegram logs](EXAMPLES.md#log
This wrong-server problem typically happens when you use WTelegramClient Github source project in your application in DEBUG builds.
It is **not recommended** to use WTelegramClient in source code form.
Instead, you should use the Nuget manager to **install package WTelegramClient** into your application.
+*And remember to delete the WTelegram.session file to force a new login on the correct server.*
If you use the Github source project in an old .NET Framework 4.x or .NET Core x.x application, you may also experience the following error
> System.TypeInitializationException (FileNotFoundException for "System.Text.Json Version=5.0.0.0 ...")
@@ -163,7 +164,7 @@ That object must be created with both fields `channel_id` and `access_hash` corr
There can be several reasons why `chats.chats[id]` raise an error:
- The user account you're currently logged-in as has not joined this particular chat.
API method [Messages_GetAllChats](https://corefork.telegram.org/method/messages.getAllChats) will only return those chat groups/channels the user is in, not all Telegram chat groups.
-- You're trying to use a Telegram.Bot (or TDLib) numerical ID, like -1001234567890
+- You're trying to use a Bot API (or TDLib) numerical ID, like -1001234567890
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).
@@ -232,7 +233,7 @@ If you need your userbot to run 24/7, you would typically design your userbot as
and hosted online on any [VPS Hosting](https://www.google.com/search?q=vps+hosting) (Virtual Private Server).
Pure WebApp hosts might not be adequate as they will recycle (stop) your app if there is no incoming HTTP requests.
-There are many cheap VPS Hosting offers available, and some even have free tier, like Heroku:
+There are many cheap VPS Hosting offers available, for example Heroku:
See [Examples/Program_Heroku.cs](Examples/Program_Heroku.cs) for such an implementation and the steps to host/deploy it.
diff --git a/README.md b/README.md
index b2d895e..be93df3 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
[](https://corefork.telegram.org/methods)
[](https://dev.azure.com/wiz0u/WTelegramClient/_artifacts/feed/WTelegramClient/NuGet/WTelegramClient)
[](https://t.me/WTelegramClient)
-[](http://wizou.fr/donate.html)
+[](http://t.me/WTelegramBot?start=donate)
## _Telegram Client API library written 100% in C# and .NET Standard_
@@ -36,7 +36,7 @@ If the verification succeeds but the phone number is unknown to Telegram, the us
If the account already exists and has enabled two-step verification (2FA) a **password** might be required.
All these login scenarios are handled automatically within the call to `LoginUserIfNeeded`.
-And that's it, you now have access to the **[full range of Telegram Client APIs](https://corefork.telegram.org/methods)**.
+After login, you now have access to the **[full range of Telegram Client APIs](https://corefork.telegram.org/methods)**.
All those API methods require `using TL;` namespace and are called with an underscore instead of a dot in the method name, like this: `await client.Method_Name(...)`
# Saved session
@@ -162,4 +162,4 @@ Please don't use this library for Spam or Scam. Respect Telegram [Terms of Servi
Developers feedback is welcome in the Telegram support group [@WTelegramClient](https://t.me/WTelegramClient)
You can also check our [📖 Frequently Asked Questions](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md) for more help and troubleshooting guide.
-If you like this library, please [consider a donation](http://wizou.fr/donate.html).❤ This will help the project keep going.
+If you like this library, please [consider a donation](http://t.me/WTelegramBot?start=donate).❤ This will help the project keep going.
diff --git a/src/Client.cs b/src/Client.cs
index 9e6fbc1..d4f78c5 100644
--- a/src/Client.cs
+++ b/src/Client.cs
@@ -22,7 +22,7 @@ namespace WTelegram
public partial class Client : IDisposable
{
/// This event will be called when unsollicited updates/messages are sent by Telegram servers
- /// Make your handler , or return
See Examples/Program_ListenUpdate.cs for how to use this
+ /// Make your handler , or return or
See Examples/Program_ListenUpdate.cs for how to use this
public event Func OnUpdate;
/// Used to create a TcpClient connected to the given address/port, or throw an exception on failure
public TcpFactory TcpHandler { get; set; } = DefaultTcpHandler;
diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs
index 34d84b3..7323773 100644
--- a/src/TL.Schema.cs
+++ b/src/TL.Schema.cs
@@ -370,7 +370,7 @@ namespace TL
public string provider;
/// JSON-encoded data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.
public DataJSON provider_data;
- /// Start parameter
+ /// Unique bot deep links start parameter. If present, forwarded copies of the sent message will have a URL button with a deep link to the bot (instead of a Pay button), with the value used as the start parameter. If absent, forwarded copies of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice.
[IfFlag(1)] public string start_param;
[Flags] public enum Flags : uint
@@ -775,9 +775,11 @@ namespace TL
apply_min_photo = 0x2000000,
/// If set, this user was reported by many users as a fake or scam user: be careful when interacting with them.
fake = 0x4000000,
+ /// Whether this bot offers an attachment menu web app
bot_attach_menu = 0x8000000,
/// Whether this user is a Telegram Premium user
premium = 0x10000000,
+ /// Whether we installed the attachment menu web app offered by this bot
attach_menu_enabled = 0x20000000,
}
}
@@ -1953,7 +1955,9 @@ namespace TL
has_info = 0x1,
/// Field has a value
has_shipping_option_id = 0x2,
+ /// Whether this is the first payment of a recurring payment we just subscribed to
recurring_init = 0x4,
+ /// Whether this payment is part of a recurring payment
recurring_used = 0x8,
}
}
@@ -1967,15 +1971,16 @@ namespace TL
public string currency;
/// Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
public long total_amount;
- /// An invoice slug taken from a t.me/invoice/ link or from the premium_invoice_slug app config parameter »
+ /// An invoice slug taken from an invoice deep link or from the premium_invoice_slug app config parameter »
[IfFlag(0)] public string invoice_slug;
[Flags] public enum Flags : uint
{
/// Field has a value
has_invoice_slug = 0x1,
- /// Whether this is a recurring payment
+ /// Whether this is the first payment of a recurring payment we just subscribed to
recurring_init = 0x4,
+ /// Whether this payment is part of a recurring payment
recurring_used = 0x8,
}
}
@@ -2101,16 +2106,18 @@ namespace TL
/// A user was accepted into the group by an admin See
[TLDef(0xEBBCA3CB)]
public class MessageActionChatJoinedByRequest : MessageAction { }
- /// See
+ /// Data from an opened reply keyboard bot web app was relayed to the bot that owns it (bot side service message). See
[TLDef(0x47DD8079, inheritBefore = true)]
public class MessageActionWebViewDataSentMe : MessageActionWebViewDataSent
{
+ /// Relayed data.
public string data;
}
- /// See
+ /// Data from an opened reply keyboard bot web app was relayed to the bot that owns it (user side service message). See
[TLDef(0xB4C38CB5)]
public class MessageActionWebViewDataSent : MessageAction
{
+ /// Text of the that was pressed to open the web app.
public string text;
}
/// Info about a gifted Telegram Premium subscription See
@@ -2561,15 +2568,15 @@ namespace TL
}
}
- /// Object contains info on a wallpaper. Derived classes: , See
+ /// Object contains info on a wallpaper. Derived classes: , See
public abstract class WallPaperBase : IObject
{
/// Identifier
public abstract long ID { get; }
- /// Wallpaper settings
+ /// Info on how to generate the wallpaper, according to these instructions ».
public abstract WallPaperSettings Settings { get; }
}
- /// Wallpaper settings. See
+ /// Represents a wallpaper based on an image. See
[TLDef(0xA437C3ED)]
public class WallPaper : WallPaperBase
{
@@ -2579,33 +2586,33 @@ namespace TL
public Flags flags;
/// Access hash
public long access_hash;
- /// Unique wallpaper ID
+ /// Unique wallpaper ID, used when generating wallpaper links or importing wallpaper links.
public string slug;
/// The actual wallpaper
public DocumentBase document;
- /// Wallpaper settings
+ /// Info on how to generate the wallpaper, according to these instructions ».
[IfFlag(2)] public WallPaperSettings settings;
[Flags] public enum Flags : uint
{
- /// Creator of the wallpaper
+ /// Whether we created this wallpaper
creator = 0x1,
/// Whether this is the default wallpaper
default_ = 0x2,
/// Field has a value
has_settings = 0x4,
- /// Pattern
+ /// Whether this is a pattern wallpaper »
pattern = 0x8,
- /// Dark mode
+ /// Whether this wallpaper should be used in dark mode.
dark = 0x10,
}
/// Identifier
public override long ID => id;
- /// Wallpaper settings
+ /// Info on how to generate the wallpaper, according to these instructions ».
public override WallPaperSettings Settings => settings;
}
- /// Wallpaper with no file access hash, used for example when deleting (unsave=true) wallpapers using account.saveWallPaper, specifying just the wallpaper ID.
Also used for some default wallpapers which contain only colours. See
+ /// Represents a wallpaper only based on colors/gradients. See
[TLDef(0xE0804116)]
public class WallPaperNoFile : WallPaperBase
{
@@ -2613,7 +2620,7 @@ namespace TL
public long id;
/// Flags, see TL conditional fields
public Flags flags;
- /// Wallpaper settings
+ /// Info on how to generate the wallpaper.
[IfFlag(2)] public WallPaperSettings settings;
[Flags] public enum Flags : uint
@@ -2622,13 +2629,13 @@ namespace TL
default_ = 0x2,
/// Field has a value
has_settings = 0x4,
- /// Dark mode
+ /// Whether this wallpaper should be used in dark mode.
dark = 0x10,
}
/// Wallpaper ID
public override long ID => id;
- /// Wallpaper settings
+ /// Info on how to generate the wallpaper.
public override WallPaperSettings Settings => settings;
}
@@ -2687,10 +2694,11 @@ namespace TL
[IfFlag(15)] public string theme_emoticon;
/// Anonymized text to be shown instead of the the user's name on forwarded messages
[IfFlag(16)] public string private_forward_name;
- /// A suggested default set of administrator rights for the bot, to be shown when adding the bot as admin to a supergroup (only a suggestion, the admin right set may be modified by the user before adding the bot as admin)
+ /// A suggested set of administrator rights for the bot, to be shown when adding the bot as admin to a group, see here for more info on how to handle them ».
[IfFlag(17)] public ChatAdminRights bot_group_admin_rights;
- /// A suggested default set of administrator rights for the bot, to be shown when adding the bot as admin to a channel (only a suggestion, the admin right set may be modified by the user before adding the bot as admin)
+ /// A suggested set of administrator rights for the bot, to be shown when adding the bot as admin to a channel, see here for more info on how to handle them ».
[IfFlag(18)] public ChatAdminRights bot_broadcast_admin_rights;
+ /// Telegram Premium subscriptions gift options
[IfFlag(19)] public PremiumGiftOption[] premium_gifts;
[Flags] public enum Flags : uint
@@ -4190,13 +4198,14 @@ namespace TL
/// Reactions
public MessageReactions reactions;
}
- /// The list of added bot web apps » has changed, use messages.getAttachMenuBots to fetch the updated list. See
+ /// The list of installed attachment menu entries » has changed, use messages.getAttachMenuBots to fetch the updated list. See
[TLDef(0x17B7A20B)]
public class UpdateAttachMenuBots : Update { }
- /// See
+ /// Indicates to a bot that a webview was closed and an inline message was sent on behalf of the user using messages.sendWebViewResultMessage See
[TLDef(0x1592B79D)]
public class UpdateWebViewResultSent : Update
{
+ /// Web app interaction ID
public long query_id;
}
/// The menu button behavior for the specified bot has changed See
@@ -4211,7 +4220,7 @@ namespace TL
/// The list of saved notification sounds has changed, use account.getSavedRingtones to fetch the new list. See
[TLDef(0x74D8BE99)]
public class UpdateSavedRingtones : Update { }
- /// A pending transcription initiated with messages.transcribeAudio was updated. See
+ /// A pending voice message transcription » initiated with messages.transcribeAudio was updated. See
[TLDef(0x0084CD5A)]
public class UpdateTranscribedAudio : Update
{
@@ -4232,7 +4241,7 @@ namespace TL
pending = 0x1,
}
}
- /// See
+ /// Some featured emoji stickers were marked as read See
[TLDef(0xFB4C496C)]
public class UpdateReadFeaturedEmojiStickers : Update { }
@@ -4605,7 +4614,7 @@ namespace TL
{
/// File type
public Storage_FileType type;
- /// Modification type
+ /// Modification time
public int mtime;
/// Binary data, file content
public byte[] bytes;
@@ -4729,7 +4738,7 @@ namespace TL
public int call_connect_timeout_ms;
/// If during a VoIP call a packet isn't received for the specified period of time, the call must be aborted
public int call_packet_timeout_ms;
- /// The domain to use to parse in-app links.
For example t.me indicates that t.me/username links should parsed to @username, t.me/addsticker/name should be parsed to the appropriate stickerset and so on...
+ /// The domain to use to parse deep links ».
public string me_url_prefix;
/// URL to use to auto-update the current app
[IfFlag(7)] public string autoupdate_url_prefix;
@@ -4745,7 +4754,7 @@ namespace TL
public int caption_length_max;
/// Maximum length of messages (length in utf8 codepoints)
public int message_length_max;
- /// DC ID to use to download webfiles
+ /// DC ID to use to download webfiles
public int webfile_dc_id;
/// Suggested language code
[IfFlag(2)] public string suggested_lang_code;
@@ -5123,7 +5132,7 @@ namespace TL
public EncryptedFile file;
}
- /// Defines a video for subsequent interaction. See
+ /// Defines a document for subsequent interaction. See
/// a null value means inputDocumentEmpty
[TLDef(0x1ABFB575)]
public partial class InputDocument : IObject
@@ -5322,19 +5331,19 @@ namespace TL
/// Privacy key See
public enum InputPrivacyKey : uint
{
- ///Whether we can see the exact last online timestamp of the user
+ ///Whether people will be able to see your exact last online timestamp
StatusTimestamp = 0x4F96CB18,
- ///Whether the user can be invited to chats
+ ///Whether people will be able to invite you to chats
ChatInvite = 0xBDFB0426,
- ///Whether the user will accept phone calls
+ ///Whether you will accept phone calls
PhoneCall = 0xFABADC5F,
- ///Whether the user allows P2P communication during VoIP calls
+ ///Whether to allow P2P communication during VoIP calls
PhoneP2P = 0xDB9E70D2,
- ///Whether messages forwarded from this user will be anonymous
+ ///Whether messages forwarded from you will be anonymous
Forwards = 0xA4DD4C08,
- ///Whether people will be able to see the user's profile picture
+ ///Whether people will be able to see your profile picture
ProfilePhoto = 0x5719BACC,
- ///Whether people will be able to see the user's phone number
+ ///Whether people will be able to see your phone number
PhoneNumber = 0x0352DAFA,
///Whether people can add you to their contact list by your phone number
AddedByPhone = 0xD1219BDD,
@@ -5345,13 +5354,13 @@ namespace TL
/// Privacy key See
public enum PrivacyKey : uint
{
- ///Whether we can see the last online timestamp
+ ///Whether we can see the last online timestamp of this user
StatusTimestamp = 0xBC2EAB30,
///Whether the user can be invited to chats
ChatInvite = 0x500E6DFA,
///Whether the user accepts phone calls
PhoneCall = 0x3D662B7B,
- ///Whether P2P connections in phone calls are allowed
+ ///Whether P2P connections in phone calls with this user are allowed
PhoneP2P = 0x39491CC8,
///Whether messages forwarded from the user will be anonymously forwarded
Forwards = 0x69EC56A3,
@@ -5359,7 +5368,7 @@ namespace TL
ProfilePhoto = 0x96151FED,
///Whether the user allows us to see his phone number
PhoneNumber = 0xD19AE46D,
- ///Whether people can add you to their contact list by your phone number
+ ///Whether this user can be added to our contact list by their phone number
AddedByPhone = 0x42FFD42B,
///Whether the user accepts voice messages
VoiceMessages = 0x0697F414,
@@ -5579,6 +5588,7 @@ namespace TL
[Flags] public enum Flags : uint
{
+ /// Whether this custom emoji can be sent by non-Premium users
free = 0x1,
}
}
@@ -5958,7 +5968,7 @@ namespace TL
has_title = 0x100,
}
}
- /// See
+ /// Used in updates and in the channel log to indicate when a user is requesting to join or has joined a discussion group See
[TLDef(0xED107AB7)]
public class ChatInvitePublicJoinRequests : ExportedChatInvite { }
@@ -6028,11 +6038,11 @@ namespace TL
/// ⚠ REQUIRED FIELD. See how to obtain it
Access hash
public long access_hash;
}
- /// Stickerset by short name, from tg://addstickers?set=short_name See
+ /// Stickerset by short name, from a stickerset deep link » See
[TLDef(0x861CC8A0)]
public class InputStickerSetShortName : InputStickerSet
{
- /// From tg://addstickers?set=short_name
+ /// Short name from a stickerset deep link »
public string short_name;
}
/// Animated emojis stickerset See
@@ -6048,7 +6058,7 @@ namespace TL
/// Animated emoji reaction stickerset (contains animations to play when a user clicks on a given animated emoji) See
[TLDef(0x0CDE3739)]
public class InputStickerSetAnimatedEmojiAnimations : InputStickerSet { }
- /// See
+ /// Stickers to show when receiving a gifted Telegram Premium subscription See
[TLDef(0xC88B3B02)]
public class InputStickerSetPremiumGifts : InputStickerSet { }
@@ -6066,7 +6076,7 @@ namespace TL
public long access_hash;
/// Title of stickerset
public string title;
- /// Short name of stickerset to use in tg://addstickers?set=short_name
+ /// Short name of stickerset, used when sharing stickerset using stickerset deep links.
public string short_name;
/// Stickerset thumbnail
[IfFlag(4)] public PhotoSizeBase[] thumbs;
@@ -6330,13 +6340,14 @@ namespace TL
/// User ID
public long user_id;
}
- /// See
+ /// Button to open a bot web app using messages.requestWebView, sending over user information after user confirmation. See
[TLDef(0x13767230, inheritBefore = true)]
public class KeyboardButtonWebView : KeyboardButton
{
+ /// Web app url
public string url;
}
- /// See
+ /// Button to open a bot web app using messages.requestSimpleWebView, without sending user information to the web app. See
[TLDef(0xA0C0505C)]
public class KeyboardButtonSimpleWebView : KeyboardButtonWebView
{
@@ -7536,11 +7547,11 @@ namespace TL
/// Type of verification code that will be sent next if you call the resendCode method See
public enum Auth_CodeType : uint
{
- ///Type of verification code that will be sent next if you call the resendCode method: SMS code
+ ///The next time, the authentication code will be delivered via an immediately canceled incoming call.
Sms = 0x72A3158C,
- ///Type of verification code that will be sent next if you call the resendCode method: SMS code
+ ///The next time, the authentication code is to be delivered via an outgoing phone call.
Call = 0x741CD3E3,
- ///Type of verification code that will be sent next if you call the resendCode method: SMS code
+ ///The next time, the authentication code will be delivered via an immediately canceled incoming call.
FlashCall = 0x226CCEFB,
///The next time, the authentication code will be delivered via an immediately canceled incoming call, handled manually by the user.
MissedCall = 0xD61AD6EE,
@@ -7872,13 +7883,13 @@ namespace TL
public StickerSetCoveredBase[] sets;
}
- /// Stickerset, with a specific sticker as preview Derived classes: , , See
+ /// Stickerset preview Derived classes: , , See
public abstract class StickerSetCoveredBase : IObject
{
/// Stickerset
public abstract StickerSet Set { get; }
}
- /// Stickerset, with a specific sticker as preview See
+ /// Stickerset with a single sticker as preview See
[TLDef(0x6410A5D2)]
public class StickerSetCovered : StickerSetCoveredBase
{
@@ -7890,7 +7901,7 @@ namespace TL
/// Stickerset
public override StickerSet Set => set;
}
- /// Stickerset, with a specific set of stickers as preview See
+ /// Stickerset, with multiple stickers as preview See
[TLDef(0x3407E51B)]
public class StickerSetMultiCovered : StickerSetCoveredBase
{
@@ -7902,14 +7913,18 @@ namespace TL
/// Stickerset
public override StickerSet Set => set;
}
- /// See
+ /// Stickerset preview with all stickers of the stickerset included.
Currently used only for custom emoji stickersets, to avoid a further call to messages.getStickerSet. See
[TLDef(0x1AED5EE5)]
public class StickerSetFullCovered : StickerSetCoveredBase
{
+ /// Stickerset
public StickerSet set;
+ /// Emoji information about every sticker in the stickerset
public StickerPack[] packs;
+ /// Stickers
public DocumentBase[] documents;
+ /// Stickerset
public override StickerSet Set => set;
}
@@ -7989,7 +8004,7 @@ namespace TL
{
/// The bot that provides the game
public InputUserBase bot_id;
- /// The game's short name
+ /// The game's short name, usually obtained from a game link »
public string short_name;
}
@@ -8673,13 +8688,13 @@ namespace TL
/// ⚠ REQUIRED FIELD. See how to obtain it
Access hash
public long access_hash;
}
- /// Geolocation See
+ /// Used to download a server-generated image with the map preview from a , see the webfile docs for more info ». See
[TLDef(0x9F2221C9)]
public class InputWebFileGeoPointLocation : InputWebFileLocationBase
{
- /// Geolocation
+ /// Generated from the lat, long and accuracy_radius parameters of the
public InputGeoPoint geo_point;
- /// ⚠ REQUIRED FIELD. See how to obtain it
Access hash
+ /// ⚠ REQUIRED FIELD. See how to obtain it
Access hash of the
public long access_hash;
/// Map width in pixels before applying scale; 16-1024
public int w;
@@ -8690,14 +8705,17 @@ namespace TL
/// Map scale; 1-3
public int scale;
}
- /// See
+ /// Used to download an album cover for any music file using upload.getWebFile, see the webfile docs for more info ». See
[TLDef(0xF46FE924)]
public class InputWebFileAudioAlbumThumbLocation : InputWebFileLocationBase
{
/// Flags, see TL conditional fields
public Flags flags;
+ /// The audio file in question: must NOT be provided in secret chats, provide the title and performer fields instead.
[IfFlag(0)] public InputDocument document;
+ /// Song title: should only be used in secret chats, in normal chats provide document instead, as it has more lax rate limits.
[IfFlag(1)] public string title;
+ /// Song performer: should only be used in secret chats, in normal chats provide document instead, as it has more lax rate limits.
[IfFlag(1)] public string performer;
[Flags] public enum Flags : uint
@@ -8706,6 +8724,7 @@ namespace TL
has_document = 0x1,
/// Field has a value
has_title = 0x2,
+ /// Used to return a thumbnail with 100x100 resolution (instead of the default 600x600)
small = 0x4,
}
}
@@ -10410,7 +10429,7 @@ namespace TL
public int length;
}
- /// Deep linking info See
+ /// Deep link info, see the here for more details See
/// a null value means help.deepLinkInfoEmpty
[TLDef(0x6A4EE832)]
public class Help_DeepLinkInfo : IObject
@@ -10936,7 +10955,7 @@ namespace TL
anonymous = 0x400,
/// If set, allows the admin to change group call/livestream settings
manage_call = 0x800,
- /// Set this flag if none of the other flags are set, but you still want the user to be an admin.
+ /// Set this flag if none of the other flags are set, but you still want the user to be an admin: if this or any of the other flags are set, the admin can get the chat admin log, get chat statistics, get message statistics in channels, get channel members, see anonymous administrators in supergroups and ignore slow mode.
other = 0x1000,
}
}
@@ -10979,25 +10998,25 @@ namespace TL
}
}
- /// Wallpaper Derived classes: , , See
+ /// Wallpaper Derived classes: , , See
public abstract class InputWallPaperBase : IObject { }
- /// Wallpaper See
+ /// Wallpaper See
[TLDef(0xE630B979)]
public class InputWallPaper : InputWallPaperBase
{
- /// Wallpaper ID
+ /// Wallpaper ID
public long id;
/// ⚠ REQUIRED FIELD. See how to obtain it
Access hash
public long access_hash;
}
- /// Wallpaper by slug (a unique ID) See
+ /// Wallpaper by slug (a unique ID, obtained from a wallpaper link ») See
[TLDef(0x72091C80)]
public class InputWallPaperSlug : InputWallPaperBase
{
/// Unique wallpaper ID
public string slug;
}
- /// Wallpaper with no file access hash, used for example when deleting (unsave=true) wallpapers using account.saveWallPaper, specifying just the wallpaper ID. See
+ /// Wallpaper with no file access hash, used for example when deleting (unsave=true) wallpapers using account.saveWallPaper, specifying just the wallpaper ID. See
[TLDef(0x967A462E)]
public class InputWallPaperNoFile : InputWallPaperBase
{
@@ -11005,14 +11024,14 @@ namespace TL
public long id;
}
- /// Installed wallpapers See
+ /// Installed wallpapers See
/// a null value means account.wallPapersNotModified
[TLDef(0xCDC3858C)]
public class Account_WallPapers : IObject
{
/// Hash for pagination, for more info click here
public long hash;
- /// Wallpapers
+ /// Wallpapers
public WallPaperBase[] wallpapers;
}
@@ -11040,32 +11059,32 @@ namespace TL
}
}
- /// Wallpaper settings See
+ /// Wallpaper rendering information. See
[TLDef(0x1DC1BCA4)]
public class WallPaperSettings : IObject
{
/// Flags, see TL conditional fields
public Flags flags;
- /// If set, a PNG pattern is to be combined with the color chosen by the user: the main color of the background in RGB24 format
+ /// Used for solid », gradient » and freeform gradient » fills.
[IfFlag(0)] public int background_color;
- /// If set, a PNG pattern is to be combined with the first and second background colors (RGB24 format) in a top-bottom gradient
+ /// Used for gradient » and freeform gradient » fills.
[IfFlag(4)] public int second_background_color;
- /// If set, a PNG pattern is to be combined with the first, second and third background colors (RGB24 format) in a freeform gradient
+ /// Used for freeform gradient » fills.
[IfFlag(5)] public int third_background_color;
- /// If set, a PNG pattern is to be combined with the first, second, third and fourth background colors (RGB24 format) in a freeform gradient
+ /// Used for freeform gradient » fills.
[IfFlag(6)] public int fourth_background_color;
- /// Intensity of the pattern when it is shown above the main background color, 0-100
+ /// Used for pattern wallpapers ».
[IfFlag(3)] public int intensity;
- /// Clockwise rotation angle of the gradient, in degrees; 0-359. Should be always divisible by 45
+ /// Clockwise rotation angle of the gradient, in degrees; 0-359. Should be always divisible by 45.
[IfFlag(4)] public int rotation;
[Flags] public enum Flags : uint
{
/// Field has a value
has_background_color = 0x1,
- /// If set, the wallpaper must be downscaled to fit in 450x450 square and then box-blurred with radius 12
+ /// For image wallpapers »: if set, the JPEG must be downscaled to fit in 450x450 square and then box-blurred with radius 12.
blur = 0x2,
- /// If set, the background needs to be slightly moved when device is rotated
+ /// If set, the background needs to be slightly moved when the device is rotated.
motion = 0x4,
/// Field has a value
has_intensity = 0x8,
@@ -11324,7 +11343,7 @@ namespace TL
[TLDef(0xF5890DF1)]
public class InputThemeSlug : InputThemeBase
{
- /// Unique theme ID
+ /// Unique theme ID obtained from a theme deep link »
public string slug;
}
@@ -11468,9 +11487,9 @@ namespace TL
[IfFlag(3)] public int outbox_accent_color;
/// The fill to be used as a background for outgoing messages, in RGB24 format.
If just one or two equal colors are provided, describes a solid fill of a background.
If two different colors are provided, describes the top and bottom colors of a 0-degree gradient.
If three or four colors are provided, describes a freeform gradient fill of a background.
[IfFlag(0)] public int[] message_colors;
- /// Wallpaper
+ /// Wallpaper
[IfFlag(1)] public InputWallPaperBase wallpaper;
- /// Wallpaper settings
+ /// Wallpaper settings.
[IfFlag(1)] public WallPaperSettings wallpaper_settings;
[Flags] public enum Flags : uint
@@ -11500,7 +11519,7 @@ namespace TL
[IfFlag(3)] public int outbox_accent_color;
/// The fill to be used as a background for outgoing messages, in RGB24 format.
If just one or two equal colors are provided, describes a solid fill of a background.
If two different colors are provided, describes the top and bottom colors of a 0-degree gradient.
If three or four colors are provided, describes a freeform gradient fill of a background.
[IfFlag(0)] public int[] message_colors;
- /// Wallpaper
+ /// Wallpaper
[IfFlag(1)] public WallPaperBase wallpaper;
[Flags] public enum Flags : uint
@@ -11678,7 +11697,7 @@ namespace TL
has_emoticon = 0x2000000,
}
}
- /// See
+ /// Used only when reordering folders to indicate the default (all chats) folder. See
[TLDef(0x363293AE)]
public class DialogFilterDefault : DialogFilterBase { }
@@ -12686,6 +12705,7 @@ namespace TL
has_from_id = 0x8,
/// Field has a value
has_chat_invite = 0x10,
+ /// Whether the message needs to be labeled as "recommended" instead of "sponsored"
recommended = 0x20,
}
}
@@ -13010,7 +13030,7 @@ namespace TL
public string key;
}
- /// Represents an attachment menu icon color for bot web apps » See
+ /// Represents an attachment menu icon color for bot web apps » See
[TLDef(0x4576F3F0)]
public class AttachMenuBotIconColor : IObject
{
@@ -13020,7 +13040,7 @@ namespace TL
public int color;
}
- /// Represents an attachment menu icon for bot web apps » See
+ /// Represents an attachment menu icon for bot web apps » See
[TLDef(0xB2A7386B)]
public class AttachMenuBotIcon : IObject
{
@@ -13040,7 +13060,7 @@ namespace TL
}
}
- /// Represents a bot web app that can be launched from the attachment menu » See
+ /// Represents a bot web app that can be launched from the attachment menu » See
[TLDef(0xC8AA2CD2)]
public class AttachMenuBot : IObject
{
@@ -13059,59 +13079,63 @@ namespace TL
{
/// Whether this bot attachment menu entry should be shown in the attachment menu (toggle using messages.toggleBotInAttachMenu)
inactive = 0x1,
- /// True, if the bot supports the "settings_button_pressed" event
+ /// True, if the bot supports the "settings_button_pressed" event »
has_settings = 0x2,
}
}
- /// Represents a list of bot web apps that can be launched from the attachment menu » See
+ /// Represents a list of bot web apps that can be launched from the attachment menu » See
/// a null value means attachMenuBotsNotModified
[TLDef(0x3C4301C0)]
public class AttachMenuBots : IObject
{
/// Hash for pagination, for more info click here
public long hash;
- /// List of bot web apps that can be launched from the attachment menu »
+ /// List of bot web apps that can be launched from the attachment menu »
public AttachMenuBot[] bots;
/// Info about related users/bots
public Dictionary users;
}
- /// Represents a bot web app that can be launched from the attachment menu » See
+ /// Represents a bot web app that can be launched from the attachment menu » See
[TLDef(0x93BF667F)]
public class AttachMenuBotsBot : IObject
{
- /// Represents a bot web app that can be launched from the attachment menu »
+ /// Represents a bot web app that can be launched from the attachment menu »
public AttachMenuBot bot;
/// Info about related users and bots
public Dictionary users;
}
- /// Contains information about a Web App Derived classes: See
+ /// Contains the webview URL with appropriate theme and user info parameters added Derived classes: See
public abstract class WebViewResult : IObject { }
- /// See
+ /// Contains the webview URL with appropriate theme and user info parameters added See
[TLDef(0x0C14557C)]
public class WebViewResultUrl : WebViewResult
{
+ /// Webview session ID
public long query_id;
+ /// Webview URL to open
public string url;
}
- /// Contains the webview URL with appropriate theme and user info parameters added Derived classes: See
+ /// Contains the webview URL with appropriate theme parameters added Derived classes: See
public abstract class SimpleWebViewResult : IObject { }
- /// See
+ /// Contains the webview URL with appropriate theme parameters added See
[TLDef(0x882F76BB)]
public class SimpleWebViewResultUrl : SimpleWebViewResult
{
+ /// URL
public string url;
}
- /// See
+ /// Info about a sent inline webview message See
[TLDef(0x0C94511C)]
public class WebViewMessageSent : IObject
{
/// Flags, see TL conditional fields
public Flags flags;
+ /// Message ID
[IfFlag(0)] public InputBotInlineMessageIDBase msg_id;
[Flags] public enum Flags : uint
@@ -13123,19 +13147,19 @@ namespace TL
/// Indicates the action to execute when pressing the in-UI menu button for bots Derived classes: , , See
public abstract class BotMenuButtonBase : IObject { }
- /// See
+ /// Placeholder bot menu button never returned to users: see the docs for more info. See
[TLDef(0x7533A588)]
public class BotMenuButtonDefault : BotMenuButtonBase { }
- /// See
+ /// Bot menu button that opens the bot command list when clicked. See
[TLDef(0x4258C205)]
public class BotMenuButtonCommands : BotMenuButtonBase { }
- /// Indicates the action to execute when pressing the in-UI menu button for bots See
+ /// Bot menu button that opens a web app when clicked. See
[TLDef(0xC7B57CE6)]
public class BotMenuButton : BotMenuButtonBase
{
/// Title to be displayed on the menu button instead of 'Menu'
public string text;
- /// URL of a web app to open when the user clicks on the button
+ /// URL of a web app to open when the user clicks on the button
public string url;
}
@@ -13212,7 +13236,7 @@ namespace TL
/// Message ID
public int msg_id;
}
- /// An invoice slug taken from a t.me/invoice/ link or from the premium_invoice_slug app config parameter » See
+ /// An invoice slug taken from an invoice deep link or from the premium_invoice_slug app config parameter » See
[TLDef(0xC326CAEF)]
public class InputInvoiceSlug : InputInvoice
{
@@ -13220,15 +13244,15 @@ namespace TL
public string slug;
}
- /// Exported invoice See
+ /// Exported invoice deep link See
[TLDef(0xAED0CBD9)]
public class Payments_ExportedInvoice : IObject
{
- /// Exported invoice URL
+ /// Exported invoice deep link
public string url;
}
- /// Transcribed text from a voice message See
+ /// Transcribed text from a voice message » See
[TLDef(0x93752C52)]
public class Messages_TranscribedAudio : IObject
{
@@ -13277,6 +13301,7 @@ namespace TL
[Flags] public enum Flags : uint
{
+ /// Pass true if this is a restore of a Telegram Premium purchase; only for the App Store
restore = 0x1,
}
}
@@ -13304,7 +13329,9 @@ namespace TL
public string currency;
/// Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
public long amount;
+ /// An invoice deep link » to an invoice for in-app payment, using the official Premium bot; may be empty if direct payment isn't available.
public string bot_url;
+ /// An identifier for the App Store/Play Store product associated with the Premium gift.
[IfFlag(0)] public string store_product;
[Flags] public enum Flags : uint
@@ -13314,11 +13341,13 @@ namespace TL
}
}
- /// Represents a payment method See
+ /// Represents an additional payment method See
[TLDef(0x88F8F21B)]
public class PaymentFormMethod : IObject
{
+ /// URL to open in a webview to process the payment
public string url;
+ /// Payment method description
public string title;
}
}
diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs
index fe44547..b09d00b 100644
--- a/src/TL.SchemaFuncs.cs
+++ b/src/TL.SchemaFuncs.cs
@@ -247,7 +247,7 @@ namespace TL
except_auth_keys = except_auth_keys,
});
- /// Generate a login token, for login via QR code.
The generated login token should be encoded using base64url, then shown as a tg://login?token=base64encodedtoken URL in the QR code. See Possible codes: 400 (details)
+ /// Generate a login token, for login via QR code.
The generated login token should be encoded using base64url, then shown as a tg://login?token=base64encodedtoken deep link » in the QR code. See Possible codes: 400 (details)
/// Application identifier (see. App configuration)
/// Application identifier hash (see. App configuration)
/// List of already logged-in user IDs, to prevent logging in twice with the same user
@@ -358,7 +358,7 @@ namespace TL
offline = offline,
});
- /// Returns a list of available wallpapers. See
+ /// Returns a list of available wallpapers. See
/// Hash for pagination, for more info click here
/// a null value means account.wallPapersNotModified
public static Task Account_GetWallPapers(this Client client, long hash = default)
@@ -723,15 +723,15 @@ namespace TL
peer = peer,
});
- /// Get info about a certain wallpaper See Possible codes: 400 (details)
- /// The wallpaper to get info about
+ /// Get info about a certain wallpaper See Possible codes: 400 (details)
+ /// The wallpaper to get info about
public static Task Account_GetWallPaper(this Client client, InputWallPaperBase wallpaper)
=> client.Invoke(new Account_GetWallPaper
{
wallpaper = wallpaper,
});
- /// Create and upload a new wallpaper See Possible codes: 400 (details)
+ /// Create and upload a new wallpaper See Possible codes: 400 (details)
/// The JPG/PNG wallpaper
/// MIME type of uploaded wallpaper
/// Wallpaper settings
@@ -743,8 +743,8 @@ namespace TL
settings = settings,
});
- /// Install/uninstall wallpaper See Possible codes: 400 (details)
- /// Wallpaper to save
+ /// Install/uninstall wallpaper See Possible codes: 400 (details)
+ /// Wallpaper to install or uninstall
/// Uninstall wallpaper?
/// Wallpaper settings
public static Task Account_SaveWallPaper(this Client client, InputWallPaperBase wallpaper, bool unsave, WallPaperSettings settings)
@@ -755,9 +755,9 @@ namespace TL
settings = settings,
});
- /// Install wallpaper See Possible codes: 400 (details)
- /// Wallpaper to install
- /// Wallpaper settings
+ /// Install wallpaper See Possible codes: 400 (details)
+ /// Wallpaper to install
+ /// Wallpaper settings
public static Task Account_InstallWallPaper(this Client client, InputWallPaperBase wallpaper, WallPaperSettings settings)
=> client.Invoke(new Account_InstallWallPaper
{
@@ -765,7 +765,7 @@ namespace TL
settings = settings,
});
- /// Delete installed wallpapers See
+ /// Delete all installed wallpapers, reverting to the default wallpaper set. See
public static Task Account_ResetWallPapers(this Client client)
=> client.Invoke(new Account_ResetWallPapers
{
@@ -898,8 +898,8 @@ namespace TL
{
});
- /// Get info about multiple wallpapers See
- /// Wallpapers to fetch info about
+ /// Get info about multiple wallpapers See
+ /// Wallpapers to fetch info about
public static Task Account_GetMultiWallPapers(this Client client, params InputWallPaperBase[] wallpapers)
=> client.Invoke(new Account_GetMultiWallPapers
{
@@ -1224,8 +1224,8 @@ namespace TL
msg_id = msg_id,
});
- /// Resolve a phone number to get user info, if their privacy settings allow it. See Possible codes: (details)
- /// Phone number in international format, possibly obtained from a t.me/+number or tg://resolve?phone=number URI.
+ /// Resolve a phone number to get user info, if their privacy settings allow it. See Possible codes: 400 (details)
+ /// Phone number in international format, possibly obtained from a phone number deep link.
public static Task Contacts_ResolvePhone(this Client client, string phone)
=> client.Invoke(new Contacts_ResolvePhone
{
@@ -1260,7 +1260,7 @@ namespace TL
hash = hash,
});
- /// Gets back the conversation history with one interlocutor / within a chat See Possible codes: 400 (details)
+ /// Returns the conversation history with one interlocutor / within a chat See Possible codes: 400 (details)
/// Target peer
/// Only return messages starting from the specified message ID
/// Only return messages sent before the specified date
@@ -1282,7 +1282,7 @@ namespace TL
hash = hash,
});
- /// Gets back found messages See Possible codes: 400 (details)
+ /// Returns found messages See Possible codes: 400 (details)
/// User or chat, histories with which are searched, or for global search
/// Text search request
/// Only return messages sent by the specified user ID
@@ -1661,7 +1661,7 @@ namespace TL
data = data,
});
- /// Confirms receipt of messages in a secret chat by client, cancels push notifications. See Possible codes: 400 (details)
+ /// Confirms receipt of messages in a secret chat by client, cancels push notifications.
The method returns a list of random_ids of messages for which push notifications were cancelled. See Possible codes: 400 (details)
/// Maximum qts value available at the client
public static Task Messages_ReceivedQueue(this Client client, int max_qts)
=> client.Invoke(new Messages_ReceivedQueue
@@ -1735,7 +1735,7 @@ namespace TL
});
/// Check the validity of a chat invite link and get basic info about it See Possible codes: 400,406 (details)
- /// Invite hash in t.me/joinchat/hash or t.me/+hash
+ /// Invite hash from chat invite deep link ».
public static Task Messages_CheckChatInvite(this Client client, string hash)
=> client.Invoke(new Messages_CheckChatInvite
{
@@ -1743,14 +1743,14 @@ namespace TL
});
/// Import a chat invite and join a private chat/supergroup/channel See Possible codes: 400,406 (details)
- /// hash from t.me/joinchat/hash
+ /// hash from a chat invite deep link
public static Task Messages_ImportChatInvite(this Client client, string hash)
=> client.Invoke(new Messages_ImportChatInvite
{
hash = hash,
});
- /// Get info about a stickerset See [bots: ✓] Possible codes: 406 (details)
+ /// Get info about a stickerset See [bots: ✓] Possible codes: 400,406 (details)
/// Stickerset
/// Hash for pagination, for more info click here
/// a null value means messages.stickerSetNotModified
@@ -1779,11 +1779,11 @@ namespace TL
stickerset = stickerset,
});
- /// Start a conversation with a bot using a deep linking parameter See Possible codes: 400,403,500 (details)
+ /// Start a conversation with a bot using a deep linking parameter See Possible codes: 400,403,500 (details)
/// The bot
/// The chat where to start the bot, can be the bot's private chat or a group
/// Random ID to avoid resending the same message
- /// Deep linking parameter
+ /// Deep linking parameter
public static Task Messages_StartBot(this Client client, InputUserBase bot, InputPeer peer, long random_id, string start_param)
=> client.Invoke(new Messages_StartBot
{
@@ -2059,7 +2059,7 @@ namespace TL
entities = entities,
});
- /// Save get all message drafts. See
+ /// Return all message drafts.
Returns all the latest updates related to all chats with drafts. See
public static Task Messages_GetAllDrafts(this Client client)
=> client.Invoke(new Messages_GetAllDrafts
{
@@ -3117,7 +3117,7 @@ namespace TL
min_id = min_id,
});
- /// Mark message reactions » as read See
+ /// Mark message reactions » as read See Possible codes: 400 (details)
/// Peer
public static Task Messages_ReadReactions(this Client client, InputPeer peer)
=> client.Invoke(new Messages_ReadReactions
@@ -3137,7 +3137,7 @@ namespace TL
limit = limit,
});
- /// Returns installed attachment menu bot web apps » See
+ /// Returns installed attachment menu bot web apps » See
/// Hash for pagination, for more info click here
/// a null value means attachMenuBotsNotModified
public static Task Messages_GetAttachMenuBots(this Client client, long hash = default)
@@ -3146,7 +3146,7 @@ namespace TL
hash = hash,
});
- /// Returns attachment menu entry for a bot web app that can be launched from the attachment menu » See Possible codes: 400 (details)
+ /// Returns attachment menu entry for a bot web app that can be launched from the attachment menu » See Possible codes: 400 (details)
/// Bot ID
public static Task Messages_GetAttachMenuBot(this Client client, InputUserBase bot)
=> client.Invoke(new Messages_GetAttachMenuBot
@@ -3154,7 +3154,7 @@ namespace TL
bot = bot,
});
- /// Enable or disable web bot attachment menu » See
+ /// Enable or disable web bot attachment menu » See
/// Bot ID
/// Toggle
public static Task Messages_ToggleBotInAttachMenu(this Client client, InputUserBase bot, bool enabled)
@@ -3164,7 +3164,16 @@ namespace TL
enabled = enabled,
});
- /// See
+ /// Open a bot web app, sending over user information after user confirmation. See
+ /// Whether the webview was opened by clicking on the bot's menu button ».
+ /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is terminated should be sent silently (no notifications for the receivers).
+ /// Dialog where the web app is being opened, and where the resulting message will be sent (see the docs for more info »).
+ /// Bot that owns the web app
+ /// Web app URL
+ /// If the web app was opened from the attachment menu using a attachment menu deep link, start_param should contain the data from the startattach parameter.
+ /// Theme parameters for the web app
+ /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is terminated should be sent in reply to this message ID.
+ /// Open the web app as the specified peer, sending the resulting the message as the specified peer.
public static Task Messages_RequestWebView(this Client client, InputPeer peer, InputUserBase bot, bool from_bot_menu = false, bool silent = false, string url = null, string start_param = null, DataJSON theme_params = null, int? reply_to_msg_id = null, InputPeer send_as = null)
=> client.Invoke(new Messages_RequestWebView
{
@@ -3178,7 +3187,13 @@ namespace TL
send_as = send_as,
});
- /// See
+ /// Indicate to the server (from the user side) that the user is still using a web app. See
+ /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is terminated should be sent silently (no notifications for the receivers).
+ /// Dialog where the web app was opened.
+ /// Bot that owns the web app
+ /// Web app interaction ID obtained from messages.requestWebView
+ /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is terminated should be sent in reply to this message ID.
+ /// Open the web app as the specified peer
public static Task Messages_ProlongWebView(this Client client, InputPeer peer, InputUserBase bot, long query_id, bool silent = false, int? reply_to_msg_id = null, InputPeer send_as = null)
=> client.Invoke(new Messages_ProlongWebView
{
@@ -3190,7 +3205,10 @@ namespace TL
send_as = send_as,
});
- /// See
+ /// Open a bot web app. See
+ /// Bot that owns the webapp
+ /// Web app URL
+ /// Theme parameters
public static Task Messages_RequestSimpleWebView(this Client client, InputUserBase bot, string url, DataJSON theme_params = null)
=> client.Invoke(new Messages_RequestSimpleWebView
{
@@ -3200,7 +3218,9 @@ namespace TL
theme_params = theme_params,
});
- /// ⚠ This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a See [bots: ✓] Possible codes: 400 (details)
+ /// ⚠ This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a Terminate webview interaction started with messages.requestWebView, sending the specified message to the chat on behalf of the user. See [bots: ✓] Possible codes: 400 (details)
+ /// Webview interaction ID obtained from messages.requestWebView
+ /// Message to send
public static Task Messages_SendWebViewResultMessage(this Client client, string bot_query_id, InputBotInlineResultBase result)
=> client.Invoke(new Messages_SendWebViewResultMessage
{
@@ -3208,7 +3228,11 @@ namespace TL
result = result,
});
- /// See
+ /// Used by the user to relay data from an opened reply keyboard bot web app to the bot that owns it. See
+ /// Bot that owns the web app
+ /// Unique client message ID to prevent duplicate sending of the same event
+ /// Text of the that was pressed to open the web app.
+ /// Data to relay to the bot, obtained from a web_app_data_send JS event.
public static Task Messages_SendWebViewData(this Client client, InputUserBase bot, long random_id, string button_text, string data)
=> client.Invoke(new Messages_SendWebViewData
{
@@ -3218,7 +3242,7 @@ namespace TL
data = data,
});
- /// Transcribe voice message See
+ /// Transcribe voice message See
/// Peer ID where the voice message was sent
/// Voice message ID
public static Task Messages_TranscribeAudio(this Client client, InputPeer peer, int msg_id)
@@ -3228,7 +3252,7 @@ namespace TL
msg_id = msg_id,
});
- /// Rate transcribed voice message See
+ /// Rate transcribed voice message See
/// Peer where the voice message was sent
/// Message ID
/// Transcription ID
@@ -3325,7 +3349,7 @@ namespace TL
video_start_ts = video_start_ts.GetValueOrDefault(),
});
- /// Deletes profile photos. See
+ /// Deletes profile photos. The method returns a list of successfully deleted photo IDs. See
/// Input photos to delete
public static Task Photos_DeletePhotos(this Client client, params InputPhoto[] id)
=> client.Invoke(new Photos_DeletePhotos
@@ -3388,7 +3412,7 @@ namespace TL
bytes = bytes,
});
- /// Returns content of an HTTP file or a part, by proxying the request through telegram. See Possible codes: 400 (details)
+ /// Returns content of a web file, by proxying the request through telegram, see the webfile docs for more info. See Possible codes: 400 (details)
/// The file to download
/// Number of bytes to be skipped
/// Number of bytes to be returned
@@ -3521,8 +3545,8 @@ namespace TL
id = id,
});
- /// Get info about a t.me link See
- /// Path in t.me/path
+ /// Get info about an unsupported deep link, see here for more info ». See
+ /// Path component of a tg: link
/// a null value means help.deepLinkInfoEmpty
public static Task Help_GetDeepLinkInfo(this Client client, string path)
=> client.Invoke(new Help_GetDeepLinkInfo
@@ -4028,7 +4052,7 @@ namespace TL
participant = participant,
});
- /// Set whether all users should join a discussion group in order to comment on a post » See
+ /// Set whether all users should join a discussion group in order to comment on a post » See Possible codes: 400 (details)
/// Discussion group
/// Toggle
public static Task Channels_ToggleJoinToSend(this Client client, InputChannelBase channel, bool enabled)
@@ -4100,7 +4124,7 @@ namespace TL
lang_code = lang_code,
});
- /// Sets the menu button action for a given user or for all users See [bots: ✓]
+ /// Sets the menu button action » for a given user or for all users See [bots: ✓] Possible codes: 400 (details)
/// User ID
/// Bot menu button action
public static Task Bots_SetBotMenuButton(this Client client, InputUserBase user_id, BotMenuButtonBase button)
@@ -4118,7 +4142,7 @@ namespace TL
user_id = user_id,
});
- /// Set the default suggested admin rights for bots being added as admins to channels. See [bots: ✓] Possible codes: (details)
+ /// Set the default suggested admin rights for bots being added as admins to channels, see here for more info on how to handle them ». See [bots: ✓] Possible codes: 400 (details)
/// Admin rights
public static Task Bots_SetBotBroadcastDefaultAdminRights(this Client client, ChatAdminRights admin_rights)
=> client.Invoke(new Bots_SetBotBroadcastDefaultAdminRights
@@ -4126,7 +4150,7 @@ namespace TL
admin_rights = admin_rights,
});
- /// Set the default suggested admin rights for bots being added as admins to groups. See [bots: ✓] Possible codes: (details)
+ /// Set the default suggested admin rights for bots being added as admins to groups, see here for more info on how to handle them ». See [bots: ✓] Possible codes: 400 (details)
/// Admin rights
public static Task Bots_SetBotGroupDefaultAdminRights(this Client client, ChatAdminRights admin_rights)
=> client.Invoke(new Bots_SetBotGroupDefaultAdminRights
@@ -4209,7 +4233,7 @@ namespace TL
number = number,
});
- /// Export invoice See [bots: ✓] Possible codes: 400 (details)
+ /// Generate an invoice deep link See [bots: ✓] Possible codes: 400 (details)
/// Invoice
public static Task Payments_ExportInvoice(this Client client, InputMedia invoice_media)
=> client.Invoke(new Payments_ExportInvoice
@@ -4217,7 +4241,9 @@ namespace TL
invoice_media = invoice_media,
});
- /// See
+ /// Informs server about a purchase made through the App Store: for official applications only. See
+ /// Receipt
+ /// Payment purpose
public static Task Payments_AssignAppStoreTransaction(this Client client, byte[] receipt, InputStorePaymentPurpose purpose)
=> client.Invoke(new Payments_AssignAppStoreTransaction
{
@@ -4225,7 +4251,9 @@ namespace TL
purpose = purpose,
});
- /// See
+ /// Informs server about a purchase made through the Play Store: for official applications only. See
+ /// Receipt
+ /// Payment purpose
public static Task Payments_AssignPlayMarketTransaction(this Client client, DataJSON receipt, InputStorePaymentPurpose purpose)
=> client.Invoke(new Payments_AssignPlayMarketTransaction
{
@@ -4233,7 +4261,8 @@ namespace TL
purpose = purpose,
});
- /// See
+ /// Checks whether Telegram Premium purchase is possible. Must be called before in-store Premium purchase. See
+ /// Payment purpose
public static Task Payments_CanPurchasePremium(this Client client, InputStorePaymentPurpose purpose)
=> client.Invoke(new Payments_CanPurchasePremium
{
@@ -4255,7 +4284,7 @@ namespace TL
/// Whether this is a video stickerset
/// Stickerset owner
/// Stickerset name, 1-64 chars
- /// Sticker set name. Can contain only English letters, digits and underscores. Must end with "by" ( is case insensitive); 1-64 characters
+ /// Short name of sticker set, to be used in sticker deep links ». Can contain only english letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in "_by_<bot_username>". <bot_username> is case insensitive. 1-64 characters.
/// Thumbnail
/// Stickers
/// Used when importing stickers using the sticker import SDKs, specifies the name of the software that created the stickers
@@ -4336,7 +4365,7 @@ namespace TL
{
});
- /// Start a telegram phone call See Possible codes: 400,403,500 (details)
+ /// Start a telegram phone call See Possible codes: 400,403 (details)
/// Whether to start a video call
/// Destination of the phone call
/// Random ID to avoid resending the same object
@@ -4402,7 +4431,7 @@ namespace TL
connection_id = connection_id,
});
- /// Rate a call See Possible codes: 400 (details)
+ /// Rate a call, returns info about the rating message sent to the official VoIP bot. See Possible codes: 400 (details)
/// Whether the user decided on their own initiative to rate the call
/// The call to rate
/// Rating in 1-5 stars
@@ -4457,7 +4486,7 @@ namespace TL
/// If set, the user's video will be disabled by default upon joining.
/// The group call
/// Join the group call, presenting yourself as the specified user/channel
- /// The invitation hash from the invite link: https://t.me/username?voicechat=hash
+ /// The invitation hash from the invite link », if provided allows speaking in a livestream or muted group chat.
/// WebRTC parameters
public static Task Phone_JoinGroupCall(this Client client, InputGroupCall call, InputPeer join_as, DataJSON params_, bool muted = false, bool video_stopped = false, string invite_hash = null)
=> client.Invoke(new Phone_JoinGroupCall
@@ -4535,7 +4564,7 @@ namespace TL
limit = limit,
});
- /// Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs See Possible codes: 400 (details)
+ /// Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs.
Returns an intersection of the source IDs specified in sources, and the source IDs currently being forwarded by the SFU. See Possible codes: 400 (details)
/// Group call
/// Source IDs
public static Task Phone_CheckGroupCall(this Client client, InputGroupCall call, int[] sources)
@@ -4601,8 +4630,8 @@ namespace TL
peer = peer,
});
- /// Get an invite link for a group call or livestream See
- /// For livestreams, if set, users that join using this link will be able to speak without explicitly requesting permission by (for example by raising their hand).
+ /// Get an invite link for a group call or livestream See
+ /// For livestreams or muted group chats, if set, users that join using this link will be able to speak without explicitly requesting permission by (for example by raising their hand).
/// The group call
public static Task Phone_ExportGroupCallInvite(this Client client, InputGroupCall call, bool can_self_unmute = false)
=> client.Invoke(new Phone_ExportGroupCallInvite
@@ -4686,7 +4715,7 @@ namespace TL
});
/// Get localization pack strings See Possible codes: 400 (details)
- /// Language pack name
+ /// Language pack name, usually obtained from a language pack link
/// Language code
public static Task Langpack_GetLangPack(this Client client, string lang_pack, string lang_code)
=> client.Invoke(new Langpack_GetLangPack
@@ -4696,7 +4725,7 @@ namespace TL
});
/// Get strings from a language pack See Possible codes: 400 (details)
- /// Language pack name
+ /// Language pack name, usually obtained from a language pack link
/// Language code
/// Strings to get
public static Task Langpack_GetStrings(this Client client, string lang_pack, string lang_code, string[] keys)
@@ -4728,7 +4757,7 @@ namespace TL
});
/// Get information about a language in a localization pack See Possible codes: 400 (details)
- /// Language pack name
+ /// Language pack name, usually obtained from a language pack link
/// Language code
public static Task Langpack_GetLanguage(this Client client, string lang_pack, string lang_code)
=> client.Invoke(new Langpack_GetLanguage
diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs
index 8fd4e7c..63f6331 100644
--- a/src/TL.Secret.cs
+++ b/src/TL.Secret.cs
@@ -137,7 +137,7 @@ namespace TL
public string file_name;
/// File MIME-type
public string mime_type;
- /// Document size
+ /// Document size ( on layer <143, on layer >=143)
public int size;
/// Key to decrypt the attached document file
public byte[] key;
@@ -439,7 +439,7 @@ namespace TL
public int thumb_h;
/// File MIME-type
public string mime_type;
- /// Document size
+ /// Document size ( on layer <143, on layer >=143)
public int size;
/// Key to decrypt the attached document file
public byte[] key;
diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj
index 50b34fe..b0963c6 100644
--- a/src/WTelegramClient.csproj
+++ b/src/WTelegramClient.csproj
@@ -48,7 +48,7 @@
-
+
From 3f3ff4cb9b3058fabcc3f3d0a5a6711889c7df57 Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Fri, 2 Sep 2022 23:47:51 +0200
Subject: [PATCH 026/390] Upgrade to layer 145: Emoji/reactions/stickerset
stuff, email verification
---
README.md | 2 +-
src/TL.Schema.cs | 293 ++++++++++++++++++++++++++++++++++++------
src/TL.SchemaFuncs.cs | 221 +++++++++++++++++++++++--------
src/TL.Table.cs | 59 +++++++--
4 files changed, 469 insertions(+), 106 deletions(-)
diff --git a/README.md b/README.md
index be93df3..8f056d5 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
[](https://www.nuget.org/packages/WTelegramClient/)
[](https://dev.azure.com/wiz0u/WTelegramClient/_build?definitionId=7)
-[](https://corefork.telegram.org/methods)
+[](https://corefork.telegram.org/methods)
[](https://dev.azure.com/wiz0u/WTelegramClient/_artifacts/feed/WTelegramClient/NuGet/WTelegramClient)
[](https://t.me/WTelegramClient)
[](http://t.me/WTelegramBot?start=donate)
diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs
index 7323773..a6e8f7b 100644
--- a/src/TL.Schema.cs
+++ b/src/TL.Schema.cs
@@ -695,7 +695,7 @@ namespace TL
public long id;
}
/// Indicates info about a certain user See
- [TLDef(0x3FF6ECB0)]
+ [TLDef(0x5D99ADEE)]
public partial class User : UserBase
{
/// Flags, see TL conditional fields
@@ -724,6 +724,7 @@ namespace TL
[IfFlag(19)] public string bot_inline_placeholder;
/// Language code of the user
[IfFlag(22)] public string lang_code;
+ [IfFlag(30)] public EmojiStatus emoji_status;
[Flags] public enum Flags : uint
{
@@ -781,6 +782,8 @@ namespace TL
premium = 0x10000000,
/// Whether we installed the attachment menu web app offered by this bot
attach_menu_enabled = 0x20000000,
+ /// Field has a value
+ has_emoji_status = 0x40000000,
}
}
@@ -1070,10 +1073,10 @@ namespace TL
/// IDs of users who requested to join recently
public abstract long[] RecentRequesters { get; }
/// Allowed message reactions »
- public abstract string[] AvailableReactions { get; }
+ public abstract ChatReactions AvailableReactions { get; }
}
/// Full info about a basic group. See
- [TLDef(0xD18EE226)]
+ [TLDef(0xC9D31138)]
public partial class ChatFull : ChatFullBase
{
/// Flags, see TL conditional fields
@@ -1109,7 +1112,7 @@ namespace TL
/// IDs of users who requested to join recently
[IfFlag(17)] public long[] recent_requesters;
/// Allowed message reactions »
- [IfFlag(18)] public string[] available_reactions;
+ [IfFlag(18)] public ChatReactions available_reactions;
[Flags] public enum Flags : uint
{
@@ -1170,10 +1173,10 @@ namespace TL
/// IDs of users who requested to join recently
public override long[] RecentRequesters => recent_requesters;
/// Allowed message reactions »
- public override string[] AvailableReactions => available_reactions;
+ public override ChatReactions AvailableReactions => available_reactions;
}
/// Full info about a channel, supergroup or gigagroup. See
- [TLDef(0xEA68A619)]
+ [TLDef(0xF2355507)]
public partial class ChannelFull : ChatFullBase
{
/// Flags, see TL conditional fields
@@ -1249,7 +1252,7 @@ namespace TL
/// Default peer used for sending messages to this channel
[IfFlag(29)] public Peer default_send_as;
/// Allowed message reactions »
- [IfFlag(30)] public string[] available_reactions;
+ [IfFlag(30)] public ChatReactions available_reactions;
[Flags] public enum Flags : uint
{
@@ -1352,7 +1355,7 @@ namespace TL
/// IDs of users who requested to join recently
public override long[] RecentRequesters => recent_requesters;
/// Allowed message reactions »
- public override string[] AvailableReactions => available_reactions;
+ public override ChatReactions AvailableReactions => available_reactions;
}
/// Details of a group member. Derived classes: , , See
@@ -3250,7 +3253,7 @@ namespace TL
[Flags] public enum Flags : uint
{
- /// (boolTrue) if the message must be displayed in a popup.
+ /// If set, the message must be displayed in a popup.
popup = 0x1,
/// Field has a value
has_inbox_date = 0x2,
@@ -3419,25 +3422,24 @@ namespace TL
public Messages_StickerSet stickerset;
}
/// The order of stickersets was changed See
- [TLDef(0x0BB2D201)]
- public class UpdateStickerSetsOrder : Update
+ [TLDef(0x0BB2D201, inheritBefore = true)]
+ public class UpdateStickerSetsOrder : UpdateStickerSets
{
- /// Flags, see TL conditional fields
- public Flags flags;
/// New sticker order by sticker ID
public long[] order;
+ }
+ /// Installed stickersets have changed, the client should refetch them using messages.getAllStickers See
+ [TLDef(0x31C24808)]
+ public class UpdateStickerSets : Update
+ {
+ public Flags flags;
[Flags] public enum Flags : uint
{
- /// Whether the updated stickers are mask stickers
masks = 0x1,
- /// Whether the updated stickers are custom emoji stickers
emojis = 0x2,
}
}
- /// Installed stickersets have changed, the client should refetch them using messages.getAllStickers See
- [TLDef(0x43AE3DEC)]
- public class UpdateStickerSets : Update { }
/// The saved gif list has changed, the client should refetch it using messages.getSavedGifs See
[TLDef(0x9375341E)]
public class UpdateSavedGifs : Update { }
@@ -4244,6 +4246,32 @@ namespace TL
/// Some featured emoji stickers were marked as read See
[TLDef(0xFB4C496C)]
public class UpdateReadFeaturedEmojiStickers : Update { }
+ /// See
+ [TLDef(0x28373599)]
+ public class UpdateUserEmojiStatus : Update
+ {
+ public long user_id;
+ public EmojiStatus emoji_status;
+ }
+ /// See
+ [TLDef(0x30F443DB)]
+ public class UpdateRecentEmojiStatuses : Update { }
+ /// See
+ [TLDef(0x6F7863F4)]
+ public class UpdateRecentReactions : Update { }
+ /// See
+ [TLDef(0x86FCCF85)]
+ public class UpdateMoveStickerSetToTop : Update
+ {
+ public Flags flags;
+ public long stickerset;
+
+ [Flags] public enum Flags : uint
+ {
+ masks = 0x1,
+ emojis = 0x2,
+ }
+ }
/// Updates state. See
[TLDef(0xA56C2A3E)]
@@ -4669,7 +4697,7 @@ namespace TL
}
/// Current configuration See
- [TLDef(0x330B4067)]
+ [TLDef(0x232566AC)]
public class Config : IObject
{
/// Flags, see TL conditional fields
@@ -4762,6 +4790,7 @@ namespace TL
[IfFlag(2)] public int lang_pack_version;
/// Basic language pack version
[IfFlag(2)] public int base_lang_pack_version;
+ [IfFlag(15)] public Reaction reactions_default;
[Flags] public enum Flags : uint
{
@@ -4795,6 +4824,8 @@ namespace TL
pfs_enabled = 0x2000,
/// Whether to forcefully try connecting using IPv6
force_try_ipv6 = 0x4000,
+ /// Field has a value
+ has_reactions_default = 0x8000,
}
}
@@ -5812,7 +5843,7 @@ namespace TL
}
/// Configuration for two-factor authorization See
- [TLDef(0x185B184F)]
+ [TLDef(0x957B50FB)]
public class Account_Password : IObject
{
/// Flags, see TL conditional fields
@@ -5835,6 +5866,7 @@ namespace TL
public byte[] secure_random;
/// The 2FA password will be automatically removed at this date, unless the user cancels the operation
[IfFlag(5)] public DateTime pending_reset_date;
+ [IfFlag(6)] public string login_email_pattern;
[Flags] public enum Flags : uint
{
@@ -5850,6 +5882,8 @@ namespace TL
has_email_unconfirmed_pattern = 0x10,
/// Field has a value
has_pending_reset_date = 0x20,
+ /// Field has a value
+ has_login_email_pattern = 0x40,
}
}
@@ -6061,6 +6095,12 @@ namespace TL
/// Stickers to show when receiving a gifted Telegram Premium subscription See
[TLDef(0xC88B3B02)]
public class InputStickerSetPremiumGifts : InputStickerSet { }
+ /// See
+ [TLDef(0x04C4D4CE)]
+ public class InputStickerSetEmojiGenericAnimations : InputStickerSet { }
+ /// See
+ [TLDef(0x29D0F5EE)]
+ public class InputStickerSetEmojiDefaultStatuses : InputStickerSet { }
/// Represents a stickerset (stickerpack) See
[TLDef(0x2DD14EDC)]
@@ -7594,6 +7634,34 @@ namespace TL
/// Prefix of the phone number from which the call will be made
public string prefix;
}
+ /// See
+ [TLDef(0x5A159841)]
+ public class Auth_SentCodeTypeEmailCode : Auth_SentCodeType
+ {
+ public Flags flags;
+ public string email_pattern;
+ public int length;
+ [IfFlag(2)] public DateTime next_phone_login_date;
+
+ [Flags] public enum Flags : uint
+ {
+ apple_signin_allowed = 0x1,
+ google_signin_allowed = 0x2,
+ has_next_phone_login_date = 0x4,
+ }
+ }
+ /// See
+ [TLDef(0xA5491DEA)]
+ public class Auth_SentCodeTypeSetUpEmailRequired : Auth_SentCodeType
+ {
+ public Flags flags;
+
+ [Flags] public enum Flags : uint
+ {
+ apple_signin_allowed = 0x1,
+ google_signin_allowed = 0x2,
+ }
+ }
/// Callback answer sent by the bot in response to a button press See
[TLDef(0x36585EA4)]
@@ -9707,13 +9775,13 @@ namespace TL
public MessageBase message;
}
/// The set of allowed message reactions » for this channel has changed See
- [TLDef(0x9CF7F76A)]
+ [TLDef(0xBE4E0EF8)]
public class ChannelAdminLogEventActionChangeAvailableReactions : ChannelAdminLogEventAction
{
/// Previously allowed reaction emojis
- public string[] prev_value;
+ public ChatReactions prev_value;
/// New allowed reaction emojis
- public string[] new_value;
+ public ChatReactions new_value;
}
/// Admin log event See
@@ -11487,7 +11555,7 @@ namespace TL
[IfFlag(3)] public int outbox_accent_color;
/// The fill to be used as a background for outgoing messages, in RGB24 format.
If just one or two equal colors are provided, describes a solid fill of a background.
If two different colors are provided, describes the top and bottom colors of a 0-degree gradient.
If three or four colors are provided, describes a freeform gradient fill of a background.
[IfFlag(0)] public int[] message_colors;
- /// Wallpaper
+ /// or when passing wallpaper files for image or pattern wallpapers, with id=0 otherwise.
[IfFlag(1)] public InputWallPaperBase wallpaper;
/// Wallpaper settings.
[IfFlag(1)] public WallPaperSettings wallpaper_settings;
@@ -12797,11 +12865,11 @@ namespace TL
}
/// A list of peers that can be used to send messages in a specific group See
- [TLDef(0x8356CDA9)]
+ [TLDef(0xF496B0C6)]
public class Channels_SendAsPeers : IObject, IPeerResolver
{
/// Peers that can be used to send messages to the group
- public Peer[] peers;
+ public SendAsPeer[] peers;
/// Mentioned chats
public Dictionary chats;
/// Mentioned users
@@ -12855,20 +12923,21 @@ namespace TL
}
/// Reactions See
- [TLDef(0x6FB250D1)]
+ [TLDef(0xA3D1CB80)]
public class ReactionCount : IObject
{
/// Flags, see TL conditional fields
public Flags flags;
+ [IfFlag(0)] public int chosen_order;
/// Reaction (a UTF8 emoji)
- public string reaction;
+ public Reaction reaction;
/// NUmber of users that reacted with this emoji
public int count;
[Flags] public enum Flags : uint
{
- /// Whether the current user sent this reaction
- chosen = 0x1,
+ /// Field has a value
+ has_chosen_order = 0x1,
}
}
@@ -12981,7 +13050,7 @@ namespace TL
}
/// How a certain peer reacted to the message See
- [TLDef(0x51B67EFF)]
+ [TLDef(0xB156FE9C)]
public class MessagePeerReaction : IObject
{
/// Flags, see TL conditional fields
@@ -12989,7 +13058,7 @@ namespace TL
/// Peer that reacted to the message
public Peer peer_id;
/// Reaction emoji
- public string reaction;
+ public Reaction reaction;
[Flags] public enum Flags : uint
{
@@ -13271,7 +13340,7 @@ namespace TL
}
/// Telegram Premium promotion information See
- [TLDef(0x8A4F3C29)]
+ [TLDef(0x5334759C)]
public class Help_PremiumPromo : IObject
{
/// Description of the current state of the user's Telegram Premium subscription
@@ -13282,10 +13351,7 @@ namespace TL
public string[] video_sections;
/// A list of videos
public DocumentBase[] videos;
- /// Three-letter ISO 4217 currency code
- public string currency;
- /// Monthly price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
- public long monthly_amount;
+ public PremiumSubscriptionOption[] period_options;
/// Related user information
public Dictionary users;
}
@@ -13350,4 +13416,157 @@ namespace TL
/// Payment method description
public string title;
}
+
+ /// See
+ /// a null value means emojiStatusEmpty
+ [TLDef(0x929B619D)]
+ public class EmojiStatus : IObject
+ {
+ public long document_id;
+ }
+ /// See
+ [TLDef(0xFA30A8C7, inheritBefore = true)]
+ public class EmojiStatusUntil : EmojiStatus
+ {
+ public int until;
+ }
+
+ /// See
+ /// a null value means account.emojiStatusesNotModified
+ [TLDef(0x90C467D1)]
+ public class Account_EmojiStatuses : IObject
+ {
+ public long hash;
+ public EmojiStatus[] statuses;
+ }
+
+ /// See
+ /// a null value means reactionEmpty
+ public abstract class Reaction : IObject { }
+ /// See
+ [TLDef(0x1B2286B8)]
+ public class ReactionEmoji : Reaction
+ {
+ public string emoticon;
+ }
+ /// See
+ [TLDef(0x8935FC73)]
+ public class ReactionCustomEmoji : Reaction
+ {
+ public long document_id;
+ }
+
+ /// See
+ public abstract class ChatReactions : IObject { }
+ /// See
+ [TLDef(0xEAFC32BC)]
+ public class ChatReactionsNone : ChatReactions { }
+ /// See
+ [TLDef(0x52928BCA)]
+ public class ChatReactionsAll : ChatReactions
+ {
+ public Flags flags;
+
+ [Flags] public enum Flags : uint
+ {
+ allow_custom = 0x1,
+ }
+ }
+ /// See
+ [TLDef(0x661D4037)]
+ public class ChatReactionsSome : ChatReactions
+ {
+ public Reaction[] reactions;
+ }
+
+ /// See
+ /// a null value means messages.reactionsNotModified
+ [TLDef(0xEAFDF716)]
+ public class Messages_Reactions : IObject
+ {
+ public long hash;
+ public Reaction[] reactions;
+ }
+
+ /// See
+ public abstract class EmailVerifyPurpose : IObject { }
+ /// See
+ [TLDef(0x4345BE73)]
+ public class EmailVerifyPurposeLoginSetup : EmailVerifyPurpose
+ {
+ public string phone_number;
+ public string phone_code_hash;
+ }
+ /// See
+ [TLDef(0x527D22EB)]
+ public class EmailVerifyPurposeLoginChange : EmailVerifyPurpose { }
+ /// See
+ [TLDef(0xBBF51685)]
+ public class EmailVerifyPurposePassport : EmailVerifyPurpose { }
+
+ /// See
+ public abstract class EmailVerification : IObject { }
+ /// See
+ [TLDef(0x922E55A9)]
+ public class EmailVerificationCode : EmailVerification
+ {
+ public string code;
+ }
+ /// See
+ [TLDef(0xDB909EC2)]
+ public class EmailVerificationGoogle : EmailVerification
+ {
+ public string token;
+ }
+ /// See
+ [TLDef(0x96D074FD)]
+ public class EmailVerificationApple : EmailVerification
+ {
+ public string token;
+ }
+
+ /// See
+ [TLDef(0x2B96CD1B)]
+ public class Account_EmailVerified : IObject
+ {
+ public string email;
+ }
+ /// See
+ [TLDef(0xE1BB0D61, inheritBefore = true)]
+ public class Account_EmailVerifiedLogin : Account_EmailVerified
+ {
+ public Auth_SentCode sent_code;
+ }
+
+ /// See
+ [TLDef(0xB6F11EBE)]
+ public class PremiumSubscriptionOption : IObject
+ {
+ public Flags flags;
+ public int months;
+ public string currency;
+ public long amount;
+ public string bot_url;
+ [IfFlag(0)] public string store_product;
+
+ [Flags] public enum Flags : uint
+ {
+ has_store_product = 0x1,
+ current = 0x2,
+ can_purchase_upgrade = 0x4,
+ }
+ }
+
+ /// See
+ [TLDef(0xB81C7034)]
+ public class SendAsPeer : IObject
+ {
+ public Flags flags;
+ public Peer peer;
+
+ [Flags] public enum Flags : uint
+ {
+ premium_required = 0x1,
+ }
+ }
}
diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs
index b09d00b..3a9a410 100644
--- a/src/TL.SchemaFuncs.cs
+++ b/src/TL.SchemaFuncs.cs
@@ -127,12 +127,14 @@ namespace TL
/// SMS-message ID, obtained from auth.sendCode
/// Valid numerical code from the SMS-message
[Obsolete("Use LoginUserIfNeeded instead of this method. See https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#tlsharp")]
- public static Task Auth_SignIn(this Client client, string phone_number, string phone_code_hash, string phone_code)
+ public static Task Auth_SignIn(this Client client, string phone_number, string phone_code_hash, string phone_code = null, EmailVerification email_verification = null)
=> client.Invoke(new Auth_SignIn
{
+ flags = (Auth_SignIn.Flags)((phone_code != null ? 0x1 : 0) | (email_verification != null ? 0x2 : 0)),
phone_number = phone_number,
phone_code_hash = phone_code_hash,
phone_code = phone_code,
+ email_verification = email_verification,
});
/// Logs out the user. See [bots: ✓]
@@ -640,20 +642,19 @@ namespace TL
/// Send the verification email code for telegram passport. See Possible codes: 400 (details)
/// The email where to send the code
- public static Task Account_SendVerifyEmailCode(this Client client, string email)
+ public static Task Account_SendVerifyEmailCode(this Client client, EmailVerifyPurpose purpose, string email)
=> client.Invoke(new Account_SendVerifyEmailCode
{
+ purpose = purpose,
email = email,
});
/// Verify an email address for telegram passport. See Possible codes: 400 (details)
- /// The email to verify
- /// The verification code that was received
- public static Task Account_VerifyEmail(this Client client, string email, string code)
+ public static Task Account_VerifyEmail(this Client client, EmailVerifyPurpose purpose, EmailVerification verification)
=> client.Invoke(new Account_VerifyEmail
{
- email = email,
- code = code,
+ purpose = purpose,
+ verification = verification,
});
/// Initialize account takeout session See Possible codes: 420 (details)
@@ -789,7 +790,7 @@ namespace TL
});
/// Upload theme See Possible codes: 400 (details)
- /// Theme file uploaded as described in files »
+ /// Previously uploaded theme file with platform-specific colors for UI components, can be left unset when creating themes that only modify the wallpaper or accent colors.
/// Thumbnail
/// File name
/// MIME type, must be application/x-tgtheme-{format}, where format depends on the client
@@ -804,7 +805,7 @@ namespace TL
});
/// Create a theme See Possible codes: 400 (details)
- /// Unique theme ID
+ /// Unique theme ID used to generate theme deep links, can be empty to autogenerate a random ID.
/// Theme name
/// Theme file
/// Theme settings
@@ -1007,6 +1008,35 @@ namespace TL
mime_type = mime_type,
});
+ /// See
+ public static Task Account_UpdateEmojiStatus(this Client client, EmojiStatus emoji_status)
+ => client.Invoke(new Account_UpdateEmojiStatus
+ {
+ emoji_status = emoji_status,
+ });
+
+ /// See
+ /// a null value means account.emojiStatusesNotModified
+ public static Task Account_GetDefaultEmojiStatuses(this Client client, long hash = default)
+ => client.Invoke(new Account_GetDefaultEmojiStatuses
+ {
+ hash = hash,
+ });
+
+ /// See
+ /// a null value means account.emojiStatusesNotModified
+ public static Task Account_GetRecentEmojiStatuses(this Client client, long hash = default)
+ => client.Invoke(new Account_GetRecentEmojiStatuses
+ {
+ hash = hash,
+ });
+
+ /// See
+ public static Task Account_ClearRecentEmojiStatuses(this Client client)
+ => client.Invoke(new Account_ClearRecentEmojiStatuses
+ {
+ });
+
/// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400 (details)
/// List of user identifiers
public static Task Users_GetUsers(this Client client, params InputUserBase[] id)
@@ -1387,10 +1417,10 @@ namespace TL
/// Message entities for sending styled text
/// Scheduled message date for scheduled messages
/// Send this message as the specified peer
- public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null)
+ public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null)
=> client.Invoke(new Messages_SendMessage
{
- flags = (Messages_SendMessage.Flags)((no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)),
+ flags = (Messages_SendMessage.Flags)((no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)),
peer = peer,
reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(),
message = message,
@@ -1415,10 +1445,10 @@ namespace TL
/// Message entities for styled text
/// Scheduled message date for scheduled messages
/// Send this message as the specified peer
- public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null)
+ public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null)
=> client.Invoke(new Messages_SendMedia
{
- flags = (Messages_SendMedia.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)),
+ flags = (Messages_SendMedia.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)),
peer = peer,
reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(),
media = media,
@@ -2371,10 +2401,10 @@ namespace TL
/// The medias to send
/// Scheduled message date for scheduled messages
/// Send this message as the specified peer
- public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, int? reply_to_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null)
+ public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, int? reply_to_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null)
=> client.Invoke(new Messages_SendMultiMedia
{
- flags = (Messages_SendMultiMedia.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)),
+ flags = (Messages_SendMultiMedia.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)),
peer = peer,
reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(),
multi_media = multi_media,
@@ -3019,10 +3049,10 @@ namespace TL
/// Peer
/// Message ID to react to
/// Reaction (a UTF8 emoji)
- public static Task Messages_SendReaction(this Client client, InputPeer peer, int msg_id, bool big = false, string reaction = null)
+ public static Task Messages_SendReaction(this Client client, InputPeer peer, int msg_id, bool big = false, bool add_to_recent = false, Reaction[] reaction = null)
=> client.Invoke(new Messages_SendReaction
{
- flags = (Messages_SendReaction.Flags)((big ? 0x2 : 0) | (reaction != null ? 0x1 : 0)),
+ flags = (Messages_SendReaction.Flags)((big ? 0x2 : 0) | (add_to_recent ? 0x4 : 0) | (reaction != null ? 0x1 : 0)),
peer = peer,
msg_id = msg_id,
reaction = reaction,
@@ -3044,7 +3074,7 @@ namespace TL
/// Get only reactions of this type (UTF8 emoji)
/// Offset (typically taken from the next_offset field of the returned )
/// Maximum number of results to return, see pagination
- public static Task Messages_GetMessageReactionsList(this Client client, InputPeer peer, int id, int limit = int.MaxValue, string reaction = null, string offset = null)
+ public static Task Messages_GetMessageReactionsList(this Client client, InputPeer peer, int id, int limit = int.MaxValue, Reaction reaction = null, string offset = null)
=> client.Invoke(new Messages_GetMessageReactionsList
{
flags = (Messages_GetMessageReactionsList.Flags)((reaction != null ? 0x1 : 0) | (offset != null ? 0x2 : 0)),
@@ -3058,7 +3088,7 @@ namespace TL
/// Change the set of message reactions » that can be used in a certain group, supergroup or channel See Possible codes: 400 (details)
/// Group where to apply changes
/// Allowed reaction emojis
- public static Task Messages_SetChatAvailableReactions(this Client client, InputPeer peer, string[] available_reactions)
+ public static Task Messages_SetChatAvailableReactions(this Client client, InputPeer peer, ChatReactions available_reactions)
=> client.Invoke(new Messages_SetChatAvailableReactions
{
peer = peer,
@@ -3076,7 +3106,7 @@ namespace TL
/// Change default emoji reaction to use in the quick reaction menu: the value is synced across devices and can be fetched using help.getAppConfig, reactions_default field. See
/// New emoji reaction
- public static Task Messages_SetDefaultReaction(this Client client, string reaction)
+ public static Task Messages_SetDefaultReaction(this Client client, Reaction reaction)
=> client.Invoke(new Messages_SetDefaultReaction
{
reaction = reaction,
@@ -3174,7 +3204,7 @@ namespace TL
/// Theme parameters for the web app
/// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is terminated should be sent in reply to this message ID.
/// Open the web app as the specified peer, sending the resulting the message as the specified peer.
- public static Task Messages_RequestWebView(this Client client, InputPeer peer, InputUserBase bot, bool from_bot_menu = false, bool silent = false, string url = null, string start_param = null, DataJSON theme_params = null, int? reply_to_msg_id = null, InputPeer send_as = null)
+ public static Task Messages_RequestWebView(this Client client, InputPeer peer, InputUserBase bot, string platform, bool from_bot_menu = false, bool silent = false, string url = null, string start_param = null, DataJSON theme_params = null, int? reply_to_msg_id = null, InputPeer send_as = null)
=> client.Invoke(new Messages_RequestWebView
{
flags = (Messages_RequestWebView.Flags)((from_bot_menu ? 0x10 : 0) | (silent ? 0x20 : 0) | (url != null ? 0x2 : 0) | (start_param != null ? 0x8 : 0) | (theme_params != null ? 0x4 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (send_as != null ? 0x2000 : 0)),
@@ -3183,6 +3213,7 @@ namespace TL
url = url,
start_param = start_param,
theme_params = theme_params,
+ platform = platform,
reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(),
send_as = send_as,
});
@@ -3209,13 +3240,14 @@ namespace TL
/// Bot that owns the webapp
/// Web app URL
/// Theme parameters
- public static Task Messages_RequestSimpleWebView(this Client client, InputUserBase bot, string url, DataJSON theme_params = null)
+ public static Task Messages_RequestSimpleWebView(this Client client, InputUserBase bot, string url, string platform, DataJSON theme_params = null)
=> client.Invoke(new Messages_RequestSimpleWebView
{
flags = (Messages_RequestSimpleWebView.Flags)(theme_params != null ? 0x1 : 0),
bot = bot,
url = url,
theme_params = theme_params,
+ platform = platform,
});
/// ⚠ This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a Terminate webview interaction started with messages.requestWebView, sending the specified message to the chat on behalf of the user. See [bots: ✓] Possible codes: 400 (details)
@@ -3291,6 +3323,39 @@ namespace TL
hash = hash,
});
+ /// See
+ public static Task Messages_ReportReaction(this Client client, InputPeer peer, int id, InputPeer reaction_peer)
+ => client.Invoke(new Messages_ReportReaction
+ {
+ peer = peer,
+ id = id,
+ reaction_peer = reaction_peer,
+ });
+
+ /// See
+ /// a null value means messages.reactionsNotModified
+ public static Task Messages_GetTopReactions(this Client client, int limit = int.MaxValue, long hash = default)
+ => client.Invoke(new Messages_GetTopReactions
+ {
+ limit = limit,
+ hash = hash,
+ });
+
+ /// See
+ /// a null value means messages.reactionsNotModified
+ public static Task Messages_GetRecentReactions(this Client client, int limit = int.MaxValue, long hash = default)
+ => client.Invoke(new Messages_GetRecentReactions
+ {
+ limit = limit,
+ hash = hash,
+ });
+
+ /// See
+ public static Task Messages_ClearRecentReactions(this Client client)
+ => client.Invoke(new Messages_ClearRecentReactions
+ {
+ });
+
/// Returns a current state of updates. See [bots: ✓]
public static Task Updates_GetState(this Client client)
=> client.Invoke(new Updates_GetState
@@ -4269,15 +4334,6 @@ namespace TL
purpose = purpose,
});
- /// See
- public static Task Payments_RequestRecurringPayment(this Client client, InputUserBase user_id, string recurring_init_charge, InputMedia invoice_media)
- => client.Invoke(new Payments_RequestRecurringPayment
- {
- user_id = user_id,
- recurring_init_charge = recurring_init_charge,
- invoice_media = invoice_media,
- });
-
/// Create a stickerset, bots only. See [bots: ✓] Possible codes: 400 (details)
/// Whether this is a mask stickerset
/// Whether this is an animated stickerset
@@ -4928,12 +4984,20 @@ namespace TL.Methods
public string last_name;
}
- [TLDef(0xBCD51581)]
+ [TLDef(0x8D52A951)]
public class Auth_SignIn : IMethod
{
+ public Flags flags;
public string phone_number;
public string phone_code_hash;
- public string phone_code;
+ [IfFlag(0)] public string phone_code;
+ [IfFlag(1)] public EmailVerification email_verification;
+
+ [Flags] public enum Flags : uint
+ {
+ has_phone_code = 0x1,
+ has_email_verification = 0x2,
+ }
}
[TLDef(0x3E72BA19)]
@@ -5298,17 +5362,18 @@ namespace TL.Methods
public string phone_code;
}
- [TLDef(0x7011509F)]
+ [TLDef(0x98E037BB)]
public class Account_SendVerifyEmailCode : IMethod
{
+ public EmailVerifyPurpose purpose;
public string email;
}
- [TLDef(0xECBA39DB)]
- public class Account_VerifyEmail : IMethod
+ [TLDef(0x032DA4CF)]
+ public class Account_VerifyEmail : IMethod
{
- public string email;
- public string code;
+ public EmailVerifyPurpose purpose;
+ public EmailVerification verification;
}
[TLDef(0x8EF3EAB0)]
@@ -5603,6 +5668,27 @@ namespace TL.Methods
public string mime_type;
}
+ [TLDef(0xFBD3DE6B)]
+ public class Account_UpdateEmojiStatus : IMethod
+ {
+ public EmojiStatus emoji_status;
+ }
+
+ [TLDef(0xD6753386)]
+ public class Account_GetDefaultEmojiStatuses : IMethod
+ {
+ public long hash;
+ }
+
+ [TLDef(0x0F578105)]
+ public class Account_GetRecentEmojiStatuses : IMethod
+ {
+ public long hash;
+ }
+
+ [TLDef(0x18201AAE)]
+ public class Account_ClearRecentEmojiStatuses : IMethod { }
+
[TLDef(0x0D91A548)]
public class Users_GetUsers : IMethod
{
@@ -5926,6 +6012,7 @@ namespace TL.Methods
has_schedule_date = 0x400,
has_send_as = 0x2000,
noforwards = 0x4000,
+ update_stickersets_order = 0x8000,
}
}
@@ -5954,6 +6041,7 @@ namespace TL.Methods
has_schedule_date = 0x400,
has_send_as = 0x2000,
noforwards = 0x4000,
+ update_stickersets_order = 0x8000,
}
}
@@ -6764,6 +6852,7 @@ namespace TL.Methods
has_schedule_date = 0x400,
has_send_as = 0x2000,
noforwards = 0x4000,
+ update_stickersets_order = 0x8000,
}
}
@@ -7273,18 +7362,19 @@ namespace TL.Methods
public InputPeer send_as;
}
- [TLDef(0x25690CE4)]
+ [TLDef(0xD30D78D4)]
public class Messages_SendReaction : IMethod
{
public Flags flags;
public InputPeer peer;
public int msg_id;
- [IfFlag(0)] public string reaction;
+ [IfFlag(0)] public Reaction[] reaction;
[Flags] public enum Flags : uint
{
has_reaction = 0x1,
big = 0x2,
+ add_to_recent = 0x4,
}
}
@@ -7295,13 +7385,13 @@ namespace TL.Methods
public int[] id;
}
- [TLDef(0xE0EE6B77)]
+ [TLDef(0x461B3F48)]
public class Messages_GetMessageReactionsList : IMethod
{
public Flags flags;
public InputPeer peer;
public int id;
- [IfFlag(0)] public string reaction;
+ [IfFlag(0)] public Reaction reaction;
[IfFlag(1)] public string offset;
public int limit;
@@ -7312,11 +7402,11 @@ namespace TL.Methods
}
}
- [TLDef(0x14050EA6)]
+ [TLDef(0xFEB16771)]
public class Messages_SetChatAvailableReactions : IMethod
{
public InputPeer peer;
- public string[] available_reactions;
+ public ChatReactions available_reactions;
}
[TLDef(0x18DEA0AC)]
@@ -7325,10 +7415,10 @@ namespace TL.Methods
public int hash;
}
- [TLDef(0xD960C4D4)]
+ [TLDef(0x4F47A016)]
public class Messages_SetDefaultReaction : IMethod
{
- public string reaction;
+ public Reaction reaction;
}
[TLDef(0x24CE6DEE)]
@@ -7393,7 +7483,7 @@ namespace TL.Methods
public bool enabled;
}
- [TLDef(0x91B15831)]
+ [TLDef(0xFC87A53C)]
public class Messages_RequestWebView : IMethod
{
public Flags flags;
@@ -7402,6 +7492,7 @@ namespace TL.Methods
[IfFlag(1)] public string url;
[IfFlag(3)] public string start_param;
[IfFlag(2)] public DataJSON theme_params;
+ public string platform;
[IfFlag(0)] public int reply_to_msg_id;
[IfFlag(13)] public InputPeer send_as;
@@ -7435,13 +7526,14 @@ namespace TL.Methods
}
}
- [TLDef(0x6ABB2F73)]
+ [TLDef(0x299BEC8E)]
public class Messages_RequestSimpleWebView : IMethod
{
public Flags flags;
public InputUserBase bot;
public string url;
[IfFlag(0)] public DataJSON theme_params;
+ public string platform;
[Flags] public enum Flags : uint
{
@@ -7499,6 +7591,31 @@ namespace TL.Methods
public long hash;
}
+ [TLDef(0x3F64C076)]
+ public class Messages_ReportReaction : IMethod
+ {
+ public InputPeer peer;
+ public int id;
+ public InputPeer reaction_peer;
+ }
+
+ [TLDef(0xBB8125BA)]
+ public class Messages_GetTopReactions : IMethod
+ {
+ public int limit;
+ public long hash;
+ }
+
+ [TLDef(0x39461DB2)]
+ public class Messages_GetRecentReactions : IMethod
+ {
+ public int limit;
+ public long hash;
+ }
+
+ [TLDef(0x9DFEEFB4)]
+ public class Messages_ClearRecentReactions : IMethod { }
+
[TLDef(0xEDD4882A)]
public class Updates_GetState : IMethod { }
@@ -8231,14 +8348,6 @@ namespace TL.Methods
public InputStorePaymentPurpose purpose;
}
- [TLDef(0x146E958D)]
- public class Payments_RequestRecurringPayment : IMethod
- {
- public InputUserBase user_id;
- public string recurring_init_charge;
- public InputMedia invoice_media;
- }
-
[TLDef(0x9021AB67)]
public class Stickers_CreateStickerSet : IMethod
{
diff --git a/src/TL.Table.cs b/src/TL.Table.cs
index 52a1fbd..fba7357 100644
--- a/src/TL.Table.cs
+++ b/src/TL.Table.cs
@@ -6,7 +6,7 @@ namespace TL
{
public static class Layer
{
- public const int Version = 144; // fetched 03/08/2022 22:13:22
+ public const int Version = 145; // fetched 02/09/2022 20:50:42
internal const uint VectorCtor = 0x1CB5C415;
internal const uint NullCtor = 0x56730BCC;
internal const uint RpcResultCtor = 0xF35C6D01;
@@ -116,7 +116,7 @@ namespace TL
[0x36C6019A] = typeof(PeerChat),
[0xA2A5371E] = typeof(PeerChannel),
[0xD3BC4B7A] = typeof(UserEmpty),
- [0x3FF6ECB0] = typeof(User),
+ [0x5D99ADEE] = typeof(User),
[0x4F11BAE1] = null,//UserProfilePhotoEmpty
[0x82D1F706] = typeof(UserProfilePhoto),
[0x09D05049] = null,//UserStatusEmpty
@@ -130,8 +130,8 @@ namespace TL
[0x6592A1A7] = typeof(ChatForbidden),
[0x8261AC61] = typeof(Channel),
[0x17D493D5] = typeof(ChannelForbidden),
- [0xD18EE226] = typeof(ChatFull),
- [0xEA68A619] = typeof(ChannelFull),
+ [0xC9D31138] = typeof(ChatFull),
+ [0xF2355507] = typeof(ChannelFull),
[0xC02D4007] = typeof(ChatParticipant),
[0xE46BCEE4] = typeof(ChatParticipantCreator),
[0xA0933F5B] = typeof(ChatParticipantAdmin),
@@ -283,7 +283,7 @@ namespace TL
[0xD7CA61A2] = typeof(UpdateChatParticipantAdmin),
[0x688A30AA] = typeof(UpdateNewStickerSet),
[0x0BB2D201] = typeof(UpdateStickerSetsOrder),
- [0x43AE3DEC] = typeof(UpdateStickerSets),
+ [0x31C24808] = typeof(UpdateStickerSets),
[0x9375341E] = typeof(UpdateSavedGifs),
[0x496F379C] = typeof(UpdateBotInlineQuery),
[0x12F12A07] = typeof(UpdateBotInlineSend),
@@ -352,6 +352,10 @@ namespace TL
[0x74D8BE99] = typeof(UpdateSavedRingtones),
[0x0084CD5A] = typeof(UpdateTranscribedAudio),
[0xFB4C496C] = typeof(UpdateReadFeaturedEmojiStickers),
+ [0x28373599] = typeof(UpdateUserEmojiStatus),
+ [0x30F443DB] = typeof(UpdateRecentEmojiStatuses),
+ [0x6F7863F4] = typeof(UpdateRecentReactions),
+ [0x86FCCF85] = typeof(UpdateMoveStickerSetToTop),
[0xA56C2A3E] = typeof(Updates_State),
[0x5D75A138] = typeof(Updates_DifferenceEmpty),
[0x00F49CA0] = typeof(Updates_Difference),
@@ -370,7 +374,7 @@ namespace TL
[0x096A18D5] = typeof(Upload_File),
[0xF18CDA44] = typeof(Upload_FileCdnRedirect),
[0x18B7A10D] = typeof(DcOption),
- [0x330B4067] = typeof(Config),
+ [0x232566AC] = typeof(Config),
[0x8E1A1775] = typeof(NearestDc),
[0xCCBBCE30] = typeof(Help_AppUpdate),
[0xC45A6536] = null,//Help_NoAppUpdate
@@ -459,7 +463,7 @@ namespace TL
[0x7311CA11] = typeof(WebPageNotModified),
[0xAD01D61D] = typeof(Authorization),
[0x4BFF8EA0] = typeof(Account_Authorizations),
- [0x185B184F] = typeof(Account_Password),
+ [0x957B50FB] = typeof(Account_Password),
[0x9A5C33E5] = typeof(Account_PasswordSettings),
[0xC23727C9] = typeof(Account_PasswordInputSettings),
[0x137948A5] = typeof(Auth_PasswordRecovery),
@@ -476,6 +480,8 @@ namespace TL
[0xE67F520E] = typeof(InputStickerSetDice),
[0x0CDE3739] = typeof(InputStickerSetAnimatedEmojiAnimations),
[0xC88B3B02] = typeof(InputStickerSetPremiumGifts),
+ [0x04C4D4CE] = typeof(InputStickerSetEmojiGenericAnimations),
+ [0x29D0F5EE] = typeof(InputStickerSetEmojiDefaultStatuses),
[0x2DD14EDC] = typeof(StickerSet),
[0xB60A24A6] = typeof(Messages_StickerSet),
[0xD3F924EB] = null,//Messages_StickerSetNotModified
@@ -579,6 +585,8 @@ namespace TL
[0x5353E5A7] = typeof(Auth_SentCodeTypeCall),
[0xAB03C6D9] = typeof(Auth_SentCodeTypeFlashCall),
[0x82006484] = typeof(Auth_SentCodeTypeMissedCall),
+ [0x5A159841] = typeof(Auth_SentCodeTypeEmailCode),
+ [0xA5491DEA] = typeof(Auth_SentCodeTypeSetUpEmailRequired),
[0x36585EA4] = typeof(Messages_BotCallbackAnswer),
[0x26B5DDE6] = typeof(Messages_MessageEditData),
[0x890C3D89] = typeof(InputBotInlineMessageID),
@@ -737,7 +745,7 @@ namespace TL
[0xAFB6144A] = typeof(ChannelAdminLogEventActionParticipantJoinByRequest),
[0xCB2AC766] = typeof(ChannelAdminLogEventActionToggleNoForwards),
[0x278F2868] = typeof(ChannelAdminLogEventActionSendMessage),
- [0x9CF7F76A] = typeof(ChannelAdminLogEventActionChangeAvailableReactions),
+ [0xBE4E0EF8] = typeof(ChannelAdminLogEventActionChangeAvailableReactions),
[0x1FAD68CD] = typeof(ChannelAdminLogEvent),
[0xED8AF74D] = typeof(Channels_AdminLogResults),
[0xEA107AE4] = typeof(ChannelAdminLogEventsFilter),
@@ -946,11 +954,11 @@ namespace TL
[0x147EE23C] = typeof(Messages_SearchResultsCalendar),
[0x7F648B67] = typeof(SearchResultPosition),
[0x53B22BAF] = typeof(Messages_SearchResultsPositions),
- [0x8356CDA9] = typeof(Channels_SendAsPeers),
+ [0xF496B0C6] = typeof(Channels_SendAsPeers),
[0x3B6D152E] = typeof(Users_UserFull),
[0x6880B94D] = typeof(Messages_PeerSettings),
[0xC3A2835F] = typeof(Auth_LoggedOut),
- [0x6FB250D1] = typeof(ReactionCount),
+ [0xA3D1CB80] = typeof(ReactionCount),
[0x4F2B9479] = typeof(MessageReactions),
[0x31BD492D] = typeof(Messages_MessageReactionsList),
[0xC077EC01] = typeof(AvailableReaction),
@@ -958,7 +966,7 @@ namespace TL
[0x768E3AAD] = typeof(Messages_AvailableReactions),
[0x67CA4737] = typeof(Messages_TranslateNoResult),
[0xA214F7D0] = typeof(Messages_TranslateResultText),
- [0x51B67EFF] = typeof(MessagePeerReaction),
+ [0xB156FE9C] = typeof(MessagePeerReaction),
[0x80EB48AF] = typeof(GroupCallStreamChannel),
[0xD0E482B2] = typeof(Phone_GroupCallStreamChannels),
[0x2DBF3432] = typeof(Phone_GroupCallStreamRtmpUrl),
@@ -986,11 +994,34 @@ namespace TL
[0xC326CAEF] = typeof(InputInvoiceSlug),
[0xAED0CBD9] = typeof(Payments_ExportedInvoice),
[0x93752C52] = typeof(Messages_TranscribedAudio),
- [0x8A4F3C29] = typeof(Help_PremiumPromo),
+ [0x5334759C] = typeof(Help_PremiumPromo),
[0xA6751E66] = typeof(InputStorePaymentPremiumSubscription),
[0x616F7FE8] = typeof(InputStorePaymentGiftPremium),
[0x74C34319] = typeof(PremiumGiftOption),
[0x88F8F21B] = typeof(PaymentFormMethod),
+ [0x2DE11AAE] = null,//EmojiStatusEmpty
+ [0x929B619D] = typeof(EmojiStatus),
+ [0xFA30A8C7] = typeof(EmojiStatusUntil),
+ [0xD08CE645] = null,//Account_EmojiStatusesNotModified
+ [0x90C467D1] = typeof(Account_EmojiStatuses),
+ [0x79F5D419] = null,//ReactionEmpty
+ [0x1B2286B8] = typeof(ReactionEmoji),
+ [0x8935FC73] = typeof(ReactionCustomEmoji),
+ [0xEAFC32BC] = typeof(ChatReactionsNone),
+ [0x52928BCA] = typeof(ChatReactionsAll),
+ [0x661D4037] = typeof(ChatReactionsSome),
+ [0xB06FDBDF] = null,//Messages_ReactionsNotModified
+ [0xEAFDF716] = typeof(Messages_Reactions),
+ [0x4345BE73] = typeof(EmailVerifyPurposeLoginSetup),
+ [0x527D22EB] = typeof(EmailVerifyPurposeLoginChange),
+ [0xBBF51685] = typeof(EmailVerifyPurposePassport),
+ [0x922E55A9] = typeof(EmailVerificationCode),
+ [0xDB909EC2] = typeof(EmailVerificationGoogle),
+ [0x96D074FD] = typeof(EmailVerificationApple),
+ [0x2B96CD1B] = typeof(Account_EmailVerified),
+ [0xE1BB0D61] = typeof(Account_EmailVerifiedLogin),
+ [0xB6F11EBE] = typeof(PremiumSubscriptionOption),
+ [0xB81C7034] = typeof(SendAsPeer),
// from TL.Secret:
[0xBB718624] = typeof(Layer66.SendMessageUploadRoundAction),
[0xE50511D8] = typeof(Layer45.DecryptedMessageMediaWebPage),
@@ -1094,6 +1125,10 @@ namespace TL
[typeof(Messages_AvailableReactions)] = 0x9F071957, //messages.availableReactionsNotModified
[typeof(AttachMenuBots)] = 0xF1D88A5C, //attachMenuBotsNotModified
[typeof(Account_SavedRingtones)] = 0xFBF6E8B1, //account.savedRingtonesNotModified
+ [typeof(EmojiStatus)] = 0x2DE11AAE, //emojiStatusEmpty
+ [typeof(Account_EmojiStatuses)] = 0xD08CE645, //account.emojiStatusesNotModified
+ [typeof(Reaction)] = 0x79F5D419, //reactionEmpty
+ [typeof(Messages_Reactions)] = 0xB06FDBDF, //messages.reactionsNotModified
// from TL.Secret:
[typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty
// The End
From a071c993d58d84614f98959b040c4787cb85ab44 Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Sun, 4 Sep 2022 15:24:59 +0200
Subject: [PATCH 027/390] MessageMedia.ToInputMedia helper
---
.github/dev.yml | 2 +-
src/TL.Helpers.cs | 25 +++++++++++++++++++++++--
src/TL.Schema.cs | 24 ++++++++++++------------
3 files changed, 36 insertions(+), 15 deletions(-)
diff --git a/.github/dev.yml b/.github/dev.yml
index 052762e..ebcdc85 100644
--- a/.github/dev.yml
+++ b/.github/dev.yml
@@ -2,7 +2,7 @@ pr: none
trigger:
- master
-name: 2.6.3-dev.$(Rev:r)
+name: 2.6.4-dev.$(Rev:r)
pool:
vmImage: ubuntu-latest
diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs
index e8ad355..843b666 100644
--- a/src/TL.Helpers.cs
+++ b/src/TL.Helpers.cs
@@ -208,6 +208,21 @@ namespace TL
partial class ChatParticipantsForbidden { public override ChatParticipantBase[] Participants => Array.Empty(); }
partial class ChatParticipants { public override ChatParticipantBase[] Participants => participants; }
+ partial class MessageMedia { ///Use this helper method to send a copy of the media without downloading it
+ ///Quiz poll may need to be voted before obtaining the correct answers. Dice will not replicate same value.
May return for Invoice and other unsupported media types
+ public virtual InputMedia ToInputMedia() => null; }
+ partial class MessageMediaPhoto { public override InputMedia ToInputMedia() => new InputMediaPhoto { id = photo }; }
+ partial class MessageMediaGeo { public override InputMedia ToInputMedia() => new InputMediaGeoPoint { geo_point = geo }; }
+ partial class MessageMediaContact { public override InputMedia ToInputMedia() => new InputMediaContact { first_name = first_name, last_name = last_name, phone_number = phone_number, vcard = vcard }; }
+ partial class MessageMediaDocument { public override InputMedia ToInputMedia() => new InputMediaDocument { id = document }; }
+ partial class MessageMediaVenue { public override InputMedia ToInputMedia() => new InputMediaVenue { geo_point = geo, title = title, address = address, provider = provider, venue_id = venue_id, venue_type = venue_type }; }
+ partial class MessageMediaGame { public override InputMedia ToInputMedia() => new InputMediaGame { id = game }; }
+ partial class MessageMediaGeoLive { public override InputMedia ToInputMedia() => new InputMediaGeoLive { geo_point = geo, heading = heading, period = period, proximity_notification_radius = proximity_notification_radius,
+ flags = (period != 0 ? InputMediaGeoLive.Flags.has_period : 0) | (flags.HasFlag(Flags.has_heading) ? InputMediaGeoLive.Flags.has_heading : 0) | (flags.HasFlag(Flags.has_proximity_notification_radius) ? InputMediaGeoLive.Flags.has_proximity_notification_radius : 0) }; }
+ partial class MessageMediaPoll { public override InputMedia ToInputMedia() => new InputMediaPoll { poll = poll, correct_answers = results.results?.Where(pav => pav.flags.HasFlag(PollAnswerVoters.Flags.correct)).Select(pav => pav.option).ToArray(), solution = results.solution, solution_entities = results.solution_entities,
+ flags = (results.results != null ? InputMediaPoll.Flags.has_correct_answers : 0) | (results.solution != null ? InputMediaPoll.Flags.has_solution : 0) }; }
+ partial class MessageMediaDice { public override InputMedia ToInputMedia() => new InputMediaDice { emoticon = emoticon }; }
+
partial class PhotoBase
{
public abstract long ID { get; }
@@ -287,7 +302,12 @@ namespace TL
}
}
- public partial class InputMediaUploadedDocument
+ partial class GeoPoint
+ {
+ public static implicit operator InputGeoPoint(GeoPoint geo) => new() { lat = geo.lat, lon = geo.lon, accuracy_radius = geo.accuracy_radius, flags = (InputGeoPoint.Flags)geo.flags };
+ }
+
+ partial class InputMediaUploadedDocument
{
public InputMediaUploadedDocument() { }
public InputMediaUploadedDocument(InputFileBase inputFile, string mimeType)
@@ -495,7 +515,8 @@ namespace TL
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 }; }
+ partial class Game { public static implicit operator InputGameID(Game game) => new() { id = game.id, access_hash = game.access_hash }; }
+ partial class WebDocument { public static implicit operator InputWebFileLocation(WebDocument doc) => new() { url = doc.url, access_hash = doc.access_hash }; }
partial class InputMessage
{
diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs
index a6e8f7b..8b1d2a6 100644
--- a/src/TL.Schema.cs
+++ b/src/TL.Schema.cs
@@ -1673,10 +1673,10 @@ namespace TL
/// Media Derived classes: , , , , , , , , , , , See
/// a null value means messageMediaEmpty
- public abstract class MessageMedia : IObject { }
+ public abstract partial class MessageMedia : IObject { }
/// Attached photo. See
[TLDef(0x695150D7)]
- public class MessageMediaPhoto : MessageMedia
+ public partial class MessageMediaPhoto : MessageMedia
{
/// Flags, see TL conditional fields
public Flags flags;
@@ -1695,14 +1695,14 @@ namespace TL
}
/// Attached map. See
[TLDef(0x56E0D474)]
- public class MessageMediaGeo : MessageMedia
+ public partial class MessageMediaGeo : MessageMedia
{
/// GeoPoint
public GeoPoint geo;
}
/// Attached contact. See
[TLDef(0x70322949)]
- public class MessageMediaContact : MessageMedia
+ public partial class MessageMediaContact : MessageMedia
{
/// Phone number
public string phone_number;
@@ -1720,7 +1720,7 @@ namespace TL
public class MessageMediaUnsupported : MessageMedia { }
/// Document (video, audio, voice, sticker, any media type except photo) See
[TLDef(0x9CB070D7)]
- public class MessageMediaDocument : MessageMedia
+ public partial class MessageMediaDocument : MessageMedia
{
/// Flags, see TL conditional fields
public Flags flags;
@@ -1748,7 +1748,7 @@ namespace TL
}
/// Venue See
[TLDef(0x2EC0533F)]
- public class MessageMediaVenue : MessageMedia
+ public partial class MessageMediaVenue : MessageMedia
{
/// Geolocation of venue
public GeoPoint geo;
@@ -1765,7 +1765,7 @@ namespace TL
}
/// Telegram game See
[TLDef(0xFDB19008)]
- public class MessageMediaGame : MessageMedia
+ public partial class MessageMediaGame : MessageMedia
{
/// Game
public Game game;
@@ -1805,7 +1805,7 @@ namespace TL
}
/// Indicates a live geolocation See
[TLDef(0xB940C666)]
- public class MessageMediaGeoLive : MessageMedia
+ public partial class MessageMediaGeoLive : MessageMedia
{
/// Flags, see TL conditional fields
public Flags flags;
@@ -1828,7 +1828,7 @@ namespace TL
}
/// Poll See
[TLDef(0x4BD6E798)]
- public class MessageMediaPoll : MessageMedia
+ public partial class MessageMediaPoll : MessageMedia
{
/// The poll
public Poll poll;
@@ -1837,7 +1837,7 @@ namespace TL
}
/// Dice-based animated sticker See
[TLDef(0x3F7EE58B)]
- public class MessageMediaDice : MessageMedia
+ public partial class MessageMediaDice : MessageMedia
{
/// Dice value
public int value;
@@ -2355,7 +2355,7 @@ namespace TL
/// GeoPoint. See
/// a null value means geoPointEmpty
[TLDef(0xB2A2F663)]
- public class GeoPoint : IObject
+ public partial class GeoPoint : IObject
{
/// Flags, see TL conditional fields
public Flags flags;
@@ -8029,7 +8029,7 @@ namespace TL
/// Indicates an already sent game See
[TLDef(0xBDF9653B)]
- public class Game : IObject
+ public partial class Game : IObject
{
/// Flags, see TL conditional fields
public Flags flags;
From 26942d33f2c977f8bfc0ae879756ab1ae8c757ce Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Sat, 10 Sep 2022 18:23:01 +0200
Subject: [PATCH 028/390] No changes, documentation
---
FAQ.md | 2 +-
src/TL.Extensions.cs | 4 ++--
src/TL.Helpers.cs | 7 ++++---
src/TL.Schema.cs | 22 +++++++++++-----------
src/TL.SchemaFuncs.cs | 32 ++++++++++++++++----------------
5 files changed, 34 insertions(+), 33 deletions(-)
diff --git a/FAQ.md b/FAQ.md
index a0af502..e50e022 100644
--- a/FAQ.md
+++ b/FAQ.md
@@ -47,7 +47,7 @@ You can download such full example apps [for WinForms](https://github.com/wiz0u/
#### 4. Where to get the access_hash? Why the error `CHANNEL_INVALID` or `USER_ID_INVALID`?
-An `access_hash` is required by Telegram when dealing with a channel, user, photo, document, etc...
+Having only the ID is **not enough**: An `access_hash` is required by Telegram when dealing with a channel, user, photo, document, etc...
This serves as a proof that the logged-in user is entitled to access it (otherwise, anybody with the ID could access it)
> A small private `Chat` don't need an access_hash and can be queried using their `chat_id` only.
diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs
index 05731d5..1ceae5b 100644
--- a/src/TL.Extensions.cs
+++ b/src/TL.Extensions.cs
@@ -363,8 +363,8 @@ namespace TL
switch (sb[i])
{
case '&': sb.Insert(i + 1, "amp;"); i += 4; break;
- case '<': sb.Remove(i, 1).Insert(i, "<"); i += 3; break;
- case '>': sb.Remove(i, 1).Insert(i, ">"); i += 3; break;
+ case '<': sb.Insert(i, "<"); sb[i += 3] = ';'; break;
+ case '>': sb.Insert(i, ">"); sb[i += 3] = ';'; break;
}
}
return sb.ToString();
diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs
index 843b666..507a5fa 100644
--- a/src/TL.Helpers.cs
+++ b/src/TL.Helpers.cs
@@ -209,17 +209,18 @@ namespace TL
partial class ChatParticipants { public override ChatParticipantBase[] Participants => participants; }
partial class MessageMedia { ///Use this helper method to send a copy of the media without downloading it
- ///Quiz poll may need to be voted before obtaining the correct answers. Dice will not replicate same value.
May return for Invoice and other unsupported media types
+ ///Quiz poll may need to be voted before obtaining the correct answers. Dice will not replicate same value. TTL ignored
May return for Invoice and other unsupported media types
public virtual InputMedia ToInputMedia() => null; }
partial class MessageMediaPhoto { public override InputMedia ToInputMedia() => new InputMediaPhoto { id = photo }; }
partial class MessageMediaGeo { public override InputMedia ToInputMedia() => new InputMediaGeoPoint { geo_point = geo }; }
- partial class MessageMediaContact { public override InputMedia ToInputMedia() => new InputMediaContact { first_name = first_name, last_name = last_name, phone_number = phone_number, vcard = vcard }; }
+ partial class MessageMediaContact { public override InputMedia ToInputMedia() => new InputMediaContact { phone_number = phone_number, first_name = first_name, last_name = last_name, vcard = vcard }; }
partial class MessageMediaDocument { public override InputMedia ToInputMedia() => new InputMediaDocument { id = document }; }
partial class MessageMediaVenue { public override InputMedia ToInputMedia() => new InputMediaVenue { geo_point = geo, title = title, address = address, provider = provider, venue_id = venue_id, venue_type = venue_type }; }
partial class MessageMediaGame { public override InputMedia ToInputMedia() => new InputMediaGame { id = game }; }
partial class MessageMediaGeoLive { public override InputMedia ToInputMedia() => new InputMediaGeoLive { geo_point = geo, heading = heading, period = period, proximity_notification_radius = proximity_notification_radius,
flags = (period != 0 ? InputMediaGeoLive.Flags.has_period : 0) | (flags.HasFlag(Flags.has_heading) ? InputMediaGeoLive.Flags.has_heading : 0) | (flags.HasFlag(Flags.has_proximity_notification_radius) ? InputMediaGeoLive.Flags.has_proximity_notification_radius : 0) }; }
- partial class MessageMediaPoll { public override InputMedia ToInputMedia() => new InputMediaPoll { poll = poll, correct_answers = results.results?.Where(pav => pav.flags.HasFlag(PollAnswerVoters.Flags.correct)).Select(pav => pav.option).ToArray(), solution = results.solution, solution_entities = results.solution_entities,
+ partial class MessageMediaPoll { public override InputMedia ToInputMedia() => new InputMediaPoll { poll = poll, solution = results.solution, solution_entities = results.solution_entities,
+ correct_answers = results.results?.Where(pav => pav.flags.HasFlag(PollAnswerVoters.Flags.correct)).Select(pav => pav.option).ToArray(),
flags = (results.results != null ? InputMediaPoll.Flags.has_correct_answers : 0) | (results.solution != null ? InputMediaPoll.Flags.has_solution : 0) }; }
partial class MessageMediaDice { public override InputMedia ToInputMedia() => new InputMediaDice { emoticon = emoticon }; }
diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs
index 8b1d2a6..e8697b4 100644
--- a/src/TL.Schema.cs
+++ b/src/TL.Schema.cs
@@ -1974,7 +1974,7 @@ namespace TL
public string currency;
/// Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
public long total_amount;
- /// An invoice slug taken from an invoice deep link or from the premium_invoice_slug app config parameter »
+ /// An invoice slug taken from an invoice deep link or from the premium_invoice_slug app config parameter »
[IfFlag(0)] public string invoice_slug;
[Flags] public enum Flags : uint
@@ -2501,9 +2501,9 @@ namespace TL
{
/// Flags, see TL conditional fields
public Flags flags;
- /// Display text in notifications
+ /// (Ternary value) If set, indicates whether or not to display previews of messages in notifications; otherwise the default behavior should be used.
[IfFlag(0)] public bool show_previews;
- /// Mute peer?
+ /// (Ternary value) If set, indicates whether to mute or unmute the peer; otherwise the default behavior should be used.
[IfFlag(1)] public bool silent;
/// Mute all notifications until this date
[IfFlag(2)] public int mute_until;
@@ -4243,7 +4243,7 @@ namespace TL
pending = 0x1,
}
}
- /// Some featured emoji stickers were marked as read See
+ /// Some featured custom emoji stickers were marked as read See
[TLDef(0xFB4C496C)]
public class UpdateReadFeaturedEmojiStickers : Update { }
/// See
@@ -5581,7 +5581,7 @@ namespace TL
[IfFlag(0)] public string title;
/// Performer
[IfFlag(1)] public string performer;
- /// Waveform
+ /// Waveform: consists in a series of bitpacked 5-bit values.
Example implementation: android.
[IfFlag(2)] public byte[] waveform;
[Flags] public enum Flags : uint
@@ -6554,7 +6554,7 @@ namespace TL
[TLDef(0xC8CF05F8, inheritBefore = true)]
public class MessageEntityCustomEmoji : MessageEntity
{
- /// Document ID of the custom emoji, use messages.getCustomEmojiDocuments to fetch the emoji animation and the actual emoji it represents.
+ /// Document ID of the custom emoji, use messages.getCustomEmojiDocuments to fetch the emoji animation and the actual emoji it represents.
public long document_id;
}
@@ -7981,7 +7981,7 @@ namespace TL
/// Stickerset
public override StickerSet Set => set;
}
- /// Stickerset preview with all stickers of the stickerset included.
Currently used only for custom emoji stickersets, to avoid a further call to messages.getStickerSet. See
+ /// Stickerset preview with all stickers of the stickerset included.
Currently used only for custom emoji stickersets, to avoid a further call to messages.getStickerSet. See
[TLDef(0x1AED5EE5)]
public class StickerSetFullCovered : StickerSetCoveredBase
{
@@ -7996,7 +7996,7 @@ namespace TL
public override StickerSet Set => set;
}
- /// Position on a photo where a mask should be placed See
+ /// Position on a photo where a mask should be placed when attaching stickers to media » See
[TLDef(0xAED6DBB2)]
public class MaskCoords : IObject
{
@@ -8004,7 +8004,7 @@ namespace TL
public int n;
/// Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. (For example, -1.0 will place the mask just to the left of the default mask position)
public double x;
- /// Shift by Y-axis measured in widths of the mask scaled to the face size, from left to right. (For example, -1.0 will place the mask just to the left of the default mask position)
+ /// Shift by Y-axis measured in widths of the mask scaled to the face size, from left to right. (For example, -1.0 will place the mask just below the default mask position)
public double y;
/// Mask scaling coefficient. (For example, 2.0 means a doubled size)
public double zoom;
@@ -10965,7 +10965,7 @@ namespace TL
[Flags] public enum Flags : uint
{
- /// Similar to min objects, used for poll constructors that are the same for all users so they don't have option chosen by the current user (you can use messages.getPollResults to get the full poll results).
+ /// Similar to min objects, used for poll constructors that are the same for all users so they don't have the option chosen by the current user (you can use messages.getPollResults to get the full poll results).
min = 0x1,
/// Field has a value
has_results = 0x2,
@@ -13305,7 +13305,7 @@ namespace TL
/// Message ID
public int msg_id;
}
- /// An invoice slug taken from an invoice deep link or from the premium_invoice_slug app config parameter » See
+ /// An invoice slug taken from an invoice deep link or from the premium_invoice_slug app config parameter » See
[TLDef(0xC326CAEF)]
public class InputInvoiceSlug : InputInvoice
{
diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs
index 3a9a410..04f33ae 100644
--- a/src/TL.SchemaFuncs.cs
+++ b/src/TL.SchemaFuncs.cs
@@ -808,7 +808,7 @@ namespace TL
/// Unique theme ID used to generate theme deep links, can be empty to autogenerate a random ID.
/// Theme name
/// Theme file
- /// Theme settings
+ /// Theme settings, multiple values can be provided for the different base themes (day/night mode, etc).
public static Task Account_CreateTheme(this Client client, string slug, string title, InputDocument document = null, InputThemeSettings[] settings = null)
=> client.Invoke(new Account_CreateTheme
{
@@ -1882,7 +1882,7 @@ namespace TL
/// Reorder installed stickersets See
/// Reorder mask stickersets
- /// Reorder custom emoji stickersets
+ /// Reorder custom emoji stickersets
/// New stickerset order by stickerset IDs
public static Task Messages_ReorderStickerSets(this Client client, long[] order, bool masks = false, bool emojis = false)
=> client.Invoke(new Messages_ReorderStickerSets
@@ -2143,8 +2143,8 @@ namespace TL
});
/// Get all archived stickers See
- /// Get mask stickers
- /// Get custom emoji stickers
+ /// Get mask stickers
+ /// Get custom emoji stickers
/// Offsets for pagination, for more info click here
/// Maximum number of results to return, see pagination
public static Task Messages_GetArchivedStickers(this Client client, long offset_id = default, int limit = int.MaxValue, bool masks = false, bool emojis = false)
@@ -2312,7 +2312,7 @@ namespace TL
});
/// Upload a file and associate it to a chat (without actually sending it to the chat) See [bots: ✓] Possible codes: 400,403 (details)
- /// The chat, can be an for bots
+ /// The chat, can be for bots and for users.
/// File uploaded in chunks as described in files »
/// a null value means messageMediaEmpty
public static Task Messages_UploadMedia(this Client client, InputPeer peer, InputMedia media)
@@ -2962,7 +2962,7 @@ namespace TL
emoticon = emoticon,
});
- /// Get which users read a specific message: only available for groups and supergroups with less than chat_read_mark_size_threshold members, read receipts will be stored for chat_read_mark_expire_period seconds after the message was sent, see client configuration for more info ». See Possible codes: 400 (details)
+ /// Get which users read a specific message: only available for groups and supergroups with less than chat_read_mark_size_threshold members, read receipts will be stored for chat_read_mark_expire_period seconds after the message was sent, see client configuration for more info ». See Possible codes: 400 (details)
/// Dialog
/// Message ID
public static Task Messages_GetMessageReadParticipants(this Client client, InputPeer peer, int msg_id)
@@ -3104,7 +3104,7 @@ namespace TL
hash = hash,
});
- /// Change default emoji reaction to use in the quick reaction menu: the value is synced across devices and can be fetched using help.getAppConfig, reactions_default field. See
+ /// Change default emoji reaction to use in the quick reaction menu: the value is synced across devices and can be fetched using help.getAppConfig, reactions_default field. See
/// New emoji reaction
public static Task Messages_SetDefaultReaction(this Client client, Reaction reaction)
=> client.Invoke(new Messages_SetDefaultReaction
@@ -3298,15 +3298,15 @@ namespace TL
good = good,
});
- /// Fetch info about custom emojis. See [bots: ✓]
- /// Custom emoji IDs from a .
+ /// Fetch custom emoji stickers ». See [bots: ✓]
+ /// Custom emoji IDs from a .
public static Task Messages_GetCustomEmojiDocuments(this Client client, long[] document_id)
=> client.Invoke(new Messages_GetCustomEmojiDocuments
{
document_id = document_id,
});
- /// Gets the list of currently installed custom emoji stickersets. See
+ /// Gets the list of currently installed custom emoji stickersets. See
/// Hash for pagination, for more info click here
/// a null value means messages.allStickersNotModified
public static Task Messages_GetEmojiStickers(this Client client, long hash = default)
@@ -3362,7 +3362,7 @@ namespace TL
{
});
- /// Get new updates. See [bots: ✓] Possible codes: 400,403 (details)
+ /// Get new updates. See [bots: ✓] Possible codes: 400,403,500 (details)
/// PTS, see updates.
/// For fast updating: if provided and pts + pts_total_limit < remote pts, will be returned.
Simply tells the server to not return the difference if it is bigger than pts_total_limit
If the remote pts is too big (> ~4000000), this field will default to 1000000
/// date, see updates.
@@ -3588,8 +3588,8 @@ namespace TL
{
});
- /// Get recently used t.me links See
- /// Referer
+ /// Get recently used t.me links. See
+ /// Referrer
public static Task Help_GetRecentMeUrls(this Client client, string referer)
=> client.Invoke(new Help_GetRecentMeUrls
{
@@ -4326,7 +4326,7 @@ namespace TL
purpose = purpose,
});
- /// Checks whether Telegram Premium purchase is possible. Must be called before in-store Premium purchase. See
+ /// Checks whether Telegram Premium purchase is possible. Must be called before in-store Premium purchase, official apps only. See
/// Payment purpose
public static Task Payments_CanPurchasePremium(this Client client, InputStorePaymentPurpose purpose)
=> client.Invoke(new Payments_CanPurchasePremium
@@ -4340,7 +4340,7 @@ namespace TL
/// Whether this is a video stickerset
/// Stickerset owner
/// Stickerset name, 1-64 chars
- /// Short name of sticker set, to be used in sticker deep links ». Can contain only english letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in "_by_<bot_username>". <bot_username> is case insensitive. 1-64 characters.
+ /// Short name of sticker set, to be used in sticker deep links ». Can contain only english letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and, if called by a bot, must end in "_by_<bot_username>". <bot_username> is case insensitive. 1-64 characters.
/// Thumbnail
/// Stickers
/// Used when importing stickers using the sticker import SDKs, specifies the name of the software that created the stickers
@@ -4686,7 +4686,7 @@ namespace TL
peer = peer,
});
- /// Get an invite link for a group call or livestream See
+ /// Get an invite link for a group call or livestream See Possible codes: 403 (details)
/// For livestreams or muted group chats, if set, users that join using this link will be able to speak without explicitly requesting permission by (for example by raising their hand).
/// The group call
public static Task Phone_ExportGroupCallInvite(this Client client, InputGroupCall call, bool can_self_unmute = false)
From b1649839d9d9d076f3078cc1706f6bd3624fcb16 Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Sun, 11 Sep 2022 15:34:38 +0200
Subject: [PATCH 029/390] Support multiple Test DC connections
---
src/Client.cs | 2 ++
src/Encryption.cs | 1 +
2 files changed, 3 insertions(+)
diff --git a/src/Client.cs b/src/Client.cs
index d4f78c5..4179ae7 100644
--- a/src/Client.cs
+++ b/src/Client.cs
@@ -100,6 +100,7 @@ namespace WTelegram
TcpHandler = cloneOf.TcpHandler;
MTProxyUrl = cloneOf.MTProxyUrl;
PingInterval = cloneOf.PingInterval;
+ TLConfig = cloneOf.TLConfig;
_dcSession = dcSession;
}
@@ -706,6 +707,7 @@ namespace WTelegram
if (MTProxyUrl != null)
{
#if OBFUSCATION
+ if (TLConfig?.test_mode == true) dcId += 10000;
if (_dcSession.DataCenter?.flags.HasFlag(DcOption.Flags.media_only) == true) dcId = -dcId;
var parms = HttpUtility.ParseQueryString(MTProxyUrl[MTProxyUrl.IndexOf('?')..]);
var server = parms["server"];
diff --git a/src/Encryption.cs b/src/Encryption.cs
index dd340f7..e17c702 100644
--- a/src/Encryption.cs
+++ b/src/Encryption.cs
@@ -56,6 +56,7 @@ namespace WTelegram
new_nonce = new Int256(RNG),
dc = session.DataCenter?.id ?? 0
};
+ if (client.TLConfig?.test_mode == true) pqInnerData.dc += 10000;
if (session.DataCenter?.flags.HasFlag(DcOption.Flags.media_only) == true) pqInnerData.dc = -pqInnerData.dc;
byte[] encrypted_data = null;
{
From 11a9ca86318d90d0ff75b2d6aaabd3ef554e6b3b Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Wed, 14 Sep 2022 18:22:52 +0200
Subject: [PATCH 030/390] more 'params' arguments
---
README.md | 42 ++++++++++++++++++++++++------------
src/Client.cs | 4 ++--
src/TL.Schema.cs | 20 ++++++++---------
src/TL.SchemaFuncs.cs | 50 +++++++++++++++++++++----------------------
src/TL.Secret.cs | 20 ++++++++---------
5 files changed, 75 insertions(+), 61 deletions(-)
diff --git a/README.md b/README.md
index 8f056d5..2114c15 100644
--- a/README.md
+++ b/README.md
@@ -26,10 +26,12 @@ static async Task Main(string[] _)
Console.WriteLine($"We are logged-in as {my.username ?? my.first_name + " " + my.last_name} (id {my.id})");
}
```
-When run, this will prompt you interactively for your App **api_hash** and **api_id** (that you obtain through Telegram's [API development tools](https://my.telegram.org/apps) page) and try to connect to Telegram servers.
+When run, this will prompt you interactively for your App **api_hash** and **api_id** (that you obtain through Telegram's
+[API development tools](https://my.telegram.org/apps) page) and try to connect to Telegram servers.
Those api hash/id represent your application and one can be used for handling many user accounts.
-Then it will attempt to sign-in *(login)* as a user for which you must enter the **phone_number** and the **verification_code** that will be sent to this user (for example through SMS or another Telegram client app the user is connected to).
+Then it will attempt to sign-in *(login)* as a user for which you must enter the **phone_number** and the **verification_code**
+that will be sent to this user (for example through SMS, Email, or another Telegram client app the user is connected to).
If the verification succeeds but the phone number is unknown to Telegram, the user might be prompted to sign-up
*(register their account by accepting the Terms of Service)* and provide their **first_name** and **last_name**.
@@ -42,9 +44,11 @@ All those API methods require `using TL;` namespace and are called with an under
# Saved session
If you run this program again, you will notice that only **api_hash** is requested, the other prompts are gone and you are automatically logged-on and ready to go.
-This is because WTelegramClient saves (typically in the encrypted file **bin\WTelegram.session**) its state and the authentication keys that were negotiated with Telegram so that you needn't sign-in again every time.
+This is because WTelegramClient saves (typically in the encrypted file **bin\WTelegram.session**) its state
+and the authentication keys that were negotiated with Telegram so that you needn't sign-in again every time.
-That file path is configurable (session_pathname), and under various circumstances (changing user or server address) you may want to change it or simply delete the existing session file in order to restart the authentification process.
+That file path is configurable (session_pathname), and under various circumstances (changing user or server address)
+you may want to change it or simply delete the existing session file in order to restart the authentification process.
# Non-interactive configuration
Your next step will probably be to provide a configuration to the client so that the required elements are not prompted through the Console but answered by your program.
@@ -83,13 +87,17 @@ Its `int` argument is the log severity, compatible with the [LogLevel enum](http
# Example of API call
->ℹ️ The Telegram API makes extensive usage of base and derived classes, so be ready to use the various syntaxes C# offer to check/cast base classes into the more useful derived classes (`is`, `as`, `case DerivedType` )
+>ℹ️ The Telegram API makes extensive usage of base and derived classes, so be ready to use the various C# syntaxes
+to check/cast base classes into the more useful derived classes (`is`, `as`, `case DerivedType` )
-All the Telegram API classes/methods are fully documented through Intellisense: Place your mouse over a class/method name, or start typing the call arguments to see a tooltip displaying their description, the list of derived classes and a web link to the official API page.
+All the Telegram API classes/methods are fully documented through Intellisense: Place your mouse over a class/method name,
+or start typing the call arguments to see a tooltip displaying their description, the list of derived classes and a web link to the official API page.
-The Telegram [API object classes](https://corefork.telegram.org/schema) are defined in the `TL` namespace, and the [API functions](https://corefork.telegram.org/methods) are available as async methods of `Client`.
+The Telegram [API object classes](https://corefork.telegram.org/schema) are defined in the `TL` namespace,
+and the [API functions](https://corefork.telegram.org/methods) are available as async methods of `Client`.
-Below is an example of calling the [messages.getAllChats](https://corefork.telegram.org/method/messages.getAllChats) API function, enumerating the various groups/channels the user is in, and then using `client.SendMessageAsync` helper function to easily send a message:
+Below is an example of calling the [messages.getAllChats](https://corefork.telegram.org/method/messages.getAllChats) API function,
+enumerating the various groups/channels the user is in, and then using `client.SendMessageAsync` helper function to easily send a message:
```csharp
using TL;
...
@@ -115,14 +123,17 @@ Console.WriteLine($"Sending a message in chat {chatId}: {target.Title}");
await client.SendMessageAsync(target, "Hello, World");
```
-➡️ You can find lots of useful code snippets in [EXAMPLES.md](https://github.com/wiz0u/WTelegramClient/blob/master/EXAMPLES.md) and in the [Examples subdirectory](https://github.com/wiz0u/WTelegramClient/tree/master/Examples).
+➡️ You can find lots of useful code snippets in [EXAMPLES.md](https://github.com/wiz0u/WTelegramClient/blob/master/EXAMPLES.md)
+and in the [Examples subdirectory](https://github.com/wiz0u/WTelegramClient/tree/master/Examples).
# Terminology in Telegram Client API
In the API, Telegram uses some terms/classnames that can be confusing as they differ from the terms shown to end-users:
-- `Channel` : A (large or public) chat group *(sometimes called [supergroup](https://corefork.telegram.org/api/channel#supergroups))* or a [broadcast channel](https://corefork.telegram.org/api/channel#channels) (the `broadcast` flag differentiate those)
-- `Chat` : A private [basic chat group](https://corefork.telegram.org/api/channel#basic-groups) with less than 200 members (it may be migrated to a supergroup `Channel` with a new ID when it gets bigger or public, in which case the old `Chat` will still exist but be `deactivated`)
+- `Channel` : A (large or public) chat group *(sometimes called [supergroup](https://corefork.telegram.org/api/channel#supergroups))*
+or a [broadcast channel](https://corefork.telegram.org/api/channel#channels) (the `broadcast` flag differentiate those)
+- `Chat` : A private [basic chat group](https://corefork.telegram.org/api/channel#basic-groups) with less than 200 members
+(it may be migrated to a supergroup `Channel` with a new ID when it gets bigger or public, in which case the old `Chat` will still exist but be `deactivated`)
**⚠️ Most chat groups you see are really of type `Channel`, not `Chat`!**
- chats : In plural or general meaning, it means either `Chat` or `Channel`
- `Peer` : Either a `Chat`, a `Channel` or a `User`
@@ -133,13 +144,15 @@ See [FAQ #4](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#access-
# Other things to know
-The Client class also offers an `OnUpdate` event that is triggered when Telegram servers sends Updates (like new messages or status), independently of your API requests. See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs)
+The Client class also offers an `OnUpdate` event that is triggered when Telegram servers sends Updates (like new messages or status), independently of your API requests.
+See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs)
An invalid API request can result in a `RpcException` being raised, reflecting the [error code and status text](https://revgram.github.io/errors.html) of the problem.
The other configuration items that you can override include: **session_pathname, session_key, server_address, device_model, system_version, app_version, system_lang_code, lang_pack, lang_code, user_id**
-Optional API parameters have a default value of `null` when unset. Passing `null` for a required string/array is the same as *empty* (0-length). Required API parameters/fields can sometimes be set to 0 or `null` when unused (check API documentation or experiment).
+Optional API parameters have a default value of `null` when unset. Passing `null` for a required string/array is the same as *empty* (0-length).
+Required API parameters/fields can sometimes be set to 0 or `null` when unused (check API documentation or experiment).
I've added several useful converters, implicit cast or helper properties to various API objects so that they are more easy to manipulate.
@@ -157,7 +170,8 @@ This library can be used for any Telegram scenarios including:
It has been tested in a Console app, [in a WinForms app](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#gui),
[in ASP.NET webservice](https://github.com/wiz0u/WTelegramClient/blob/master/EXAMPLES.md#logging), and in Xamarin/Android.
-Please don't use this library for Spam or Scam. Respect Telegram [Terms of Service](https://telegram.org/tos) as well as the [API Terms of Service](https://core.telegram.org/api/terms) or you might get banned from Telegram servers.
+Please don't use this library for Spam or Scam. Respect Telegram [Terms of Service](https://telegram.org/tos)
+as well as the [API Terms of Service](https://core.telegram.org/api/terms) or you might get banned from Telegram servers.
Developers feedback is welcome in the Telegram support group [@WTelegramClient](https://t.me/WTelegramClient)
You can also check our [📖 Frequently Asked Questions](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md) for more help and troubleshooting guide.
diff --git a/src/Client.cs b/src/Client.cs
index 4179ae7..c7691eb 100644
--- a/src/Client.cs
+++ b/src/Client.cs
@@ -870,7 +870,7 @@ namespace WTelegram
{
try
{
- var users = await this.Users_GetUsers(new[] { InputUser.Self }); // this calls also reenable incoming Updates
+ var users = await this.Users_GetUsers(InputUser.Self); // this calls also reenable incoming Updates
var self = users[0] as User;
if (self.id == long.Parse(botToken.Split(':')[0]))
{
@@ -905,7 +905,7 @@ namespace WTelegram
{
try
{
- var users = await this.Users_GetUsers(new[] { InputUser.Self }); // this call also reenable incoming Updates
+ var users = await this.Users_GetUsers(InputUser.Self); // this call also reenable incoming Updates
var self = users[0] as User;
// check user_id or phone_number match currently logged-in user
if ((long.TryParse(_config("user_id"), out long id) && (id == -1 || self.id == id)) ||
diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs
index e8697b4..4b46231 100644
--- a/src/TL.Schema.cs
+++ b/src/TL.Schema.cs
@@ -370,7 +370,7 @@ namespace TL
public string provider;
/// JSON-encoded data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.
public DataJSON provider_data;
- /// Unique bot deep links start parameter. If present, forwarded copies of the sent message will have a URL button with a deep link to the bot (instead of a Pay button), with the value used as the start parameter. If absent, forwarded copies of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice.
+ /// Unique bot deep links start parameter. If present, forwarded copies of the sent message will have a URL button with a deep link to the bot (instead of a Pay button), with the value used as the start parameter. If absent, forwarded copies of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice.
[IfFlag(1)] public string start_param;
[Flags] public enum Flags : uint
@@ -794,7 +794,7 @@ namespace TL
{
/// Flags, see TL conditional fields
public Flags flags;
- /// Identifier of the respective photo
Parameter added in Layer 2
+ /// Identifier of the respective photo
public long photo_id;
/// Stripped thumbnail
[IfFlag(1)] public byte[] stripped_thumb;
@@ -2604,7 +2604,7 @@ namespace TL
default_ = 0x2,
/// Field has a value
has_settings = 0x4,
- /// Whether this is a pattern wallpaper »
+ /// Whether this is a pattern wallpaper »
pattern = 0x8,
/// Whether this wallpaper should be used in dark mode.
dark = 0x10,
@@ -2796,7 +2796,7 @@ namespace TL
public ImportedContact[] imported;
/// Popular contacts
public PopularContact[] popular_invites;
- /// List of contact ids that could not be imported due to system limitation and will need to be imported at a later date.
Parameter added in Layer 13
+ /// List of contact ids that could not be imported due to system limitation and will need to be imported at a later date.
public long[] retry_contacts;
/// List of users
public Dictionary users;
@@ -3106,7 +3106,7 @@ namespace TL
{
/// User id
public long user_id;
- /// Action type
Param added in Layer 17.
+ /// Action type
public SendMessageAction action;
}
/// The user is preparing a message in a group; typing, recording, uploading, etc. This update is valid for 6 seconds. If no further updates of this kind are received after 6 seconds, it should be considered that the user stopped doing whatever they were doing See
@@ -3115,7 +3115,7 @@ namespace TL
{
/// Peer that started typing (can be the chat itself, in case of anonymous admins).
public Peer from_id;
- /// Type of action
Parameter added in Layer 17.
+ /// Type of action
public SendMessageAction action;
}
/// Composition of chat participants changed. See
@@ -3144,7 +3144,7 @@ namespace TL
public string first_name;
/// New last name. Corresponds to the new value of real_last_name field of the .
public string last_name;
- /// New username.
Parameter added in Layer 18.
+ /// New username.
public string username;
}
/// Change of contact's profile photo. See
@@ -4150,7 +4150,7 @@ namespace TL
presentation = 0x1,
}
}
- /// The command set of a certain bot in a certain chat has changed. See
+ /// The command set of a certain bot in a certain chat has changed. See
[TLDef(0x4D712F2E)]
public class UpdateBotCommands : Update
{
@@ -13148,7 +13148,7 @@ namespace TL
{
/// Whether this bot attachment menu entry should be shown in the attachment menu (toggle using messages.toggleBotInAttachMenu)
inactive = 0x1,
- /// True, if the bot supports the "settings_button_pressed" event »
+ /// True, if the bot supports the "settings_button_pressed" event »
has_settings = 0x2,
}
}
@@ -13317,7 +13317,7 @@ namespace TL
[TLDef(0xAED0CBD9)]
public class Payments_ExportedInvoice : IObject
{
- /// Exported invoice deep link
+ /// Exported invoice deep link
public string url;
}
diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs
index 04f33ae..86fded4 100644
--- a/src/TL.SchemaFuncs.cs
+++ b/src/TL.SchemaFuncs.cs
@@ -307,7 +307,7 @@ namespace TL
/// Device token type.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)
For 10 web push, the token must be a JSON-encoded object containing the keys described in PUSH updates
/// Device token
/// List of user identifiers of other users currently using the client
- public static Task Account_UnregisterDevice(this Client client, int token_type, string token, long[] other_uids)
+ public static Task Account_UnregisterDevice(this Client client, int token_type, string token, params long[] other_uids)
=> client.Invoke(new Account_UnregisterDevice
{
token_type = token_type,
@@ -935,7 +935,7 @@ namespace TL
message = message,
});
- /// Initiate a 2FA password reset: can only be used if the user is already logged-in, see here for more info » See
+ /// Initiate a 2FA password reset: can only be used if the user is already logged-in, see here for more info » See Possible codes: 400 (details)
public static Task Account_ResetPassword(this Client client)
=> client.Invoke(new Account_ResetPassword
{
@@ -1104,7 +1104,7 @@ namespace TL
/// Delete contacts by phone number See
/// Phone numbers
- public static Task Contacts_DeleteByPhones(this Client client, string[] phones)
+ public static Task Contacts_DeleteByPhones(this Client client, params string[] phones)
=> client.Invoke(new Contacts_DeleteByPhones
{
phones = phones,
@@ -1393,7 +1393,7 @@ namespace TL
/// Sends a current user typing event (see for all event types) to a conversation partner or group. See