I need help figuring out how to monitor whether a Telegram user is currently active or not through my bot. My teacher gave me this assignment where I have to check user activity status, and I already have their user IDs.
myBot.on('status_check', async (context) => {
// Need to implement status checking logic here
})
I’ve been searching everywhere but can’t seem to find any clear method or API endpoint that would let me do this. Has anyone successfully implemented something like this before? I’m really stuck on this part of my project and would appreciate any guidance on the right approach to take.
i totally agree! the api’s pretty strict on privacy. u could log user interactions with ur bot to track activity - like checking when they last messaged u. that’d help u figure out who’s actually active. good luck!
Unfortunately, the Telegram Bot API does not provide a way to check if users are currently online. This limitation is by design to maintain user privacy. I faced a similar challenge in a past project. The most you can do is monitor the last time users interacted with your bot, which only reflects their engagement rather than their actual online status. It might be worthwhile to clarify with your teacher whether they are referring to activity in relation to bot interactions instead of general online presence.
Had the same issue on a university project last year. The Bot API doesn’t expose user online status for privacy reasons. I ended up creating a tracking system that logged timestamps whenever users sent messages or used inline keyboards. Store these interaction timestamps in a database, then determine activity based on recent engagement patterns. If someone interacted with your bot within the last hour, consider them recently active. This worked well for my professor’s requirements since it showed meaningful engagement rather than just passive online presence.