Renamed Update event to OnUpdate, returning Task

(to gracefully handle async exceptions)
This commit is contained in:
Wizou 2022-07-29 15:24:18 +02:00
parent 6977641b2d
commit 668b19e3e8
8 changed files with 32 additions and 29 deletions

View file

@ -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)