mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-04-15 00:20:37 +03:00
/uptime: Format output to be more human-friendly
This commit is contained in:
parent
87d38405ae
commit
a67a9d115b
3
host.go
3
host.go
@ -8,6 +8,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/dustin/go-humanize"
|
||||||
"github.com/shazow/rateio"
|
"github.com/shazow/rateio"
|
||||||
"github.com/shazow/ssh-chat/chat"
|
"github.com/shazow/ssh-chat/chat"
|
||||||
"github.com/shazow/ssh-chat/chat/message"
|
"github.com/shazow/ssh-chat/chat/message"
|
||||||
@ -365,7 +366,7 @@ func (h *Host) InitCommands(c *chat.Commands) {
|
|||||||
c.Add(chat.Command{
|
c.Add(chat.Command{
|
||||||
Prefix: "/uptime",
|
Prefix: "/uptime",
|
||||||
Handler: func(room *chat.Room, msg message.CommandMsg) error {
|
Handler: func(room *chat.Room, msg message.CommandMsg) error {
|
||||||
room.Send(message.NewSystemMsg(time.Now().Sub(timeStarted).String(), msg.From()))
|
room.Send(message.NewSystemMsg(humanize.Time(timeStarted), msg.From()))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user