mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2025-12-06 06:52:01 +01:00
Upgrade to layer 133
This commit is contained in:
parent
c727f75380
commit
77a44a86a6
|
|
@ -30,10 +30,10 @@ namespace WTelegramClientTest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static readonly Dictionary<int, UserBase> users = new();
|
private static readonly Dictionary<long, UserBase> users = new();
|
||||||
private static readonly Dictionary<int, ChatBase> chats = new();
|
private static readonly Dictionary<long, ChatBase> chats = new();
|
||||||
private static string AUser(int user_id) => users.TryGetValue(user_id, out var user) ? user.DisplayName : $"User {user_id}";
|
private static string AUser(long user_id) => users.TryGetValue(user_id, out var user) ? user.DisplayName : $"User {user_id}";
|
||||||
private static string AChat(int chat_id) => chats.TryGetValue(chat_id, out var chat) ? chat.Title : $"Chat {chat_id}";
|
private static string AChat(long chat_id) => chats.TryGetValue(chat_id, out var chat) ? chat.Title : $"Chat {chat_id}";
|
||||||
private static string APeer(Peer peer) => peer is null ? null : peer is PeerUser user ? AUser(user.user_id)
|
private static string APeer(Peer peer) => peer is null ? null : peer is PeerUser user ? AUser(user.user_id)
|
||||||
: peer is PeerChat chat ? AChat(chat.chat_id) : peer is PeerChannel channel ? AChat(channel.channel_id) : $"Peer {peer.ID}";
|
: peer is PeerChat chat ? AChat(chat.chat_id) : peer is PeerChannel channel ? AChat(channel.channel_id) : $"Peer {peer.ID}";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ foreach (var chat in chats)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Console.Write("Type a chat ID to send a message: ");
|
Console.Write("Type a chat ID to send a message: ");
|
||||||
var id = int.Parse(Console.ReadLine());
|
long id = long.Parse(Console.ReadLine());
|
||||||
var target = chats.First(chat => chat.ID == id);
|
var target = chats.First(chat => chat.ID == id);
|
||||||
await client.SendMessageAsync(target, "Hello, World");
|
await client.SendMessageAsync(target, "Hello, World");
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue