From db81fd9cac548f1077b32f13c29f5367d9fdaad7 Mon Sep 17 00:00:00 2001 From: barbequeorbarbecue <151953193+barbequeorbarbecue@users.noreply.github.com> Date: Sun, 22 Dec 2024 17:15:33 +0300 Subject: [PATCH 1/3] fix(discord-bot): update set-twitch cagetory-filter command description to fix length limit error (#522) --- apps/discord-bot/internal/command/settwitch.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/discord-bot/internal/command/settwitch.go b/apps/discord-bot/internal/command/settwitch.go index 79769d65..a72d1432 100644 --- a/apps/discord-bot/internal/command/settwitch.go +++ b/apps/discord-bot/internal/command/settwitch.go @@ -366,7 +366,7 @@ func SetTwitchCommandMetadata() *discordgo.ApplicationCommand { // set-twitch announcement category-filter { Name: "category-filter", - Description: "Filtering Discord channel-specific Twitch stream category for announcement (case-sensitive). Just Chatting", + Description: "Discord channel-specific Twitch stream category for announcement (case-sensitive). Just Chatting", DescriptionLocalizations: map[discordgo.Locale]string{ discordgo.Turkish: "Discord kanalına özgü yayın duyurularının filtrelenmesi (büyük/küçük harf duyarlı). Just Chatting", }, From ecc099403eeccdea9a1c353973199d96b51258c4 Mon Sep 17 00:00:00 2001 From: barbequeorbarbecue <151953193+barbequeorbarbecue@users.noreply.github.com> Date: Sun, 22 Dec 2024 17:15:48 +0300 Subject: [PATCH 2/3] feat(discord-bot): add missing logs for GuildCreate and GuildDelete handlers (#523) --- apps/discord-bot/internal/handler/guildcreate.go | 4 +++- apps/discord-bot/internal/handler/guilddelete.go | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/discord-bot/internal/handler/guildcreate.go b/apps/discord-bot/internal/handler/guildcreate.go index 6839e34d..4c80275d 100644 --- a/apps/discord-bot/internal/handler/guildcreate.go +++ b/apps/discord-bot/internal/handler/guildcreate.go @@ -11,10 +11,12 @@ import ( func (h *handler) GuildCreate() { ctx := context.Background() h.discordClient.AddHandler(func(s *discordgo.Session, g *discordgo.GuildCreate) { + log.Println("[handler.GuildCreate] Adding the guild `" + g.Name + "` (ID: " + g.ID + ") to the database") err := h.service.AddServerToDB(ctx, g.ID, g.Name, g.OwnerID) if err != nil { - log.Println("[GuildCreate] AddServerToDB error:", err.Error()) + log.Println("[handler.GuildCreate] AddServerToDB error:", err.Error()) } + log.Println("[handler.GuildCreate] Initiate Twitch live streaming checks for the guild `" + g.Name + "` (ID: " + g.ID + ")") streamer.StartCheckLiveStreams(s, ctx, h.service, g.ID) }) } diff --git a/apps/discord-bot/internal/handler/guilddelete.go b/apps/discord-bot/internal/handler/guilddelete.go index a907c69c..b30d699c 100644 --- a/apps/discord-bot/internal/handler/guilddelete.go +++ b/apps/discord-bot/internal/handler/guilddelete.go @@ -11,15 +11,16 @@ import ( func (h *handler) GuildDelete() { ctx := context.Background() h.discordClient.AddHandler(func(s *discordgo.Session, g *discordgo.GuildDelete) { + log.Println("[handler.GuildDelete] Delete records for the guild `" + g.Name + "` (ID: " + g.ID + ")") err := h.service.DeleteServerFromDB(ctx, g.ID) if err != nil { - log.Println("[GuildDelete] DeleteServerFromDB error:", err.Error()) + log.Println("[handler.GuildDelete] DeleteServerFromDB error:", err.Error()) } streamer.StopCheckLiveStreams(g.ID) streamer.DeleteServerFromData(g.ID) _, err = h.service.DeleteDiscordTwitchLiveAnnosByGuildId(ctx, g.ID) if err != nil { - log.Println("[GuildDelete] DeleteDiscordTwitchLiveAnnosByGuildId error:", err.Error()) + log.Println("[handler.GuildDelete] DeleteDiscordTwitchLiveAnnosByGuildId error:", err.Error()) } }) } From cebe629fcd2777f8b57136a8ea230f0c566b04ff Mon Sep 17 00:00:00 2001 From: barbequeorbarbecue <151953193+barbequeorbarbecue@users.noreply.github.com> Date: Sun, 22 Dec 2024 17:16:27 +0300 Subject: [PATCH 3/3] chore: remove github workflows for test bots (#524) --- .github/workflows/discord-test-bot-deploy.yml | 110 ------------------ .github/workflows/twitch-test-bot-deploy.yml | 108 ----------------- 2 files changed, 218 deletions(-) delete mode 100644 .github/workflows/discord-test-bot-deploy.yml delete mode 100644 .github/workflows/twitch-test-bot-deploy.yml diff --git a/.github/workflows/discord-test-bot-deploy.yml b/.github/workflows/discord-test-bot-deploy.yml deleted file mode 100644 index c7c5737c..00000000 --- a/.github/workflows/discord-test-bot-deploy.yml +++ /dev/null @@ -1,110 +0,0 @@ -name: Deploy Discord Bot Test -on: - push: - paths: - - apps/discord-bot/** - - command/** - - config/** - - db/** - - helper/** - - model/** - - platform/** - - service/** - - "go.mod" - - "go.sum" - branches: - - dev - pull_request: {} - -permissions: - actions: write - contents: read - -env: - REGISTRY: registry.fly.io - MAIN_APP_NAME: senchabot0728dc-cold-flower-2047 - -jobs: - build: - name: Build - # only build/deploy dev branch on pushes - if: ${{ (github.ref == 'refs/heads/dev') && github.event_name == 'push' }} - runs-on: ubuntu-latest - - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.11.0 - - - name: Checkout repo - uses: actions/checkout@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - # Setup cache - - name: Cache Docker layers - uses: actions/cache@v3 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx- - - - name: Fly Registry Auth - uses: docker/login-action@v2 - with: - registry: ${{ env.REGISTRY }} - username: x - password: ${{ secrets.DISCORD_BOT_TEST_FLY_API }} - - - name: Docker build - uses: docker/build-push-action@v3 - with: - context: . - file: ./apps/discord-bot/Dockerfile - push: true - tags: ${{ env.REGISTRY }}/${{ env.MAIN_APP_NAME }}:${{ github.ref_name }}-${{ github.sha }} - build-args: | - COMMIT_SHA=${{ github.sha }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new - - # This ugly bit is necessary if you don't want your cache to grow forever - # till it hits GitHub's limit of 5GB. - # Temp fix - # https://github.com/docker/build-push-action/issues/252 - # https://github.com/moby/buildkit/issues/1896 - - name: Move cache - run: | - rm -rf /tmp/.buildx-cache - mv /tmp/.buildx-cache-new /tmp/.buildx-cache - - deploy: - name: Deploy - runs-on: ubuntu-latest - needs: [build] - # only build/deploy dev branch on pushes - if: ${{ (github.ref == 'refs/heads/dev') && github.event_name == 'push' }} - - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.11.0 - - - name: Checkout repo - uses: actions/checkout@v3 - - - name: Deploy dev - if: ${{ github.ref == 'refs/heads/dev' }} - uses: superfly/flyctl-actions@1.3 - with: - args: "deploy --app ${{ env.MAIN_APP_NAME }} --image ${{ env.REGISTRY }}/${{ env.MAIN_APP_NAME }}:${{ github.ref_name }}-${{ github.sha }} --config ./apps/discord-bot/fly.toml" - env: - FLY_API_TOKEN: ${{ secrets.DISCORD_BOT_TEST_FLY_API }} - - # - name: Deploy Production - # if: ${{ github.ref == 'refs/heads/main' }} - # uses: superfly/flyctl-actions@1.3 - # with: - # args: "deploy --image ${{ env.REGISTRY }}/${{ steps.app_name.outputs.value }}:${{ github.ref_name }}-${{ github.sha }}" - # env: - # FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} diff --git a/.github/workflows/twitch-test-bot-deploy.yml b/.github/workflows/twitch-test-bot-deploy.yml deleted file mode 100644 index 9271c0d3..00000000 --- a/.github/workflows/twitch-test-bot-deploy.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: Deploy Twitch Bot Test -on: - push: - paths: - - apps/twitch-bot/** - - command/** - - config/** - - db/** - - helper/** - - model/** - - platform/** - - service/** - - "go.mod" - - "go.sum" - branches: - - dev - pull_request: {} - -permissions: - actions: write - contents: read - -env: - REGISTRY: registry.fly.io - MAIN_APP_NAME: senchabot0524tw-dry-dust-1824 - -jobs: - build: - name: Build - # only build/deploy dev branch on pushes - if: ${{ (github.ref == 'refs/heads/dev') && github.event_name == 'push' }} - runs-on: ubuntu-latest - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.11.0 - - - name: Checkout repo - uses: actions/checkout@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Cache Docker layers - uses: actions/cache@v3 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx- - - - name: Fly Registry Auth - uses: docker/login-action@v2 - with: - registry: ${{ env.REGISTRY }} - username: x - password: ${{ secrets.TWITCH_BOT_TEST_FLY_API }} - - - name: Docker build - uses: docker/build-push-action@v3 - with: - context: . - file: ./apps/twitch-bot/Dockerfile - push: true - tags: ${{ env.REGISTRY }}/${{ env.MAIN_APP_NAME }}:${{ github.ref_name }}-${{ github.sha }} - build-args: | - COMMIT_SHA=${{ github.sha }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new - - # This ugly bit is necessary if you don't want your cache to grow forever - # till it hits GitHub's limit of 5GB. - # Temp fix - # https://github.com/docker/build-push-action/issues/252 - # https://github.com/moby/buildkit/issues/1896 - - name: Move cache - run: | - rm -rf /tmp/.buildx-cache - mv /tmp/.buildx-cache-new /tmp/.buildx-cache - - deploy: - name: Deploy - runs-on: ubuntu-latest - needs: [build] - # only build/deploy dev branch on pushes - if: ${{ (github.ref == 'refs/heads/dev') && github.event_name == 'push' }} - - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.11.0 - - - name: Checkout repo - uses: actions/checkout@v3 - - - name: Deploy dev - if: ${{ github.ref == 'refs/heads/dev' }} - uses: superfly/flyctl-actions@1.3 - with: - args: "deploy --app ${{ env.MAIN_APP_NAME }} --image ${{ env.REGISTRY }}/${{ env.MAIN_APP_NAME }}:${{ github.ref_name }}-${{ github.sha }} --config ./apps/twitch-bot/fly.toml" - env: - FLY_API_TOKEN: ${{ secrets.TWITCH_BOT_TEST_FLY_API }} - - # - name: Deploy Production - # if: ${{ github.ref == 'refs/heads/main' }} - # uses: superfly/flyctl-actions@1.3 - # with: - # args: "deploy --image ${{ env.REGISTRY }}/${{ steps.app_name.outputs.value }}:${{ github.ref_name }}-${{ github.sha }}" - # env: - # FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}