From 4bbcfacedc097ef83ab494725b499b461b399fc0 Mon Sep 17 00:00:00 2001 From: shoopea Date: Wed, 5 Feb 2020 18:47:17 +0800 Subject: [PATCH] test clients --- bot.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bot.go b/bot.go index 6d7449b..2879a2a 100644 --- a/bot.go +++ b/bot.go @@ -299,11 +299,15 @@ func botGetClients(m *tb.Message) { muxClients.RLock() ret := fmt.Sprintf("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", ret) muxClients.RUnlock()