updateFromFile method
Updates the bot with the given id from config files.
See createFromFile for the accepted file formats and metadata keys.
Implementation
Future<Bot> updateFromFile({
required int id,
String? intents,
String? flow,
String? metadata,
}) async {
final intentsMap = intents == null ? null : await _readConfigFile(intents);
final flowMap = flow == null ? null : await _readConfigFile(flow);
final meta =
metadata == null ? const {} : (await _readConfigFile(metadata) ?? {});
return updateBot(
id: id,
name: meta['name'] as String?,
description: meta['description'] as String?,
industry: meta['industry'] as String?,
webhookUrl: meta['webhook_url'] as String?,
webhookTriggerIntents:
(meta['webhook_trigger_intents'] as List?)?.cast<String>(),
visibleOnCommunity: meta['visible_on_community'] as bool?,
intents: intentsMap,
flow: flowMap,
);
}