findBotWithName method

Future<Bot?> findBotWithName(
  1. String name
)

Find a bot in this botnoi chatbot server with a specific name.

  • {name} is the name of the bot that you want to find.

Implementation

Future<Bot?> findBotWithName(String name) async {
  List<Bot>? allBots = await findBots();
  try {
    GetIt.I<BotnoiClient>().finishedSuccessfully();
    return allBots!.firstWhere((element) => element.botName == name);
  } catch (e) {
    GetIt.I<BotnoiClient>().finishedFailed();
    return null;
  }
}