format /uptime output with go-humanize

This commit is contained in:
Greg Wedow 2016-08-21 10:48:42 -04:00
parent d2f08490f7
commit eec1cbc26f

View File

@ -8,6 +8,7 @@ import (
"sync"
"time"
"github.com/dustin/go-humanize"
"github.com/shazow/rateio"
"github.com/shazow/ssh-chat/chat"
"github.com/shazow/ssh-chat/chat/message"
@ -365,7 +366,7 @@ func (h *Host) InitCommands(c *chat.Commands) {
c.Add(chat.Command{
Prefix: "/uptime",
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
},
})