Closed m0nax3 closed 1 year ago
Something like this (I made for own app)
` var username = url[start..end];
ChatBase? existsInCache; lock (ChatsAndChannels) { existsInCache = ChatsAndChannels.Values.FirstOrDefault(f => f.MainUsername == username); } ChatBase chat; if (existsInCache == null) { lock (Users) { //yep, can be slow for 500k users, BUT still FASTER then FLOOD_WAIT_X10000 (^_^) if (Users.Values.Any(f => f.MainUsername == username)) return null; } var resolved = await Contacts_ResolveUsername(username); chat = resolved.Chat; } else { chat = existsInCache; }
`
I will consider part of your suggestion. However you should just cache the result of AnalyzeInviteLink for a given url, in order to avoid resolving always the same usernames
Something like this (I made for own app)
`
var username = url[start..end];
`