The online list is stored on the aptly named table online. There should be a core or main module handing the tracking, you'll just have to plug into the table. For correct access you need the botname too, as the table can be shared among several bots if you are running a multi-host environment.
As it's a simple mysql table you can even run statistic jobs outside the bot if you want, that way you won't interfer with the normal usage.