From d18b3853e19d2c505f5a7f1d3c9abc101c3ca13e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 14 Oct 2022 11:20:21 +0200 Subject: [PATCH] Various minor improvements --- EXAMPLES.md | 39 +++++++++++++++++++------------------ Examples/ASPnet_webapp.zip | Bin 4820 -> 4867 bytes src/Session.cs | 2 +- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 6c3d1a3..b9c70a4 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -287,6 +287,24 @@ for (int offset_id = 0; ;) } ``` + + +### Monitor all Telegram events happening for the user + +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 in real-time + +You have to handle `client.OnUpdate` events containing an `UpdateNewMessage`. + +See the `DisplayMessage` method in [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs). + +You can filter specific chats the message are posted in, by looking at the `Message.peer_id` field. + ### Retrieve the current user's contacts list There are two different methods. Here is the simpler one: @@ -316,23 +334,6 @@ finally } ``` - -### Monitor all Telegram events happening for the user - -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 in real-time - -You have to handle `client.OnUpdate` events containing an `UpdateNewMessage`. - -See the `DisplayMessage` method in [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs). - -You can filter specific chats the message are posted in, by looking at the `Message.peer_id` field. - ### Downloading photos, medias, files @@ -439,7 +440,7 @@ You can find an example for such custom session store in [Examples/Program_Herok var text = "Vicksy says Hi! [👋](emoji?id=5190875290439525089)"; var entities = client.MarkdownToEntities(ref text, premium: true); await client.SendMessageAsync(InputPeer.Self, text, entities: entities); -// also available in HTML: "👋" +// also available in HTML: 👋 // • Fetch all available standard emoji reactions var all_emoji = await client.Messages_GetAvailableReactions(); @@ -465,7 +466,7 @@ var messages = await client.Messages_Search(chat, lim foreach (var msg in messages.Messages) await client.Messages_SendReaction(chat, msg.ID, reaction: new[] { reaction }); ``` -*Note: you can find custom emoji document IDs via API methods like [Messages_GetFeaturedEmojiStickers](https://corefork.telegram.org/method/messages.getFeaturedEmojiStickers). Access hash is not required* +*Note: you can find custom emoji document IDs via API methods like [Messages_GetFeaturedEmojiStickers](https://corefork.telegram.org/method/messages.getFeaturedEmojiStickers) or inspecting incoming messages. Access hash is not required* ### Forward or copy a message to another chat diff --git a/Examples/ASPnet_webapp.zip b/Examples/ASPnet_webapp.zip index 0e6d5a9958803389b17d8bd853410500acdc8891..3b1ee95a88fb7a779ff9be0f24cde8563fde6e16 100644 GIT binary patch delta 2214 zcmZuy2{_c<8lM^aGG+!L>%`DRmI+D8GBoy~j5Seq3N^ABY&0?l3Y&EofR12Qpmp|R`1??(tb$!n-(W@U`>RwRzUcDPb zII`p1u@X9|>H5USpvJ~dQ)<`b+0VOU14UPLriNjwZI$k&e|)0Jw4T*JpI3wB88R_h(Gwmh!m!gKr#Z+-?EZuJCQ>{n18mry+Ge(jHA>8b$ zr?Gri?+c$zs0l7C8`T$VKPtP8Ad8VVF{3qMv>m<$U6DK=si{+=T7P`K8~pU# zjSdTvptF@Q)@}fm{nV7oz!Br*PbatfQM2geZ#M&PnNy>7W=}A#Bi+-ei24ElXLcVd z)KUfVI^=>wBq4tGTG16^Jw!>3tGWYSlb;9jmfK)uJ);X%7h?<>+&hZN%aR_2)<~sV z+oVmu6{3bdxbo*G#z&726l?a~1*Z3?O?(i+A&a#lQ~hpyvw>(}(ju@pQkArLFT!fc zH|aU0U=e=*OPGih?Q~paUHV0F#Yp$4jP^66@ug#jyo%a@OMI*P_G`(f#h9i&{{{@qS=@us%NQt3q>OtE(_ zJgfheTEFXLg%*5Bnm-75ET$#Q=wobf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