이 코드가 의도 한대로 작동하는 동안 MS 팀에서 사용자 데이터를 수집하는 방법이 있습니다.이 메서드를 추가하면 이전에 작동하는 메서드가 중단됩니다.나중에 팀에서 정보를 수신하는 방법으로 인해 나중에 충돌이 발생합니다.
members = await connector.Conversations.GetTeamsConversationMembersAsync(teamId, tenantId);
사용자 정보를 수신하는 동안은, 봇은 사용자가 사용자의 입력없이 트리거 내 나중에 방법을 일으키는 원인이 inputing, 때문에이 충돌하고 있다고 생각한다 :
public async void GetUsers()
{
string teamId = "TeamsID";
string tenantId = "TenantID";
var connector = new ConnectorClient(new Uri(Instance.Activity.ServiceUrl));
members = await connector.Conversations.GetTeamsConversationMembersAsync(teamId, tenantId);
Instance.EmailList.Clear();
foreach (var member in members)
{
Instance.EmailList.Add(member.Email);
}
}
나는 선이 있다고 생각 입력이 없거나 입력 데이터가 사용자 데이터 인 경우입니다.
이것은 제 이론이고 올바르지 않을 수 있습니다. 를 호출
async Task ReplyToQuestions(IDialogContext context, IAwaitable<IMessageActivity> argument)
{
var AnswerHolder = await argument;
Answers.Add(AnswerHolder.Text);
Answers[AnswerCounter] = Answers[AnswerCounter].First().ToString().ToUpper() + Answers[AnswerCounter].Substring(1);
var isQuit = AnswerHolder.Text;
var isQuit2 = Regex.Match(isQuit, @"\b(Quit|quit|QUIT)\b").Value;
Regex rgx = new Regex(@"\b(Quit|quit|QUIT)\b");
if (rgx.IsMatch(isQuit2)) // checks for the user trying to quit/restart bot
{
await context.PostAsync(string.Format("Exiting current process. Restarting."));
context.Done(isQuit); // returns to the start of dialog (StartAsync)
}
else
{
if (QuestionCounter < 5)
{
await context.PostAsync(string.Format($"Question {QuestionCounter + 1}: {Question[QuestionCounter]}"));
}
AnswerCounter += 1;
QuestionCounter += 1;
if (AnswerCounter < 5)
{
context.Wait(ReplyToQuestions);
}
else if (AnswerCounter == 5)
{
PostToChannel($"{Name}'s answers to the questions are as follows: \n\nQuestion1 Answer: {Answers[0]} \n\nQuestion2 Answer: {Answers[1]} \n\n" +
$"Question3 Answer: {Answers[2]} \n\nQuestion4 Answer: {Answers[3]} \n\nQuestion5 Answer: {Answers[4]} \n\n", context);
await context.PostAsync(string.Format("Your answers have been posted to the 'What's Up' channel."));
AnswerCounter = 0;
QuestionCounter = 1;
context.Done(Answers[4]);
}
else
{
await context.PostAsync($"{AnswerCounter}");
await context.PostAsync(string.Format("Oh no! it appears something has gone wrong. please try re-entering your answers"));
AnswerCounter = 0;
QuestionCounter = 1;
context.Wait(ReplyToQuestions);
}
}
}
을 그리고 코드 : 다음은 충돌 방법은
async Task Choice(IDialogContext context, IAwaitable<IMessageActivity> argument) // this method recives and validates a question
{
var Choice = await argument;
var isQuit = Choice.Text;
var isQuit2 = Regex.Match(isQuit, @"\b(Quit|quit|QUIT)\b").Value;
Regex rgx = new Regex(@"\b(Quit|quit|QUIT)\b");
var isEnter = Regex.Match(isQuit, @"\b(Enter|ENTER|enter)\b").Value;
Regex rgx2 = new Regex(@"\b(Enter|ENTER|enter)\b");
var isReply = Regex.Match(isQuit, @"\b(Reply|REPLY|reply)\b").Value;
Regex rgx3 = new Regex(@"\b(Reply|REPLY|reply)\b");
GetUsers();
if (rgx.IsMatch(isQuit2)) // if the user choses to quit
{
await context.PostAsync(string.Format("Exiting current process. Restarting."));
context.Done(isQuit); // restarts the program, calls the first method
}
else if (rgx2.IsMatch(isEnter)) // if the user choses to quit
{
await context.PostAsync(string.Format("Please enter your custom question."));
context.Wait(EnterQuestion);
}
else if (rgx3.IsMatch(isReply)) // if the user choses to quit
{
Answers.Clear();
await context.PostAsync(string.Format("Please answer the following questions:"));
await context.PostAsync(string.Format($"Question 1: {Question[0]}"));
context.Wait(ReplyToQuestions);
}
else
{
await context.PostAsync(string.Format("sorry this was not a choice, try again."));
}
}
사람이 내가이 문제를 해결할 수있는 방법을 알고 있나요? 이 일을 성공으로 이틀 동안 보냈기 때문에.
포스트 오류 및 로그 추적 –
봇이 푸른 하늘에서 호스팅되고 테스트가 팀을 통해 이루어 지므로 (팀과 상호 작용하도록 코드가 작성 됨)이 메시지를 수신 할 수 없습니다. – Zigy
@Zigy Azure에서 AppInsights로 오류 및 로그 추적을 할 수 있습니다. 더 많은 코드를 추가해야합니다. 우리가 현재 당신이 말한대로 문제의 원인이 될 수있는'GetUsers' 메서드를 호출하는 방법을 알지 못합니다. –