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 0e6d5a9..3b1ee95 100644 Binary files a/Examples/ASPnet_webapp.zip and b/Examples/ASPnet_webapp.zip differ diff --git a/src/Session.cs b/src/Session.cs index 71c2e7d..e5a8f12 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -117,7 +117,7 @@ namespace WTelegram catch (Exception ex) { store.Dispose(); - throw new ApplicationException($"Exception while reading session file: {ex.Message}\nDelete the file to start a new session", ex); + throw new ApplicationException($"Exception while reading session file: {ex.Message}\nUse the correct api_hash/id/key, or delete the file to start a new session", ex); } session ??= new Session(); session._store = store;