mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
restructure imported packages into pkg
This commit is contained in:
parent
9b9cb5e1df
commit
cc6e6b5fc1
10 changed files with 23 additions and 19 deletions
|
@ -4,7 +4,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/gempir/go-twitch-irc/v4"
|
||||
"github.com/lyx0/nourybot/internal/ivr"
|
||||
"github.com/lyx0/nourybot/pkg/ivr"
|
||||
)
|
||||
|
||||
// AddChannel takes in a channel name, then calls GetIdByLogin for the
|
||||
|
|
|
@ -6,7 +6,9 @@ import (
|
|||
"github.com/gempir/go-twitch-irc/v4"
|
||||
"github.com/lyx0/nourybot/internal/commands"
|
||||
"github.com/lyx0/nourybot/internal/common"
|
||||
"github.com/lyx0/nourybot/internal/ivr"
|
||||
"github.com/lyx0/nourybot/pkg/ivr"
|
||||
"github.com/lyx0/nourybot/pkg/lastfm"
|
||||
"github.com/lyx0/nourybot/pkg/owm"
|
||||
)
|
||||
|
||||
// handleCommand takes in a twitch.PrivateMessage and then routes the message to
|
||||
|
@ -129,7 +131,7 @@ func (app *application) handleCommand(message twitch.PrivateMessage) {
|
|||
} else {
|
||||
// Default to first argument supplied being the name
|
||||
// of the user to look up recently played.
|
||||
reply = commands.LastFmUserRecent(target, cmdParams[1])
|
||||
reply = lastfm.LastFmUserRecent(target, cmdParams[1])
|
||||
}
|
||||
|
||||
case "help":
|
||||
|
@ -157,7 +159,7 @@ func (app *application) handleCommand(message twitch.PrivateMessage) {
|
|||
} else if msgLen < 2 {
|
||||
reply = "Not enough arguments provided."
|
||||
} else {
|
||||
reply, _ = commands.Weather(message.Message[10:len(message.Message)])
|
||||
reply, _ = owm.Weather(message.Message[10:len(message.Message)])
|
||||
}
|
||||
|
||||
case "rxkcd":
|
||||
|
|
|
@ -5,7 +5,8 @@ import (
|
|||
"strconv"
|
||||
|
||||
"github.com/gempir/go-twitch-irc/v4"
|
||||
"github.com/lyx0/nourybot/internal/commands"
|
||||
"github.com/lyx0/nourybot/pkg/lastfm"
|
||||
"github.com/lyx0/nourybot/pkg/owm"
|
||||
)
|
||||
|
||||
// AddUser calls GetIdByLogin to get the twitch id of the login name and then adds
|
||||
|
@ -161,7 +162,7 @@ func (app *application) UserCheckWeather(message twitch.PrivateMessage) {
|
|||
return
|
||||
}
|
||||
|
||||
reply, _ := commands.Weather(location)
|
||||
reply, _ := owm.Weather(location)
|
||||
app.Send(target, reply, message)
|
||||
}
|
||||
|
||||
|
@ -178,6 +179,6 @@ func (app *application) UserCheckLastFM(message twitch.PrivateMessage) string {
|
|||
return reply
|
||||
}
|
||||
|
||||
reply := commands.LastFmUserRecent(target, lastfmUser)
|
||||
reply := lastfm.LastFmUserRecent(target, lastfmUser)
|
||||
return reply
|
||||
}
|
||||
|
|
5
go.mod
5
go.mod
|
@ -7,6 +7,7 @@ require (
|
|||
github.com/google/uuid v1.3.1
|
||||
github.com/jakecoffman/cron v0.0.0-20190106200828-7e2009c226a5
|
||||
github.com/lib/pq v1.10.9
|
||||
github.com/nicklaw5/helix/v2 v2.25.1
|
||||
github.com/rs/zerolog v1.29.1
|
||||
github.com/shkh/lastfm-go v0.0.0-20191215035245-89a801c244e0
|
||||
github.com/wader/goutubedl v0.0.0-20230924165737-427b7fa536e6
|
||||
|
@ -16,7 +17,6 @@ require (
|
|||
|
||||
require (
|
||||
github.com/golang-jwt/jwt/v4 v4.0.0 // indirect
|
||||
github.com/nicklaw5/helix/v2 v2.25.1 // indirect
|
||||
go.uber.org/atomic v1.7.0 // indirect
|
||||
go.uber.org/multierr v1.6.0 // indirect
|
||||
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
|
||||
|
@ -25,9 +25,8 @@ require (
|
|||
require (
|
||||
github.com/briandowns/openweathermap v0.19.0
|
||||
github.com/dustin/go-humanize v1.0.1
|
||||
github.com/golang-jwt/jwt v3.2.1+incompatible // indirect
|
||||
github.com/joho/godotenv v1.5.1
|
||||
github.com/mattn/go-colorable v0.1.12 // indirect
|
||||
github.com/mattn/go-isatty v0.0.14 // indirect
|
||||
golang.org/x/sys v0.8.0 // indirect
|
||||
golang.org/x/sys v0.11.0 // indirect
|
||||
)
|
||||
|
|
8
go.sum
8
go.sum
|
@ -12,8 +12,6 @@ github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHqu
|
|||
github.com/gempir/go-twitch-irc/v4 v4.0.0 h1:sHVIvbWOv9nHXGEErilclxASv0AaQEr/r/f9C0B9aO8=
|
||||
github.com/gempir/go-twitch-irc/v4 v4.0.0/go.mod h1:QsOMMAk470uxQ7EYD9GJBGAVqM/jDrXBNbuePfTauzg=
|
||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c=
|
||||
github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
|
||||
github.com/golang-jwt/jwt/v4 v4.0.0 h1:RAqyYixv1p7uEnocuy8P1nru5wprCh/MH2BIlW5z5/o=
|
||||
github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
|
||||
github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
|
||||
|
@ -28,8 +26,6 @@ github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZb
|
|||
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
|
||||
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
|
||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||
github.com/nicklaw5/helix v1.25.0 h1:Mrz537izZVsGdM3I46uGAAlslj61frgkhS/9xQqyT/M=
|
||||
github.com/nicklaw5/helix v1.25.0/go.mod h1:yvXZFapT6afIoxnAvlWiJiUMsYnoHl7tNs+t0bloAMw=
|
||||
github.com/nicklaw5/helix/v2 v2.25.1 h1:hccFfWf1kdPKeC/Zp8jNbOvqV0f6ya12hdeNHuQa5wg=
|
||||
github.com/nicklaw5/helix/v2 v2.25.1/go.mod h1:zZcKsyyBWDli34x3QleYsVMiiNGMXPAEU5NjsiZDtvY=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
|
@ -57,8 +53,8 @@ go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
|
|||
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
|
||||
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk=
|
||||
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk=
|
||||
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df h1:n7WqCuqOuCbNr617RXOY0AWRXxgwEyPp2z+p0+hgMuE=
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/lyx0/nourybot/internal/common"
|
||||
"github.com/lyx0/nourybot/internal/humanize"
|
||||
"github.com/lyx0/nourybot/pkg/humanize"
|
||||
)
|
||||
|
||||
func Ping() string {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package lastfm
|
||||
|
||||
import (
|
||||
"fmt"
|
|
@ -1,6 +1,7 @@
|
|||
package commands
|
||||
package owm
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
|
@ -8,6 +9,11 @@ import (
|
|||
"github.com/joho/godotenv"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrInternalServerError = errors.New("internal server error")
|
||||
ErrWeatherLocationNotFound = errors.New("location not found")
|
||||
)
|
||||
|
||||
// Weather queries the OpenWeatherMap Api for the given location and sends the
|
||||
// current weather response to the target twitch chat.
|
||||
func Weather(location string) (string, error) {
|
Loading…
Reference in a new issue