test clients

This commit is contained in:
shoopea 2020-02-05 18:47:17 +08:00
parent db5e6b19d6
commit 4bbcfacedc

8
bot.go
View File

@ -299,11 +299,15 @@ func botGetClients(m *tb.Message) {
muxClients.RLock()
ret := fmt.Sprintf("<code>Version %s (%s)\n", githash, buildstamp)
for id, c := range clients {
chat, err := bot.ChatByID(strconv.FormatInt(c.CWUserID64, 10))
logOnError(err, "botGetClients : ChatByID")
var status string
if c.Active {
ret = fmt.Sprintf("%s%s | UserID : %d | TelegramID : %d (online)\n", ret, c.Login, c.CWUserID64, id)
status = `online`
} else {
ret = fmt.Sprintf("%s%s | UserID : %d | TelegramID : %d (offline)\n", ret, c.Login, c.CWUserID64, id)
status = `offline`
}
ret = fmt.Sprintf("%s%s (%s) | @%s (online)\n", ret, c.Login, c.Build, chat.Username)
}
ret = fmt.Sprintf("%s</code>", ret)
muxClients.RUnlock()