Exemple #1
0
        public async void GetInlineBotResults(string text)
        {
            if (CurrentInlineBot == null)
            {
                InlineBotResults = null;
                return;
            }

            Debug.WriteLine($"@{CurrentInlineBot.Username}: {CurrentInlineBot.BotInlinePlaceholder}, {text}");

            // TODO: cache

            if (false)
            {
            }
            else
            {
                var response = await ProtoService.GetInlineBotResultsAsync(CurrentInlineBot.ToInputUser(), Peer, null, text, string.Empty);

                if (response.IsSucceeded)
                {
                    foreach (var item in response.Result.Results)
                    {
                        item.QueryId = response.Result.QueryId;
                    }

                    InlineBotResults = response.Result;
                    Debug.WriteLine(response.Result.Results.Count.ToString());
                }
            }
        }
        public async void GetInlineBotResults(string query)
        {
            if (CurrentInlineBot == null)
            {
                InlineBotResults = null;
                return;
            }

            if (query != null)
            {
                query = query.Format();
            }

            Debug.WriteLine($"@{CurrentInlineBot.Username}: {CurrentInlineBot.BotInlinePlaceholder}, {query}");

            // TODO: cache

            if (false)
            {
            }
            else
            {
                var collection = new BotResultsCollection(ProtoService, CurrentInlineBot.ToInputUser(), Peer, null, query);
                var result     = await collection.LoadMoreItemsAsync(0);

                if (collection.Results != null)
                {
                    InlineBotResults = collection;
                }

                //var response = await ProtoService.GetInlineBotResultsAsync(CurrentInlineBot.ToInputUser(), Peer, null, query, string.Empty);
                //if (response.IsSucceeded)
                //{
                //    foreach (var item in response.Result.Results)
                //    {
                //        item.QueryId = response.Result.QueryId;
                //    }

                //    InlineBotResults = response.Result;
                //    Debug.WriteLine(response.Result.Results.Count.ToString());
                //}
            }
        }