从 Telegram 机器人获取用户的 "Last Seen"?

Getting the user's "Last Seen" from a Telegram bot?

当我与 Telegram 用户聊天时,我可以看到每个用户的 "last seen" - 他们最后一次连接到 Telegram 的时间(即使我已经有一段时间没有与他们聊天了)。

有没有办法通过机器人 API 查询此信息?我还没有找到访问它的方法。

Telegram Bot 目前无法做到这一点 API。

https://core.telegram.org/bots#4-how-are-bots-different-from-humans

Bots have no online status and no last seen timestamps, the interface shows the label ‘bot’ instead.

Telegram Bot API 无法做到这一点。 但是 Telegram API 是可能的,它允许您构建自己的自定义 Telegram 客户端,并具有其他方法,如阅读消息或状态(当然,受目标用户的隐私设置限制)。

在生成哈希以验证 my telegram, you can use a library like Telegram-MTProto to call contacts.getStatuses which return an array of ContactStatus 上的 API 客户端并了解用户是在线还是离线之后。

const getStatuses = async () => {
    const statuses = await telegram('contacts.getStatuses', {})
    // Check online status
    if(statuses[0].status._ === 'userStatusOnline')
        // Online
}

在 plus messenger 中,使用 bot 登录,显示最近一次看到的相对关系。

也许你可以在他们的官方支持小组中询问他们:https://t.me/plusmsgrchat(我被屏蔽了)