Upgrade to layer 133

This commit is contained in:
Wizou 2021-09-17 04:37:30 +02:00
parent c727f75380
commit 77a44a86a6
2 changed files with 5 additions and 5 deletions

View file

@ -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}";

View file

@ -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");
``` ```