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] 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;