updated readme.md and bot controller code
This commit is contained in:
parent
7470b353bd
commit
4b5e080a3b
|
@ -68,6 +68,8 @@ Version|Date|Comments
|
|||
- configure bot name and web chat secret key
|
||||
![preview](./assets/preview.png)
|
||||
- type hello and proceed with site creation process
|
||||
- final output
|
||||
![botregister-step4](./assets/botregister-step4.png)
|
||||
|
||||
## Features
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 58 KiB |
Binary file not shown.
|
@ -162,7 +162,7 @@
|
|||
</site>
|
||||
<site name="AskSPRider" id="2">
|
||||
<application path="/" applicationPool="Clr4IntegratedAppPool">
|
||||
<virtualDirectory path="/" physicalPath="C:\Users\veljo05\Desktop\js-bot-framework\bot\AskSPRider" />
|
||||
<virtualDirectory path="/" physicalPath="C:\Source\Git\Microsoft\sp-dev-fx-webparts\samples\js-bot-framework\bot\AskSPRider" />
|
||||
</application>
|
||||
<bindings>
|
||||
<binding protocol="http" bindingInformation="*:3979:localhost" />
|
||||
|
|
|
@ -2,10 +2,8 @@
|
|||
using Microsoft.Bot.Builder.Dialogs;
|
||||
using Microsoft.Bot.Builder.FormFlow;
|
||||
using Microsoft.Bot.Connector;
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.ServiceModel.Channels;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.Description;
|
||||
|
@ -22,9 +20,47 @@ namespace AskSPRider
|
|||
|
||||
[ResponseType(typeof(void))]
|
||||
public virtual async Task<HttpResponseMessage> Post([FromBody] Activity activity)
|
||||
{
|
||||
if (activity.Type == ActivityTypes.Message)
|
||||
{
|
||||
await Conversation.SendAsync(activity, BuildSiteRequestDialog);
|
||||
return new HttpResponseMessage(System.Net.HttpStatusCode.Accepted);
|
||||
return new HttpResponseMessage(HttpStatusCode.Accepted);
|
||||
}
|
||||
else
|
||||
{
|
||||
HandleSystemMessage(activity);
|
||||
}
|
||||
var response = Request.CreateResponse(HttpStatusCode.OK);
|
||||
return response;
|
||||
}
|
||||
|
||||
private Activity HandleSystemMessage(Activity message)
|
||||
{
|
||||
if (message.Type == ActivityTypes.DeleteUserData)
|
||||
{
|
||||
// Implement user deletion here
|
||||
// If we handle user deletion, return a real message
|
||||
}
|
||||
else if (message.Type == ActivityTypes.ConversationUpdate)
|
||||
{
|
||||
// Handle conversation state changes, like members being added and removed
|
||||
// Use Activity.MembersAdded and Activity.MembersRemoved and Activity.Action for info
|
||||
// Not available in all channels
|
||||
}
|
||||
else if (message.Type == ActivityTypes.ContactRelationUpdate)
|
||||
{
|
||||
// Handle add/remove from contact lists
|
||||
// Activity.From + Activity.Action represent what happened
|
||||
}
|
||||
else if (message.Type == ActivityTypes.Typing)
|
||||
{
|
||||
// Handle knowing tha the user is typing
|
||||
}
|
||||
else if (message.Type == ActivityTypes.Ping)
|
||||
{
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,7 +8,8 @@ using System.ComponentModel;
|
|||
|
||||
namespace AskSPRider.Forms
|
||||
{
|
||||
public enum SiteTemplateOptions {
|
||||
public enum SiteTemplateOptions
|
||||
{
|
||||
[Description("STS#0")]
|
||||
Team,
|
||||
[Description("PROJECTSITE#0")]
|
||||
|
@ -39,6 +40,7 @@ namespace AskSPRider.Forms
|
|||
|
||||
public static IForm<SiteRequestOrder> BuildForm()
|
||||
{
|
||||
|
||||
OnCompletionAsyncDelegate<SiteRequestOrder> wrapUpRequest = async (context, request) =>
|
||||
{
|
||||
|
||||
|
@ -76,8 +78,8 @@ namespace AskSPRider.Forms
|
|||
.Field(nameof(Description))
|
||||
.Field(nameof(URLName), validate: SubSiteValidator)
|
||||
.Field(nameof(Template))
|
||||
.Confirm("Do you want to submit your sub-site request - {Title}?")
|
||||
.AddRemainingFields()
|
||||
.Confirm("Do you want to submit your sub-site request - {Title}?")
|
||||
.Message("Thanks for submitting a new sub-site!")
|
||||
.OnCompletion(wrapUpRequest)
|
||||
.Build();
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue