forked from rvinothrajendran/BotTutorialSample
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLuisSample.cs
More file actions
63 lines (58 loc) · 2.38 KB
/
Copy pathLuisSample.cs
File metadata and controls
63 lines (58 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Luis;
using Microsoft.Bot.Builder;
using Microsoft.Bot.Schema;
namespace LuisSample
{
public class MyLuisSample : ActivityHandler
{
private LuisHelper.LuisHelper _luisHelper;
public MyLuisSample(LuisHelper.LuisHelper luisHelper)
{
_luisHelper = luisHelper;
}
protected override async Task OnMembersAddedAsync(IList<ChannelAccount> membersAdded, ITurnContext<IConversationUpdateActivity> turnContext, CancellationToken cancellationToken)
{
foreach (var member in membersAdded)
{
if (member.Id != turnContext.Activity.Recipient.Id)
{
await turnContext.SendActivityAsync(MessageFactory.Text($"Hello world!"), cancellationToken);
}
}
}
protected override async Task OnMessageActivityAsync(ITurnContext<IMessageActivity> turnContext, CancellationToken cancellationToken)
{
var result = await _luisHelper.RecognizeAsync<RestaurantLuis>(turnContext, cancellationToken);
var topIntent = result.TopIntent().intent;
switch (topIntent)
{
case RestaurantLuis.Intent.None:
break;
case RestaurantLuis.Intent.RestaurantReservation_ChangeReservation:
break;
case RestaurantLuis.Intent.RestaurantReservation_Confirm:
break;
case RestaurantLuis.Intent.RestaurantReservation_DeleteReservation:
break;
case RestaurantLuis.Intent.RestaurantReservation_FindReservationEntry:
break;
case RestaurantLuis.Intent.RestaurantReservation_FindReservationWhen:
break;
case RestaurantLuis.Intent.RestaurantReservation_FindReservationWhere:
break;
case RestaurantLuis.Intent.RestaurantReservation_Reject:
break;
case RestaurantLuis.Intent.RestaurantReservation_Reserve:
break;
default:
throw new ArgumentOutOfRangeException();
}
}
}
}