Exemple #1
0
        public async Task <Agent> IntitiateConversationWithAgentAsync(Activity message, CancellationToken cancellationToken)
        {
            var agent = _agentProvider.GetNextAvailableAgent();

            if (agent == null)
            {
                return(null);
            }

            await _agentUserMapping.SetAgentUserMappingAsync(agent, new User(message), cancellationToken);

            var userReply = message.CreateReply($"You are now connected to {agent.ConversationReference.User.Name}");

            await SendToConversationAsync(userReply);

            var agentReply = agent.ConversationReference.GetPostToUserMessage();

            agentReply.Text = $"{message.From.Name} has joined the conversation.";
            await SendToConversationAsync(agentReply);

            agentReply.Text = "Replaying User and Bot conversation: \n\n" + string.Join("\n\n", ActivityLogger.ChatContainer.ToArray());
            await SendToConversationAsync(agentReply);

            ActivityLogger.ChatContainer.Clear();
            return(agent);
        }
        /// <inheritdoc/>
        public async Task <Agent> IntitiateConversationWithAgentAsync(Activity message, CancellationToken cancellationToken)
        {
            var agent = _agentProvider.GetNextAvailableAgent();

            if (agent == null)
            {
                return(null);
            }

            await _agentUserMapping.SetAgentUserMappingAsync(agent, new User(message), cancellationToken);

            var userReply = message.CreateReply(string.Format(ConversationText.YouConnectToSomeone, agent.ConversationReference.User.Name));
            await Utility.SendToConversationAsync(userReply);

            var agentReply = agent.ConversationReference.GetPostToUserMessage();

            agentReply.Text = string.Format(ConversationText.SomeoneJoinTheConversation, message.From.Name);
            await Utility.SendToConversationAsync(agentReply);

            return(agent);
        }
        public async Task <Agent> IntitiateConversationWithAgentAsync(Activity message, CancellationToken cancellationToken)
        {
            var agent = _agentProvider.GetNextAvailableAgent();

            if (agent == null)
            {
                return(null);
            }

            await _agentUserMapping.SetAgentUserMappingAsync(agent, new User(message), cancellationToken);

            var userReply = message.CreateReply($"You are now connected to {agent.ConversationReference.User.Name}");

            await SendToConversationAsync(userReply);

            var agentReply = agent.ConversationReference.GetPostToUserMessage();

            agentReply.Text = $"{message.From.Name} have joined the conversation.";
            await SendToConversationAsync(agentReply);

            return(agent);
        }