reloadIntent method

Future<void> reloadIntent(
  1. String name, {
  2. String? botName,
})

Reload an intent in the collection. The intent has to be collected first.

{name} is the name of the intent.

{botName} is the name of the bot that the intent belongs to. If not specified, the bot that is currently collected will be used. {botName} should not be specified if the bot is already collected to avoid unnecessary loading.

Implementation

Future<void> reloadIntent(String name, {String? botName}) async {
  if (botName == null && _bot == null) {
    GetIt.I<BotnoiClient>().error.add(
        "[collector.reloadIntent] : A bot must be collected first or the botName must be specified");
    return;
  }
  String key = "${botName ?? _bot?.botName}/$name";
  await _intents[key]?.reload();
}