private async WTask.Task <TLUser> FindPeer(string search) { TLUser user = await SearchContact(search); if (user == null) { TLContactsFound ChBot = await SearchBotOrChannel(search); if (ChBot != null) { foreach (TLUser us in ChBot.getUsers()) { user = us; break; } } } return(user); }
private async WTask.Task <TLContactsFound> SearchBotOrChannel(string BouUsername) { TLContactsFound res = null; if (BouUsername != "") { try { TLRequestContactsSearch req = new TLRequestContactsSearch(); req.setLimit(1); req.setQ(BouUsername.Trim()); //res = (TLContactsFound)Api.doRpcCall(req); res = await WTask.Task.Run(() => (TLContactsFound)Api.doRpcCall(req)); } catch (Exception ex) { NotifyBar.Text = "خطا: " + ex.Message; NotifyBar.ForeColor = Color.Red; } } return(res); }