It's not possible with the Telegram Bot API.
But it's possible with Telegram API which allows you to build your own customized Telegram clients, and have other methods like read messages, or status (limited by the target users' privacy settings, of course).
After generate an hash to authenticate your API client on my telegram, you can use a library like Telegram-MTProto to call contacts.getStatuses which return an array of ContactStatus and know if user is online or offline.
const getStatuses = async () => {
const statuses = await telegram('contacts.getStatuses', {})
// Check online status
if(statuses[0].status._ === 'userStatusOnline')
// Online
}