Add "Last Online" printing for Telegram bot (#3593)

This commit is contained in:
Anton Petrov
2025-12-03 16:43:37 +03:00
committed by GitHub
parent ad659e48cf
commit 7ccc0877a1
14 changed files with 88 additions and 70 deletions

View File

@@ -2952,10 +2952,12 @@ func (t *Tgbot) clientInfoMsg(
}
status := t.I18nBot("tgbot.offline")
isOnline := false
if p.IsRunning() {
for _, online := range p.GetOnlineClients() {
if online == traffic.Email {
status = t.I18nBot("tgbot.online")
isOnline = true
break
}
}
@@ -2968,6 +2970,9 @@ func (t *Tgbot) clientInfoMsg(
}
if printOnline {
output += t.I18nBot("tgbot.messages.online", "Status=="+status)
if !isOnline && traffic.LastOnline > 0 {
output += t.I18nBot("tgbot.messages.lastOnline", "Time=="+time.UnixMilli(traffic.LastOnline).Format("2006-01-02 15:04:05"))
}
}
if printActive {
output += t.I18nBot("tgbot.messages.active", "Enable=="+active)