From 9377bcf897aa43b25b769b4c05a577b1d7e52f76 Mon Sep 17 00:00:00 2001 From: lyx0 <66651385+lyx0@users.noreply.github.com> Date: Tue, 20 Feb 2024 22:36:33 +0100 Subject: [PATCH] refactor --- cmd/nourybot/commands.go | 6 +++--- cmd/nourybot/main.go | 2 +- cmd/nourybot/router.go | 2 +- {internal => pkg}/commands/bttv.go | 0 {internal => pkg}/commands/coinflip.go | 2 +- {internal => pkg}/commands/currency.go | 0 {internal => pkg}/commands/duckduckgo.go | 0 {internal => pkg}/commands/errors.go | 0 {internal => pkg}/commands/ffz.go | 0 {internal => pkg}/commands/godocs.go | 0 {internal => pkg}/commands/google.go | 0 {internal => pkg}/commands/osrs.go | 0 {internal => pkg}/commands/phonetic.go | 0 {internal => pkg}/commands/ping.go | 2 +- {internal => pkg}/commands/preview.go | 2 +- {internal => pkg}/commands/seventv.go | 0 {internal => pkg}/commands/wolframalpha.go | 0 {internal => pkg}/commands/xkcd.go | 2 +- {internal => pkg}/commands/youtube.go | 0 {internal => pkg}/common/counter.go | 0 {internal => pkg}/common/random.go | 0 {internal => pkg}/common/uptime.go | 0 {internal => pkg}/common/version.go | 0 23 files changed, 9 insertions(+), 9 deletions(-) rename {internal => pkg}/commands/bttv.go (100%) rename {internal => pkg}/commands/coinflip.go (84%) rename {internal => pkg}/commands/currency.go (100%) rename {internal => pkg}/commands/duckduckgo.go (100%) rename {internal => pkg}/commands/errors.go (100%) rename {internal => pkg}/commands/ffz.go (100%) rename {internal => pkg}/commands/godocs.go (100%) rename {internal => pkg}/commands/google.go (100%) rename {internal => pkg}/commands/osrs.go (100%) rename {internal => pkg}/commands/phonetic.go (100%) rename {internal => pkg}/commands/ping.go (89%) rename {internal => pkg}/commands/preview.go (88%) rename {internal => pkg}/commands/seventv.go (100%) rename {internal => pkg}/commands/wolframalpha.go (100%) rename {internal => pkg}/commands/xkcd.go (96%) rename {internal => pkg}/commands/youtube.go (100%) rename {internal => pkg}/common/counter.go (100%) rename {internal => pkg}/common/random.go (100%) rename {internal => pkg}/common/uptime.go (100%) rename {internal => pkg}/common/version.go (100%) diff --git a/cmd/nourybot/commands.go b/cmd/nourybot/commands.go index 73f3ee6..353066e 100644 --- a/cmd/nourybot/commands.go +++ b/cmd/nourybot/commands.go @@ -6,8 +6,8 @@ import ( "strings" "github.com/gempir/go-twitch-irc/v4" - "github.com/lyx0/nourybot/internal/commands" - "github.com/lyx0/nourybot/internal/common" + "github.com/lyx0/nourybot/pkg/commands" + "github.com/lyx0/nourybot/pkg/common" "github.com/lyx0/nourybot/pkg/ivr" "github.com/lyx0/nourybot/pkg/lastfm" "github.com/lyx0/nourybot/pkg/owm" @@ -99,11 +99,11 @@ func (app *application) handleCommand(message twitch.PrivateMessage) { case "cf": reply = commands.Coinflip() - // ()currency to case "currency": if msgLen < 4 { reply = "Not enough arguments provided. Usage: ()currency 10 USD to EUR" } else { + // ()currency to reply, _ = commands.Currency(cmdParams[1], cmdParams[2], cmdParams[4]) } diff --git a/cmd/nourybot/main.go b/cmd/nourybot/main.go index d5feef1..117de58 100644 --- a/cmd/nourybot/main.go +++ b/cmd/nourybot/main.go @@ -13,8 +13,8 @@ import ( "github.com/jakecoffman/cron" "github.com/joho/godotenv" _ "github.com/lib/pq" - "github.com/lyx0/nourybot/internal/common" "github.com/lyx0/nourybot/internal/data" + "github.com/lyx0/nourybot/pkg/common" "github.com/nicklaw5/helix/v2" "go.uber.org/zap" diff --git a/cmd/nourybot/router.go b/cmd/nourybot/router.go index a46cafb..d2f2054 100644 --- a/cmd/nourybot/router.go +++ b/cmd/nourybot/router.go @@ -12,8 +12,8 @@ import ( "sort" "github.com/julienschmidt/httprouter" - "github.com/lyx0/nourybot/internal/common" "github.com/lyx0/nourybot/internal/data" + "github.com/lyx0/nourybot/pkg/common" "github.com/lyx0/nourybot/pkg/ivr" "github.com/nicklaw5/helix/v2" ) diff --git a/internal/commands/bttv.go b/pkg/commands/bttv.go similarity index 100% rename from internal/commands/bttv.go rename to pkg/commands/bttv.go diff --git a/internal/commands/coinflip.go b/pkg/commands/coinflip.go similarity index 84% rename from internal/commands/coinflip.go rename to pkg/commands/coinflip.go index 2765120..f951a02 100644 --- a/internal/commands/coinflip.go +++ b/pkg/commands/coinflip.go @@ -1,7 +1,7 @@ package commands import ( - "github.com/lyx0/nourybot/internal/common" + "github.com/lyx0/nourybot/pkg/common" ) func Coinflip() string { diff --git a/internal/commands/currency.go b/pkg/commands/currency.go similarity index 100% rename from internal/commands/currency.go rename to pkg/commands/currency.go diff --git a/internal/commands/duckduckgo.go b/pkg/commands/duckduckgo.go similarity index 100% rename from internal/commands/duckduckgo.go rename to pkg/commands/duckduckgo.go diff --git a/internal/commands/errors.go b/pkg/commands/errors.go similarity index 100% rename from internal/commands/errors.go rename to pkg/commands/errors.go diff --git a/internal/commands/ffz.go b/pkg/commands/ffz.go similarity index 100% rename from internal/commands/ffz.go rename to pkg/commands/ffz.go diff --git a/internal/commands/godocs.go b/pkg/commands/godocs.go similarity index 100% rename from internal/commands/godocs.go rename to pkg/commands/godocs.go diff --git a/internal/commands/google.go b/pkg/commands/google.go similarity index 100% rename from internal/commands/google.go rename to pkg/commands/google.go diff --git a/internal/commands/osrs.go b/pkg/commands/osrs.go similarity index 100% rename from internal/commands/osrs.go rename to pkg/commands/osrs.go diff --git a/internal/commands/phonetic.go b/pkg/commands/phonetic.go similarity index 100% rename from internal/commands/phonetic.go rename to pkg/commands/phonetic.go diff --git a/internal/commands/ping.go b/pkg/commands/ping.go similarity index 89% rename from internal/commands/ping.go rename to pkg/commands/ping.go index 64dd4c1..619790c 100644 --- a/internal/commands/ping.go +++ b/pkg/commands/ping.go @@ -3,7 +3,7 @@ package commands import ( "fmt" - "github.com/lyx0/nourybot/internal/common" + "github.com/lyx0/nourybot/pkg/common" "github.com/lyx0/nourybot/pkg/humanize" ) diff --git a/internal/commands/preview.go b/pkg/commands/preview.go similarity index 88% rename from internal/commands/preview.go rename to pkg/commands/preview.go index cc25158..a4483b2 100644 --- a/internal/commands/preview.go +++ b/pkg/commands/preview.go @@ -3,7 +3,7 @@ package commands import ( "fmt" - "github.com/lyx0/nourybot/internal/common" + "github.com/lyx0/nourybot/pkg/common" ) func Preview(channel string) string { diff --git a/internal/commands/seventv.go b/pkg/commands/seventv.go similarity index 100% rename from internal/commands/seventv.go rename to pkg/commands/seventv.go diff --git a/internal/commands/wolframalpha.go b/pkg/commands/wolframalpha.go similarity index 100% rename from internal/commands/wolframalpha.go rename to pkg/commands/wolframalpha.go diff --git a/internal/commands/xkcd.go b/pkg/commands/xkcd.go similarity index 96% rename from internal/commands/xkcd.go rename to pkg/commands/xkcd.go index 0e518f3..3d2d070 100644 --- a/internal/commands/xkcd.go +++ b/pkg/commands/xkcd.go @@ -6,7 +6,7 @@ import ( "io" "net/http" - "github.com/lyx0/nourybot/internal/common" + "github.com/lyx0/nourybot/pkg/common" ) type xkcdResponse struct { diff --git a/internal/commands/youtube.go b/pkg/commands/youtube.go similarity index 100% rename from internal/commands/youtube.go rename to pkg/commands/youtube.go diff --git a/internal/common/counter.go b/pkg/common/counter.go similarity index 100% rename from internal/common/counter.go rename to pkg/common/counter.go diff --git a/internal/common/random.go b/pkg/common/random.go similarity index 100% rename from internal/common/random.go rename to pkg/common/random.go diff --git a/internal/common/uptime.go b/pkg/common/uptime.go similarity index 100% rename from internal/common/uptime.go rename to pkg/common/uptime.go diff --git a/internal/common/version.go b/pkg/common/version.go similarity index 100% rename from internal/common/version.go rename to pkg/common/version.go