test function

void test()

Implementation

void test() async {
  BotnoiChatbot server = BotnoiChatbot.serverInstance;

  Bot newBot = Bot(
    botName: "newBot",
    sex: "male",
    age: 20,
    owner: "newOwner",
    botAvatar: "https://new.com/avatar.png",
    businessType: "education",
  );

  await server.createBot(bot: newBot);

  BotIntent newIntent = BotIntent(
    name: "newIntent",
  );

  await newBot.reload();
  await newBot.opt.createIntent(intent: newIntent);

  // BotIntent? myIntent = await newBot.opt.findIntentWithName("myIntent");

  await newIntent.reload();
  await newIntent.opt?.trainKeyword(keyword: "Hello");
  await newIntent.opt?.trainMessage(message: "Hello! how are you?");

  BotObject myApiObject = BotObject(
    objectName: "myApiObject",
    objectType: "api",
    objects: [
      BotApiObject(
        url: "https://api_example.com",
        method: "post",
        header: {"Content-Type": "application/json"},
        body: "{'data': 'example_data'}",
      )
    ],
  );

  await newBot.opt.createObject(object: myApiObject);
}