I think it will be good option to use a thirdparty library to detect the user agent as a bot or not. This way there will be lot of more updates will happen often and no bots will be left out.
Suggestion
https://github.com/omrilotan/isbot