This setNewConnection() method in Connection class with dozens of bots, this is a laughing stock and not bot detection.
Wanting to do it decently, it would be necessary to implement, for example DeviceDetector library from matomo:
https://github.com/matomo-org/device-detector