add my old humanize package

This commit is contained in:
lyx0 2021-10-14 02:27:01 +02:00
parent c3ec7a6fd3
commit 657417a80d
4 changed files with 17 additions and 0 deletions

View file

@ -26,6 +26,7 @@ func NewBot(cfg *cfg.Config) *Bot {
func (b *Bot) Connect() error {
log.Info("fn Connect")
cfg := cfg.LoadConfig()
b.twitchClient.OnPrivateMessage(func(message twitch.PrivateMessage) {
handlers.HandlePrivateMessage(message, b.twitchClient, cfg)
})

1
go.mod
View file

@ -3,6 +3,7 @@ module github.com/lyx0/nourybot
go 1.17
require (
github.com/dustin/go-humanize v1.0.0
github.com/gempir/go-twitch-irc/v2 v2.5.0
github.com/joho/godotenv v1.4.0
github.com/sirupsen/logrus v1.8.1

2
go.sum
View file

@ -1,5 +1,7 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/gempir/go-twitch-irc/v2 v2.5.0 h1:aybXNoyDNQaa4vHhXb0UpIDmspqutQUmXIYUFsjgecU=
github.com/gempir/go-twitch-irc/v2 v2.5.0/go.mod h1:120d2SdlRYg8tRnZwsyNPeS+mWPn+YmNEzB7Bv/CDGE=
github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=

13
pkg/humanize/time.go Normal file
View file

@ -0,0 +1,13 @@
package humanize
import (
"time"
"github.com/dustin/go-humanize"
)
// HumanizeTime returns a more human readable
// time as a string for a given time.Time
func HumanizeTime(t time.Time) string {
return humanize.Time(t)
}