In that case, it probably wouldn't even be necessary to implement checks to ensure that the player isn't a bot.
It is necessary. As mentioned above, the functions for clicking the "OK" and "Cancel" buttons cannot be performed by the computer. You will have to implement a check to determine if the hero belongs to the AI, and if it does, immediately direct it to the "OK" button function.
Added 10 minutes later
Or a special function for the AI.