// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } BotFramework botFramework = new BotFramework(); app.Run(async(context) => { context.Response.ContentType = "text/plain"; string filePath = context.Request.Path; if (filePath.Length >= 16) { string jsonString = new StreamReader(context.Request.Body).ReadToEnd(); string path = filePath.Substring(0, 16).ToLower(); if (path == "/teleapireceiver") { botFramework.NewRequest(jsonString); } else if (path == "/pluginsreceiver") { // TODO: 加入插件的 WebHook 支持 } } await context.Response.WriteAsync("a"); }); }
/// <summary> /// Raises the "Connected" event /// </summary> protected virtual Task OnDisconnectedAsync() { return(BotFramework.OnWrapperDisconnectedAsync(this)); }
/// <summary> /// Raises the "JoinedNewServer" event /// </summary> /// <param name="server">The server which the bot joined</param> protected Task OnJoinedNewServerAsync(Server server) { return(BotFramework.OnNewServerJoinedAsync(server)); }
/// <summary> /// Raises the "Connected" event /// </summary> protected Task OnConnectedAsync() { return(BotFramework.OnWrapperConnectedAsync(this)); }
/// <summary> /// Raises the "NewUserJoined" event /// </summary> /// <param name="user"></param> /// <param name="server"></param> protected Task OnNewUserJoinedServerAsync(User user, Server server) { return(BotFramework.OnNewUserJoinedServerAsync(user, server)); }
/// <summary> /// When a server became unavailable /// </summary> /// <param name="server">The materialized server that became unavailable</param> protected Task OnServerUnavailableAsync(Server server) { return(BotFramework.OnServerUnavailableAsync(server)); }
/// <summary> /// When a reaction was added /// </summary> /// <param name="reaction">The materialized reaction</param> protected Task OnReactionAddedAsync(Reaction reaction) { return(BotFramework.OnReactionAddedAsync(reaction)); }
/// <summary> /// When a message was deleted /// </summary> /// <param name="message">The materialized message</param> protected Task OnMessageDeletedAsync(ChatMessage message) { return(BotFramework.OnMessageDeletedAsync(message)); }
/// <summary> /// When a message was received by the api wrapper /// </summary> /// <param name="message">The materialized received message</param> protected Task OnMessageReceivedAsync(ReceivedMessage message) { return(BotFramework.OnMessageReceivedAsync(message)); }