From 96db61831cc1af8294a8ba02b8186c9bb9f6a190 Mon Sep 17 00:00:00 2001 From: Noah Theus Date: Sun, 22 Dec 2024 03:52:10 +0100 Subject: [PATCH 1/8] add cross-compile --- .github/workflows/docker-on-push.yml | 5 +---- Dockerfile | 11 +++++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-on-push.yml b/.github/workflows/docker-on-push.yml index 57d2c42..8e5a593 100644 --- a/.github/workflows/docker-on-push.yml +++ b/.github/workflows/docker-on-push.yml @@ -12,9 +12,6 @@ jobs: - name: Check out the repo uses: actions/checkout@v3 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -29,7 +26,7 @@ jobs: - name: Build and push uses: docker/build-push-action@v6 with: - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7 push: true tags: | ghcr.io/${{ github.repository }}:master diff --git a/Dockerfile b/Dockerfile index 0a744a3..6259e3a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,15 @@ -FROM golang:alpine AS builder +FROM --platform=$BUILDPLATFORM golang:1.23.4-alpine AS builder WORKDIR /steamsalty RUN apk update && apk add --no-cache ca-certificates -COPY . . +COPY go.mod go.sum ./ RUN go mod download -RUN go build -o /app/steamsalty + +COPY . . +ARG TARGETOS TARGETARCH +RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /app/steamsalty @@ -18,4 +21,4 @@ COPY --from=builder /usr/share/ca-certificates /usr/share/ca-certificates COPY --from=builder /app/steamsalty /app/steamsalty -ENTRYPOINT ["/app/steamsalty"] \ No newline at end of file +ENTRYPOINT ["/app/steamsalty"] From 877852aa67541b559099a199f1a5eb0900b6a57c Mon Sep 17 00:00:00 2001 From: Noah Theus Date: Sun, 22 Dec 2024 04:06:08 +0100 Subject: [PATCH 2/8] Change from ghcr to dockerhub --- .github/workflows/docker-on-push.yml | 14 ++++---------- docker-compose.yaml | 2 +- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/.github/workflows/docker-on-push.yml b/.github/workflows/docker-on-push.yml index 8e5a593..928f14b 100644 --- a/.github/workflows/docker-on-push.yml +++ b/.github/workflows/docker-on-push.yml @@ -2,8 +2,6 @@ name: Build and Push to Docker Hub on changes to master branch on: push: - branches: - - master jobs: docker: @@ -18,10 +16,8 @@ jobs: - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: - registry: ghcr.io - username: ${{github.actor}} - password: ${{secrets.GHCR_TOKEN}} # needs read:packages, write:packages. delete:packages - + username: ${{secrets.DOCKERHUB_USERNAME}} + password: ${{secrets.DOCKERHUB_TOKEN}} - name: Build and push uses: docker/build-push-action@v6 @@ -29,7 +25,5 @@ jobs: platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7 push: true tags: | - ghcr.io/${{ github.repository }}:master - ghcr.io/${{ github.repository }}:commit-${{ github.sha }} - - + ${{ github.repository }}:${{ github.ref_name }} + ${{ github.repository }}:commit-${{ github.sha }} \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index e3906bc..a782b61 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,6 +1,6 @@ services: steamsalty: - image: ghcr.io/watn3y/steamsalty:master + image: watn3y/steamsalty:master container_name: steamsalty restart: unless-stopped volumes: From c800be186ff8835afeea7d2b14041bfd11da9f96 Mon Sep 17 00:00:00 2001 From: Noah Theus Date: Sun, 22 Dec 2024 04:08:03 +0100 Subject: [PATCH 3/8] fix typos --- .github/workflows/docker-on-push.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-on-push.yml b/.github/workflows/docker-on-push.yml index 928f14b..40d6edc 100644 --- a/.github/workflows/docker-on-push.yml +++ b/.github/workflows/docker-on-push.yml @@ -1,8 +1,11 @@ -name: Build and Push to Docker Hub on changes to master branch +name: Build and Push to Docker Hub on push to any branch on: push: - + paths: + - '**.go' + - 'go.mod' + - 'go.sum' jobs: docker: runs-on: ubuntu-latest @@ -13,7 +16,7 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Login to GitHub Container Registry + - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{secrets.DOCKERHUB_USERNAME}} From eb0482b8e02ce7151b6b2e6c6bb726861be9ad0a Mon Sep 17 00:00:00 2001 From: Noah Theus Date: Sun, 22 Dec 2024 04:13:37 +0100 Subject: [PATCH 4/8] Build when Dockerfile changes --- .github/workflows/docker-on-push.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/docker-on-push.yml b/.github/workflows/docker-on-push.yml index 40d6edc..34adc4b 100644 --- a/.github/workflows/docker-on-push.yml +++ b/.github/workflows/docker-on-push.yml @@ -6,6 +6,8 @@ on: - '**.go' - 'go.mod' - 'go.sum' + - 'Dockerfile' + - '.github/workflows/**' jobs: docker: runs-on: ubuntu-latest From 6be403fc5874dced53d78fca1bdaa28b10f3d3dd Mon Sep 17 00:00:00 2001 From: Noah Theus Date: Sun, 22 Dec 2024 07:13:19 +0100 Subject: [PATCH 5/8] v1.0 - Fixed SLEEPTIME not working (always 0) - Refined logging - Added metadata to /info command - Bot now automatically sets own commands for autocompletion --- .../{docker-on-push.yml => on-push.yml} | 2 +- .gitignore | 3 ++ Dockerfile | 4 +- README.md | 42 ++++++++++++++++++- bot.go | 2 + botIO/authenticate.go | 7 +++- commands/commands.go | 37 +++++++++++++--- config/config.go | 8 ++-- config/types.go | 12 +++--- docker-compose.yaml | 14 ------- main.go | 22 ++++++---- steam/api.go | 2 +- steam/http.go | 6 +-- steam/profile.go | 8 ++-- 14 files changed, 116 insertions(+), 53 deletions(-) rename .github/workflows/{docker-on-push.yml => on-push.yml} (97%) delete mode 100644 docker-compose.yaml diff --git a/.github/workflows/docker-on-push.yml b/.github/workflows/on-push.yml similarity index 97% rename from .github/workflows/docker-on-push.yml rename to .github/workflows/on-push.yml index 34adc4b..cd0ef2e 100644 --- a/.github/workflows/docker-on-push.yml +++ b/.github/workflows/on-push.yml @@ -27,7 +27,7 @@ jobs: - name: Build and push uses: docker/build-push-action@v6 with: - platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7 + platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/riscv64 push: true tags: | ${{ github.repository }}:${{ github.ref_name }} diff --git a/.gitignore b/.gitignore index 6f72f89..3d428ed 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,6 @@ go.work.sum # env file .env + +# Build ouput +build/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 6259e3a..e28b370 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ RUN go mod download COPY . . ARG TARGETOS TARGETARCH -RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /app/steamsalty +RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o ./steamsalty @@ -19,6 +19,6 @@ WORKDIR /app COPY --from=builder /etc/ssl/certs /etc/ssl/certs COPY --from=builder /usr/share/ca-certificates /usr/share/ca-certificates -COPY --from=builder /app/steamsalty /app/steamsalty +COPY --from=builder /steamsalty/steamsalty /app/steamsalty ENTRYPOINT ["/app/steamsalty"] diff --git a/README.md b/README.md index 383a233..54840c9 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,40 @@ -# steamsalty -Get notifications about Steam Comments on Telegram +# SteamSalty +SteamSalty notifies you on telegram about new comments on any steam profile. + +## Running with Docker Compose + +Docker image: https://hub.docker.com/r/watn3y/steamsalty + +Example compose file: + +```yaml +services: + steamsalty: + image: watn3y/steamsalty:latest # use : to be up-to-date with any branch + container_name: steamsalty + restart: unless-stopped + volumes: + - /etc/localtime:/etc/localtime:ro + environment: + #- STEAMSALTY_LOGLEVEL= + - STEAMSALTY_TELEGRAMAPITOKEN= + - STEAMSALTY_STEAMAPIKEY= + - STEAMSALTY_CHATID= + - STEAMSALTY_WATCHERS= + #- STEAMSALTY_SLEEPINTERVAL= +``` + +## Running on Linux + +Grab a release from the [releases page](https://github.com/watn3y/steamsalty/releases). Make sure to set your **environment variables** accordingly. + +## Environment Variables + +| Variable | Description | Default | +| ----------------------------- | -------------------------------------------------------------------------------------------------------------------- | ------------------ | +| `STEAMSALTY_LOGLEVEL` | LogLevel as described [here](https://pkg.go.dev/github.com/rs/zerolog@v1.33.0#readme-simple-leveled-logging-example) | 1 (Info) | +| `STEAMSALTY_TELEGRAMAPITOKEN` | Telegram Bot Token, get from @BotFather | None, **required** | +| `STEAMSALTY_STEAMAPIKEY` | Steam API Key, get from https://steamcommunity.com/dev/apikey | None, **required** | +| `STEAMSALTY_CHATID` | Chat to notify about new Comments | None, **required** | +| `STEAMSALTY_WATCHERS` | SteamIDs (in SteamID64 format) to check for new Profile Comments | None, **required** | +| `STEAMSALTY_SLEEPINTERVAL` | Amount of time to wait between requests to Steam in seconds | 60 | diff --git a/bot.go b/bot.go index 2f57968..66eaa36 100644 --- a/bot.go +++ b/bot.go @@ -13,6 +13,8 @@ import ( func bot() { updates, bot := botIO.Authenticate() + go commands.SetBotCommands(bot) + go steam.StartWatchers(bot) for update := range updates { diff --git a/botIO/authenticate.go b/botIO/authenticate.go index 64f5d13..747f8b6 100644 --- a/botIO/authenticate.go +++ b/botIO/authenticate.go @@ -12,12 +12,15 @@ func Authenticate() (tgbotapi.UpdatesChannel, *tgbotapi.BotAPI) { log.Panic().Err(err).Msg("Failed to authenticate") } - bot.Debug = config.BotConfig.DebugMode + bot.Debug = false + if config.BotConfig.LogLevel == -1 { + bot.Debug = true + } updates := tgbotapi.NewUpdate(0) updates.Timeout = 60 - log.Info().Int64("ID", bot.Self.ID).Str("username", bot.Self.UserName).Msg("Successfully authenticated to Telegram API") + log.Info().Int64("ID", bot.Self.ID).Str("username", bot.Self.UserName).Msg("Authenticated to Telegram API") return bot.GetUpdatesChan(updates), bot diff --git a/commands/commands.go b/commands/commands.go index 70fe4b4..2291e6d 100644 --- a/commands/commands.go +++ b/commands/commands.go @@ -2,7 +2,10 @@ package commands import ( "fmt" + "strconv" "strings" + "time" + "watn3y/steamsalty/botIO" "watn3y/steamsalty/config" "watn3y/steamsalty/steam" @@ -11,26 +14,41 @@ import ( "github.com/rs/zerolog/log" ) +func SetBotCommands(bot *tgbotapi.BotAPI) { + github := tgbotapi.BotCommand{Command: "github", Description: "Source GitHub repo"} + info := tgbotapi.BotCommand{Command: "info", Description: "Summary of watched profiles"} + + commands := tgbotapi.NewSetMyCommands(github, info) + + result, err := bot.Request(commands) + if err != nil { + log.Error().Err(err).Msg("Failed to set own commands") + return + } + + log.Debug().Interface("commands", result).Msg("Set own commands") +} + func Commands(update tgbotapi.Update, bot *tgbotapi.BotAPI) { cmd := strings.ToLower(update.Message.Command()) - log.Debug().Str("cmd", cmd).Msg("Matching command") - switch cmd { case "start": - start(update, bot) + startGithub(update, bot) + case "github": + startGithub(update, bot) case "info": info(update, bot) } } -func start(update tgbotapi.Update, bot *tgbotapi.BotAPI) { +func startGithub(update tgbotapi.Update, bot *tgbotapi.BotAPI) { message := tgbotapi.MessageConfig{ BaseChat: tgbotapi.BaseChat{ChatID: update.Message.Chat.ID, ReplyToMessageID: update.Message.MessageID}, ParseMode: "html", DisableWebPagePreview: false, - Text: "https://github.com/watn3y/steamsalty", + Text: "Check out: https://github.com/watn3y/steamsalty", } botIO.SendMessage(message, bot) } @@ -44,9 +62,16 @@ func info(update tgbotapi.Update, bot *tgbotapi.BotAPI) { for _, steamID := range config.BotConfig.Watchers { profile := steam.GetPlayerDetails(steamID) + comments := steam.GetComments(steamID, 0, 0) - textInfo += fmt.Sprintf(`- %s`, profile.ProfileURL, profile.PersonaName) + "\n" + lastComment := "never :(" + if comments.TimeLastPost > 0 { + lastComment = time.Unix(comments.TimeLastPost, 0).Format(time.RFC1123) + } + textInfo += fmt.Sprintf(`%s:`, profile.ProfileURL, profile.PersonaName) + "\n" + + fmt.Sprintf(`Last Comment: %s`, lastComment) + "\n" + + fmt.Sprintf(`Number of Comments: %s`, strconv.Itoa(comments.TotalCount)) + "\n\n" } message := tgbotapi.MessageConfig{ diff --git a/config/config.go b/config/config.go index 1d8ce2e..53e9257 100644 --- a/config/config.go +++ b/config/config.go @@ -2,6 +2,7 @@ package config import ( "context" + "github.com/rs/zerolog" "github.com/rs/zerolog/log" envconfig "github.com/sethvargo/go-envconfig" @@ -11,12 +12,9 @@ var BotConfig config func LoadConfig() { if err := envconfig.Process(context.Background(), &BotConfig); err != nil { - log.Panic().Err(err).Msg("error parsing config from env variables") - } - - if !BotConfig.DebugMode { - zerolog.SetGlobalLevel(zerolog.InfoLevel) + log.Panic().Err(err).Msg("Error parsing config from env variables") } + zerolog.SetGlobalLevel(zerolog.Level(BotConfig.LogLevel)) log.Info().Msg("Loaded config") log.Debug().Interface("config", BotConfig).Msg("") diff --git a/config/types.go b/config/types.go index 5abf464..63f916b 100644 --- a/config/types.go +++ b/config/types.go @@ -1,10 +1,10 @@ package config type config struct { - TelegramAPIToken string `env:"TELEGRAMAPITOKEN, required"` - SteamAPIKey string `env:"STEAMAPIKEY, required"` - DebugMode bool `env:"DEBUGMODE, default=false"` - ChatID int64 `env:"CHATID"` - Watchers []uint64 `env:"WATCHERS"` - SleepInterval int `env:"SLEEPINTERVAL"` + LogLevel int `env:"STEAMSALTY_LOGLEVEL, default=1"` + TelegramAPIToken string `env:"STEAMSALTY_TELEGRAMAPITOKEN, required"` + SteamAPIKey string `env:"STEAMSALTY_STEAMAPIKEY, required"` + ChatID int64 `env:"STEAMSALTY_CHATID, required"` + Watchers []uint64 `env:"STEAMSALTY_WATCHERS, required"` + SleepInterval int `env:"STEAMSALTY_SLEEPINTERVAL, default=60"` } diff --git a/docker-compose.yaml b/docker-compose.yaml deleted file mode 100644 index a782b61..0000000 --- a/docker-compose.yaml +++ /dev/null @@ -1,14 +0,0 @@ -services: - steamsalty: - image: watn3y/steamsalty:master - container_name: steamsalty - restart: unless-stopped - volumes: - - /etc/localtime:/etc/localtime:ro - environment: - - TELEGRAMAPITOKEN= - - STEAMAPIKEY= - - DebugMode=false - - CHATID=123 - - WATCHERS=123,456,789 - - SLEEPINTERVAL=60 \ No newline at end of file diff --git a/main.go b/main.go index 5b52270..fcc9cfb 100644 --- a/main.go +++ b/main.go @@ -1,18 +1,19 @@ package main import ( - "fmt" "os" + "strconv" + "strings" "time" "github.com/rs/zerolog" "github.com/rs/zerolog/log" - + "watn3y/steamsalty/config" ) func main() { - fmt.Println("Starting SteamSalty...") + println("Starting SteamSalty...") configureLogger() @@ -23,13 +24,20 @@ func main() { } func configureLogger() { + + zerolog.CallerMarshalFunc = func(pc uintptr, file string, line int) string { + const prefix = "steamsalty/" + + index := strings.Index(file, prefix) + if index != -1 { + return file[index+len(prefix):] + ":" + strconv.Itoa(line) + } + return file + ":" + strconv.Itoa(line) + } + output := zerolog.ConsoleWriter{Out: os.Stdout, TimeFormat: time.DateTime} log.Logger = zerolog.New(output).With().Timestamp().Caller().Logger() - - //! note that we overwrite the loglevel after loading the config in config/config.go. This is just the default - zerolog.SetGlobalLevel(zerolog.TraceLevel) - log.Info().Msg("Started Logger") } diff --git a/steam/api.go b/steam/api.go index e79f8b9..9a41911 100644 --- a/steam/api.go +++ b/steam/api.go @@ -13,6 +13,6 @@ func GetPlayerDetails(steamID uint64) (summary steamapi.PlayerSummary) { if err != nil { log.Error().Err(err).Msg("Failed to get Player Summary") } - log.Debug().Interface("Player", response[0]).Msg("Successfully got PlayerSummary from Steam API") + log.Debug().Interface("Player", response[0]).Msg("Got PlayerSummary from Steam API") return response[0] } diff --git a/steam/http.go b/steam/http.go index 70b0337..2c734fa 100644 --- a/steam/http.go +++ b/steam/http.go @@ -13,7 +13,7 @@ import ( "github.com/rs/zerolog/log" ) -func getComments(steamID uint64, start int, count int) (page CommentsPage) { +func GetComments(steamID uint64, start int, count int) (page CommentsPage) { baseURL := "https://steamcommunity.com/comment/Profile/render/" @@ -47,7 +47,7 @@ func getComments(steamID uint64, start int, count int) (page CommentsPage) { log.Error().Err(err).Msg("Failed to parse Comments as JSON") } - log.Debug().Interface("CommentPage", page).Uint64("ProfileID", steamID).Msg("Successfully got Comment Page") + log.Trace().Interface("CommentPage", page).Uint64("ProfileID", steamID).Msg("Got Comment Page") return page } @@ -85,6 +85,6 @@ func parseComments(rawComments CommentsPage) (comments []Comment) { }) slices.Reverse(comments) - log.Debug().Interface("Comments", comments).Msg("Successfully parsed Comment Page") + log.Trace().Interface("Comments", comments).Msg("Parsed Comment Page") return comments } diff --git a/steam/profile.go b/steam/profile.go index 1154020..ec0b1b0 100644 --- a/steam/profile.go +++ b/steam/profile.go @@ -15,30 +15,30 @@ import ( "github.com/rs/zerolog/log" ) -var sleeptime time.Duration = time.Duration(config.BotConfig.SleepInterval) * time.Second var steamContentCheckText string = "This comment is awaiting analysis by our automated content check system. It will be temporarily hidden until we verify that it does not contain harmful content (e.g. links to websites that attempt to steal information)." func StartWatchers(bot *tgbotapi.BotAPI) { + var wg sync.WaitGroup for _, steamID := range config.BotConfig.Watchers { wg.Add(1) go func(steamID uint64) { defer wg.Done() - watcher(bot, steamID) + watcher(bot, steamID, time.Duration(config.BotConfig.SleepInterval)*time.Second) }(steamID) } wg.Wait() } -func watcher(bot *tgbotapi.BotAPI, steamID uint64) { +func watcher(bot *tgbotapi.BotAPI, steamID uint64, sleeptime time.Duration) { log.Info().Uint64("SteamID", steamID).Msg("Started Watcher") var newestProcessedComment int64 = 0 for { - currentCommentsPage := getComments(steamID, 0, math.MaxInt32) + currentCommentsPage := GetComments(steamID, 0, math.MaxInt32) if newestProcessedComment == 0 || newestProcessedComment == currentCommentsPage.TimeLastPost { newestProcessedComment = currentCommentsPage.TimeLastPost time.Sleep(sleeptime) From a2c4c43eaa553bf1caa316b6b70edf60ca0e4cde Mon Sep 17 00:00:00 2001 From: Noah Theus Date: Sun, 22 Dec 2024 07:41:48 +0100 Subject: [PATCH 6/8] add build script --- build.sh | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 build.sh diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..49d6e91 --- /dev/null +++ b/build.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + + +# Get the current directory name as the project name +PROJECT_NAME=$(basename "$PWD") + +# Change to the Go project directory (current directory) +cd "$PWD" || exit + +# List of target architectures +architectures=( + "linux/amd64" + "linux/386" + "linux/arm64" + "linux/arm/v7" + "linux/riscv64" + "windows/amd64" + "darwin/amd64" + "darwin/arm64" +) + +# Create a build directory if it doesn't exist +mkdir -p build + +# Loop over architectures and build for each one +for arch in "${architectures[@]}"; do + os=$(echo $arch | cut -d '/' -f 1) + arch_type=$(echo $arch | cut -d '/' -f 2) + + # Set the output file name using the project name, os, and arch + output_file="build/$PROJECT_NAME-$os-$arch_type" + + # Build the app for the specific architecture + GOARCH=$arch_type GOOS=$os go build -o "$output_file" + + # Provide feedback to the user + if [ $? -eq 0 ]; then + echo "Successfully built for $arch: $output_file" + + # Create a tar.gz archive for the individual build + tar -czf "$output_file.tar.gz" -C build $(basename "$output_file") + if [ $? -eq 0 ]; then + echo "Successfully created archive: $output_file.tar.gz" + + # Delete the executable after archiving + rm "$output_file" + echo "Deleted executable: $output_file" + else + echo "Failed to create archive for $output_file" + fi + else + echo "Failed to build for $arch" + fi +done \ No newline at end of file From b0d49ab3c4678cd40af02627f42bd4877cbf3cae Mon Sep 17 00:00:00 2001 From: Noah Theus Date: Sun, 22 Dec 2024 08:20:51 +0100 Subject: [PATCH 7/8] gitignore vscode config --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 3d428ed..14beab4 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,7 @@ go.work.sum .env # Build ouput -build/ \ No newline at end of file +build/ + +# vscode config +.vscode/ \ No newline at end of file From b0d68f3a8371ea39aab2dca2bdf4e40b1e05525c Mon Sep 17 00:00:00 2001 From: Noah Theus Date: Sun, 22 Dec 2024 08:21:02 +0100 Subject: [PATCH 8/8] Don't log every received message --- bot.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bot.go b/bot.go index 66eaa36..e2e15b9 100644 --- a/bot.go +++ b/bot.go @@ -29,9 +29,8 @@ func bot() { continue } - log.Info().Int64("ChatID", update.Message.Chat.ID).Int64("UserID", update.Message.From.ID).Str("Text", update.Message.Text).Msg("Recieved Message") - if update.Message.IsCommand() { + log.Info().Int64("ChatID", update.Message.Chat.ID).Int64("UserID", update.Message.From.ID).Str("Text", update.Message.Text).Msg("Received Command") commands.Commands(update, bot) } }