diff --git a/cmd/bot/bot.go b/cmd/bot/bot.go index e7ca61b..a6dfc47 100644 --- a/cmd/bot/bot.go +++ b/cmd/bot/bot.go @@ -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) }) diff --git a/go.mod b/go.mod index 5768914..26891c5 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 66b746c..7e91d12 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/pkg/humanize/time.go b/pkg/humanize/time.go new file mode 100644 index 0000000..c6380a3 --- /dev/null +++ b/pkg/humanize/time.go @@ -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) +}