public static IBotBuilder UseWhen <THandler>(this IBotBuilder builder, Predicate <IUpdateContext> predicate) where THandler : IUpdateHandler { var branchDelegate = new BotBuilder().Use <THandler>().Build(); builder.Use(new UseWhenMiddleware(predicate, branchDelegate)); return(builder); }
public static IBotBuilder UseWhen( this IBotBuilder builder, Predicate <IUpdateContext> predicate, Action <IBotBuilder> configure ) { var branchBuilder = new BotBuilder(); configure(branchBuilder); UpdateDelegate branchDelegate = branchBuilder.Build(); builder.Use(new UseWhenMiddleware(predicate, branchDelegate)); return(builder); }
public static IBotBuilder MapWhen( this IBotBuilder builder, Predicate <IUpdateContext> predicate, Action <IBotBuilder> configure ) { var mapBuilder = new BotBuilder(); configure(mapBuilder); UpdateDelegate mapDelegate = mapBuilder.Build(); builder.Use(new MapWhenMiddleware(predicate, mapDelegate)); return(builder); }