public override InlineQueryResult[] GetResult()
        {
            db = new MarketBotDbContext();

            this.FollowerList = GetFollower().Take(MaxResult).ToList();

            InputTextMessageContent[]  textcontent = new InputTextMessageContent[FollowerList.Count];
            InlineQueryResultArticle[] article     = new InlineQueryResultArticle[FollowerList.Count];
            InlineQueryResult[]        result      = new InlineQueryResult[FollowerList.Count];

            int i = 0;

            foreach (var follower in FollowerList)
            {
                string telephoneLine = "";

                FollowerControlMessage followerControlMessage = new FollowerControlMessage(follower.Id);
                var message = followerControlMessage.BuildMsg();

                if (follower.Telephone != null && follower.Telephone != "")
                {
                    telephoneLine = BotMessage.NewLine() + "Телефон: " + follower.Telephone;
                }


                textcontent[i]                       = new InputTextMessageContent();
                textcontent[i].ParseMode             = Telegram.Bot.Types.Enums.ParseMode.Html;
                textcontent[i].DisableWebPagePreview = true;
                textcontent[i].MessageText           = message.TextMessage;

                article[i]             = new InlineQueryResultArticle();
                article[i].HideUrl     = false;
                article[i].Id          = follower.Id.ToString();
                article[i].Title       = follower.FirstName + " " + follower.LastName;
                article[i].Description = telephoneLine;
                article[i].ReplyMarkup = followerControlMessage.SetInline();

                article[i].ThumbUrl            = "https://cdn3.iconfinder.com/data/icons/user-avatars-1/512/users-11-2-256.png";
                article[i].Url                 = "https://t.me/" + follower.UserName;
                article[i].InputMessageContent = textcontent[i];

                result[i] = new InlineQueryResult();
                result[i] = article[i];

                i++;
            }

            return(result);
        }
Пример #2
0
        private async Task <IActionResult> SendFollowerDetails()
        {
            try
            {
                int id = Convert.ToInt32(base.CommandName.Substring(FollowerDetailsCmd.Length));
                BotMessage = new FollowerControlMessage(id);
                await SendMessage(BotMessage.BuildMsg());

                return(OkResult);
            }
            catch
            {
                return(OkResult);
            }
        }
Пример #3
0
        /// <summary>
        /// Разблокировать пользо
        /// </summary>
        /// <returns></returns>
        private async Task <IActionResult> UnBlockUser()
        {
            var follower = BusinessLayer.FollowerFunction.UnBlock(Argumetns[0]);

            if (follower != null)
            {
                BotMessage = new FollowerControlMessage(follower);
                await EditMessage(BotMessage.BuildMsg());

                //уведомим струдников
                string message = "Пользователь " + follower.FirstName + " " + follower.LastName + " Разблокирован." + BotMessage.NewLine() +
                                 "Оператор:" + GeneralFunction.FollowerFullName(FollowerId);
                await SendMessageAllBotEmployeess(new BotMessage { TextMessage = message });
            }

            return(OkResult);
        }