有没有办法在新的v4中配置没有.bot文件的bot?
我想通过程序来完成这个任务,但是我在样本中找不到这个。
发布于 2018-10-03 15:29:45
appsettings.json指向机器人文件,如下所示:
{
"botFilePath": "BotConfiguration.bot",
"botFileSecret": ""
}然后在startup.cs中会发生这样的情况:
var secretKey = Configuration.GetSection("botFileSecret")?.Value;
var botFilePath = Configuration.GetSection("botFilePath")?.Value;
// Loads .bot configuration file and adds a singleton that your Bot can access through dependency injection.
var botConfig = BotConfiguration.Load(botFilePath ?? @".\BotConfiguration.bot", secretKey);
services.AddSingleton(sp => botConfig ?? throw new InvalidOperationException($"The .bot config file could not be loaded. ({botConfig})"));
// Retrieve current endpoint.
var environment = _isProduction ? "production" : "development";
var service = botConfig.Services.Where(s => s.Type == "endpoint" && s.Name == environment).FirstOrDefault();如果您希望在没有.bot文件的情况下处理事情,则需要对此进行更改。
https://stackoverflow.com/questions/52598966
复制相似问题