public void TestClient() { var configService = new ConfigService(new AssistantDbContext(), true); var client = new AssistantBotClient(configService.BotOptions(), null); Assert.NotNull(client); }
public void TestGetCommands() { var commands = AssistantBotClient.GetCommands(); foreach (var methodInfo in commands) { _testOutputHelper.WriteLine(methodInfo.GetCustomAttribute <Cmd>()?.Name); } }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, AssistantBotClient client) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseSwagger(); app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "JacobAssistant v1")); } app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); // 启动Bot client.Start(); }
public BotController(AssistantBotClient bot, ConfigService configService) { _bot = bot; _configService = configService; }
public void TestMatchCommand() { var msg = "help"; Assert.Equal("help", AssistantBotClient.MatchCommand(msg).GetCustomAttribute <Cmd>()?.Name); }