Ejemplo n.º 1
0
        public void TestClient()
        {
            var configService = new ConfigService(new AssistantDbContext(), true);

            var client = new AssistantBotClient(configService.BotOptions(), null);

            Assert.NotNull(client);
        }
Ejemplo n.º 2
0
        public void TestGetCommands()
        {
            var commands = AssistantBotClient.GetCommands();

            foreach (var methodInfo in commands)
            {
                _testOutputHelper.WriteLine(methodInfo.GetCustomAttribute <Cmd>()?.Name);
            }
        }
Ejemplo n.º 3
0
        // 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();
        }
Ejemplo n.º 4
0
 public BotController(AssistantBotClient bot, ConfigService configService)
 {
     _bot           = bot;
     _configService = configService;
 }
Ejemplo n.º 5
0
        public void TestMatchCommand()
        {
            var msg = "help";

            Assert.Equal("help", AssistantBotClient.MatchCommand(msg).GetCustomAttribute <Cmd>()?.Name);
        }