versioning

This commit is contained in:
shoopea 2020-02-05 18:27:12 +08:00
parent 02497ae7e2
commit 71403d83a4
2 changed files with 3 additions and 2 deletions

3
bot.go
View File

@ -297,7 +297,7 @@ func botGetClients(m *tb.Message) {
if clt, ok := getLockedClient(m.Chat.ID, false); ok { if clt, ok := getLockedClient(m.Chat.ID, false); ok {
clt.Mux.Unlock() clt.Mux.Unlock()
muxClients.RLock() muxClients.RLock()
var ret string ret = fmt.Sprintf("<code>Version %s (%s)", githash, buildstamp)
for id, c := range clients { for id, c := range clients {
if c.Active { if c.Active {
ret = fmt.Sprintf("%s%s | UserID : %d | TelegramID : %d (online)\n", ret, c.Login, c.CWUserID64, id) ret = fmt.Sprintf("%s%s | UserID : %d | TelegramID : %d (online)\n", ret, c.Login, c.CWUserID64, id)
@ -305,6 +305,7 @@ func botGetClients(m *tb.Message) {
ret = fmt.Sprintf("%s%s | UserID : %d | TelegramID : %d (offline)\n", ret, c.Login, c.CWUserID64, id) ret = fmt.Sprintf("%s%s | UserID : %d | TelegramID : %d (offline)\n", ret, c.Login, c.CWUserID64, id)
} }
} }
ret = fmt.Sprintf("%s</code>", ret)
muxClients.RUnlock() muxClients.RUnlock()
c := TGCommand{ c := TGCommand{

View File

@ -21,7 +21,7 @@ var (
config = flag.String("config", "config.json", "config file path") config = flag.String("config", "config.json", "config file path")
initdb = flag.Bool("initdb", false, "initialize bot database") initdb = flag.Bool("initdb", false, "initialize bot database")
githash string githash string
buildstamp time.Time buildstamp string
db *sql.DB db *sql.DB
bot *tb.Bot bot *tb.Bot