Skip to content

Instantly share code, notes, and snippets.

@go2ready
Created September 6, 2018 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save go2ready/d7df98f1fa513fd6cbd2ca2e12f5668c to your computer and use it in GitHub Desktop.
Save go2ready/d7df98f1fa513fd6cbd2ca2e12f5668c to your computer and use it in GitHub Desktop.
Generated bot framework v4 state
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Arbiter
{
using Microsoft.Bot.Builder;
using System.Threading.Tasks;
using Microsoft.Bot.Builder.Core.Extensions;
using System.Collections.Generic;
public partial class CookState : IState
{
public virtual async System.Threading.Tasks.Task EatIntentReceived(RecognizerResult result, ITurnContext context)
{
await context.SendActivity("Not implemented");
throw new System.NotImplementedException("EatIntentReceived method is not implemented");
StateMachine.ChangeCurrentState(EatState.Instance, new StateTransitionParams());
}
public virtual async System.Threading.Tasks.Task BuyIntentReceived(RecognizerResult result, ITurnContext context)
{
await context.SendActivity("Not implemented");
throw new System.NotImplementedException("BuyIntentReceived method is not implemented");
StateMachine.ChangeCurrentState(BuyState.Instance, new StateTransitionParams());
}
public virtual async System.Threading.Tasks.Task ProcessIntent(RecognizerResult luisResult, ITurnContext context)
{
// Get the top matching intent
var topIntent = luisResult?.GetTopScoringIntent();
if (topIntent != null)
{
var topIntentString = topIntent.Value.intent;
if (!this._validIntents.Contains(topIntentString))
{
await this.NotValidIntentReceived(context);
}
try
{
// Call the class memeber method using reflection
var method = this.GetType().GetMethod($"{topIntentString}IntentReceived");
await (Task) method.Invoke(this, new System.Object[] { luisResult, context });
}
catch (System.NullReferenceException e)
{
throw new System.NotImplementedException("Method to process intent not existed, is the code out of date?");
}
} else {
throw new System.NotImplementedException("No Top intent hanlder is not implemented.");
}
}
public virtual System.Threading.Tasks.Task Enter(IStateTransitionParams param)
{
throw new System.NotImplementedException("Enter method is not implemented");
}
public virtual async System.Threading.Tasks.Task NotValidIntentReceived(ITurnContext context)
{
await context.SendActivity("Not valid intent");
throw new System.NotImplementedException("NotValidIntentReceived method is not implemented");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment