Hallo Petr and Simon (and everyone else),
thank you very much for your replies!
All bots on a given wiki have a row in the user_groups table with ug_group set to 'bot'. So, you can use that to get the list of all bot accounts on a wiki.
I'm now using this solution by Petr in my program and it works very well. If a few bots among a few thousand are missing that should not matter too much.
Philipp