reloadObject method

Future<void> reloadObject(
  1. BotObjectType type,
  2. String name, {
  3. String? botName,
})

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

{type} is the type of the object.

{name} is the name of the object.

{botName} is the name of the bot that the object 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> reloadObject(BotObjectType type, String name,
    {String? botName}) async {
  if (botName == null && _bot == null) {
    GetIt.I<BotnoiClient>().error.add(
        "[collector.reloadObject] : A bot must be collected first or the botName must be specified");
    return;
  }
  String key =
      "${botName ?? _bot?.botName}/${type.stringType}/${BotObjectNamer.byAction(name, type)}";
  await _objects[key]?.reload();
}