mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2026-04-04 14:07:41 +00:00
OnUpdate is now only for updates. OnOther is used for other notifications
This commit is contained in:
parent
5adde27f88
commit
753ac12eb1
5 changed files with 10 additions and 12 deletions
|
|
@ -18,10 +18,9 @@ namespace WTelegramClientTest
|
|||
client.OnUpdate += Client_OnUpdate;
|
||||
Console.ReadKey();
|
||||
|
||||
async Task Client_OnUpdate(IObject arg)
|
||||
async Task Client_OnUpdate(UpdatesBase updates)
|
||||
{
|
||||
if (arg is not Updates { updates: var updates } upd) return;
|
||||
foreach (var update in updates)
|
||||
foreach (var update in updates.UpdateList)
|
||||
{
|
||||
if (update is not UpdateNewMessage { message: Message message })
|
||||
continue; // if it's not about a new message, ignore the update
|
||||
|
|
|
|||
|
|
@ -39,9 +39,8 @@ namespace WTelegramClientTest
|
|||
}
|
||||
}
|
||||
|
||||
private static async Task Client_OnUpdate(IObject arg)
|
||||
private static async Task Client_OnUpdate(UpdatesBase updates)
|
||||
{
|
||||
if (arg is not UpdatesBase updates) return;
|
||||
updates.CollectUsersChats(Users, Chats);
|
||||
foreach (var update in updates.UpdateList)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,9 +33,8 @@ namespace WTelegramClientTest
|
|||
}
|
||||
|
||||
// if not using async/await, we could just return Task.CompletedTask
|
||||
private static async Task Client_OnUpdate(IObject arg)
|
||||
private static async Task Client_OnUpdate(UpdatesBase updates)
|
||||
{
|
||||
if (arg is not UpdatesBase updates) return;
|
||||
updates.CollectUsersChats(Users, Chats);
|
||||
foreach (var update in updates.UpdateList)
|
||||
switch (update)
|
||||
|
|
|
|||
|
|
@ -76,9 +76,8 @@ Type a command, or a message to send to the active secret chat:");
|
|||
} while (true);
|
||||
}
|
||||
|
||||
private static async Task Client_OnUpdate(IObject arg)
|
||||
private static async Task Client_OnUpdate(UpdatesBase updates)
|
||||
{
|
||||
if (arg is not UpdatesBase updates) return;
|
||||
updates.CollectUsersChats(Users, Chats);
|
||||
foreach (var update in updates.UpdateList)
|
||||
switch (update)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue