BotConfiguration class

Warning

This API is now deprecated.

See https://aka.ms/bot-file-basics for more information.

Extends

Constructors

BotConfiguration()

Creates a new BotConfigurationBase instance.

Inherited Properties

description
name
padlock
services
version

Methods

clearSecret()

Clear secret.

decrypt(string)

Decrypt all values in the in memory config.

encrypt(string)

Encrypt all values in the in memory config.

fromJSON(Partial<IBotConfiguration>)

Load the bot configuration from a JSON.

generateKey()

Generate a new key suitable for encrypting.

getPath()

Gets the path that this config was loaded from. .save() will save to this path.

load(string, string)

Load the configuration from a .bot file.

loadBotFromFolder(string, string)

Load the bot configuration by looking in a folder and loading the first .bot file in the folder.

loadBotFromFolderSync(string, string)

Load the bot configuration by looking in a folder and loading the first .bot file in the folder. (blocking)

loadSync(string, string)

Load the configuration from a .bot file. (blocking)

save(string)

Save the file with secret.

saveAs(string, string)

Save the configuration to a .bot file.

saveAsSync(string, string)

Save the configuration to a .bot file. (blocking)

saveSync(string)

Save the file with secret. (blocking)

validateSecret(string)

Make sure secret is correct by decrypting the secretKey with it.

Inherited Methods

connectService(IConnectedService)

Connect a service to the bot file.

disconnectService(string)

Remove service by id.

disconnectServiceByNameOrId(string)

Remove service by name or id.

findService(string)

Find service by id.

findServiceByNameOrId(string)

Find service by name or id.

serviceFromJSON(IConnectedService)

Loads a ConnectedService instance given a JSON based service configuration.

toJSON()

Creates a JSON based version of the current bot.

Constructor Details

BotConfiguration()

Creates a new BotConfigurationBase instance.

new BotConfiguration()

Inherited Property Details

description

description: string

Property Value

string

Inherited From BotConfigurationBase.description

name

name: string

Property Value

string

Inherited From BotConfigurationBase.name

padlock

padlock: string

Property Value

string

Inherited From BotConfigurationBase.padlock

services

services: IConnectedService[]

Property Value

Inherited From BotConfigurationBase.services

version

version: string

Property Value

string

Inherited From BotConfigurationBase.version

Method Details

clearSecret()

Clear secret.

function clearSecret()

decrypt(string)

Decrypt all values in the in memory config.

function decrypt(secret?: string)

Parameters

secret

string

Secret to decrypt.

encrypt(string)

Encrypt all values in the in memory config.

function encrypt(secret: string)

Parameters

secret

string

Secret to encrypt.

fromJSON(Partial<IBotConfiguration>)

Load the bot configuration from a JSON.

static function fromJSON(source?: Partial<IBotConfiguration>): BotConfiguration

Parameters

source

Partial<IBotConfiguration>

JSON based configuration.

Returns

A new BotConfiguration instance.

generateKey()

Generate a new key suitable for encrypting.

static function generateKey(): string

Returns

string

Key to use with the encrypt method.

getPath()

Gets the path that this config was loaded from. .save() will save to this path.

function getPath(): string

Returns

string

The path.

load(string, string)

Load the configuration from a .bot file.

static function load(botpath: string, secret?: string): Promise<BotConfiguration>

Parameters

botpath

string

Path to bot file.

secret

string

(Optional) secret used to decrypt the bot file.

Returns

Promise<BotConfiguration>

A Promise with the new BotConfiguration instance.

loadBotFromFolder(string, string)

Load the bot configuration by looking in a folder and loading the first .bot file in the folder.

static function loadBotFromFolder(folder?: string, secret?: string): Promise<BotConfiguration>

Parameters

folder

string

(Optional) folder to look for bot files. If not specified the current working directory is used.

secret

string

(Optional) secret used to decrypt the bot file.

Returns

Promise<BotConfiguration>

A Promise with the new BotConfiguration instance.

loadBotFromFolderSync(string, string)

Load the bot configuration by looking in a folder and loading the first .bot file in the folder. (blocking)

static function loadBotFromFolderSync(folder?: string, secret?: string): BotConfiguration

Parameters

folder

string

(Optional) folder to look for bot files. If not specified the current working directory is used.

secret

string

(Optional) secret used to decrypt the bot file.

Returns

A new BotConfiguration instance.

loadSync(string, string)

Load the configuration from a .bot file. (blocking)

static function loadSync(botpath: string, secret?: string): BotConfiguration

Parameters

botpath

string

Path to bot file.

secret

string

(Optional) secret used to decrypt the bot file.

Returns

A new BotConfiguration instance.

save(string)

Save the file with secret.

function save(secret?: string): Promise<void>

Parameters

secret

string

(Optional) secret used to encrypt the bot file.

Returns

Promise<void>

A promise representing the asynchronous operation.

saveAs(string, string)

Save the configuration to a .bot file.

function saveAs(botpath: string, secret?: string): Promise<void>

Parameters

botpath

string

Path to bot file.

secret

string

(Optional) secret used to encrypt the bot file.

Returns

Promise<void>

saveAsSync(string, string)

Save the configuration to a .bot file. (blocking)

function saveAsSync(botpath: string, secret?: string)

Parameters

botpath

string

Path to bot file.

secret

string

(Optional) secret used to encrypt the bot file.

saveSync(string)

Save the file with secret. (blocking)

function saveSync(secret?: string)

Parameters

secret

string

(Optional) secret used to encrypt the bot file.

validateSecret(string)

Make sure secret is correct by decrypting the secretKey with it.

function validateSecret(secret: string)

Parameters

secret

string

Secret to use.

Inherited Method Details

connectService(IConnectedService)

Connect a service to the bot file.

function connectService(newService: IConnectedService): string

Parameters

newService
IConnectedService

Service to add.

Returns

string

Assigned ID for the service.

Inherited From BotConfigurationBase.connectService

disconnectService(string)

Remove service by id.

function disconnectService(id: string)

Parameters

id

string

ID of the service to remove.

Inherited From BotConfigurationBase.disconnectService

disconnectServiceByNameOrId(string)

Remove service by name or id.

function disconnectServiceByNameOrId(nameOrId: string): IConnectedService

Parameters

nameOrId

string

Name or ID of the service to remove.

Returns

The removed IConnectedService based on the provided name or id.

Inherited From BotConfigurationBase.disconnectServiceByNameOrId

findService(string)

Find service by id.

function findService(id: string): IConnectedService

Parameters

id

string

ID of the service to find.

Returns

The IConnectedService based on the provided id.

Inherited From BotConfigurationBase.findService

findServiceByNameOrId(string)

Find service by name or id.

function findServiceByNameOrId(nameOrId: string): IConnectedService

Parameters

nameOrId

string

Name or ID of the service to find.

Returns

The IConnectedService based on the provided name or id.

Inherited From BotConfigurationBase.findServiceByNameOrId

serviceFromJSON(IConnectedService)

Loads a ConnectedService instance given a JSON based service configuration.

static function serviceFromJSON(service: IConnectedService): ConnectedService

Parameters

service
IConnectedService

JSON based service configuration.

Returns

A new ConnectedService instance.

Inherited From BotConfigurationBase.serviceFromJSON

toJSON()

Creates a JSON based version of the current bot.

function toJSON(): IBotConfiguration

Returns

An IBotConfiguration JSON.

Inherited From BotConfigurationBase.toJSON