Esempio n. 1
0
        private static async void Bot_OnMessage(object sender, MessageEventArgs e)
        {
            if (e.Message.Text != null)
            {
                var ratingRetrieved = GetMaximumRating(e.Message.Text);
                var resultAnswer    = $"По вашему запросу получен рейтинг: *{ratingRetrieved}*";
                await _botClient.SendTextMessageAsync(
                    chatId : e.Message.Chat,
                    text : resultAnswer,
                    ParseMode.Markdown
                    );

                var logInfo = new LoggingInfo
                {
                    ChatId    = e.Message.Chat.Id,
                    FirstName = e.Message.Chat.FirstName,
                    LastName  = e.Message.Chat.LastName,
                    UserName  = e.Message.Chat.Username,
                    Question  = e.Message.Text,
                    Answer    = resultAnswer,
                    Date      = e.Message.Date
                };
                _logger.OutputWriter(logInfo);
            }
        }