Update telegram-join-approval-bot submodule and apply patches

This commit is contained in:
Astra 2026-03-10 06:44:52 +00:00
parent f1efc1d937
commit 80d8018905
8 changed files with 11 additions and 17 deletions

2
go.mod
View file

@ -1,4 +1,4 @@
module git.zio.sh/astra/telegram-join-approval-nuzzles
module git.zio.sh/astra/telegram-approval-join
go 1.25.3

View file

@ -5,7 +5,7 @@ import (
"log"
"strings"
utils "git.zio.sh/astra/telegram-join-approval-nuzzles/pkg/utils"
utils "git.zio.sh/astra/telegram-approval-join/pkg/utils"
api "github.com/OvyFlash/telegram-bot-api"
)

View file

@ -6,7 +6,7 @@ import (
"strings"
"time"
utils "git.zio.sh/astra/telegram-join-approval-nuzzles/pkg/utils"
utils "git.zio.sh/astra/telegram-approval-join/pkg/utils"
api "github.com/OvyFlash/telegram-bot-api"
)

View file

@ -3,7 +3,7 @@ package handlers
import (
"sync"
config "git.zio.sh/astra/telegram-join-approval-nuzzles/config"
config "git.zio.sh/astra/telegram-approval-join/config"
api "github.com/OvyFlash/telegram-bot-api"
)

View file

@ -4,7 +4,7 @@ import (
"fmt"
"log"
utils "git.zio.sh/astra/telegram-join-approval-nuzzles/pkg/utils"
utils "git.zio.sh/astra/telegram-approval-join/pkg/utils"
api "github.com/OvyFlash/telegram-bot-api"
)

View file

@ -3,8 +3,8 @@ package main
import (
"log"
"git.zio.sh/astra/telegram-join-approval-nuzzles/config"
"git.zio.sh/astra/telegram-join-approval-nuzzles/handlers"
"git.zio.sh/astra/telegram-approval-join/config"
"git.zio.sh/astra/telegram-approval-join/handlers"
api "github.com/OvyFlash/telegram-bot-api"
)

1
scripts/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
config.yaml

View file

@ -13,23 +13,16 @@ PATCH_FILE="$ROOT_DIR/patches/0001-nuzzles.patch"
# ── 1. Ensure submodule is initialised ────────────────────────────────────────
echo "→ Updating submodule..."
# Capture the submodule commit before update
OLD_COMMIT=$(git -C "$SUBMODULE_DIR" rev-parse HEAD 2>/dev/null || echo "")
# Update the submodule
git -C "$ROOT_DIR" submodule update --init --recursive --remote
# Capture the submodule commit after update
NEW_COMMIT=$(git -C "$SUBMODULE_DIR" rev-parse HEAD 2>/dev/null || echo "")
# ── 2. Wipe and re-copy the submodule source ──────────────────────────────────
echo "→ Copying telegram-join-approval-bot source to root..."
# Clean up directories that will be replaced
rm -rf "$ROOT_DIR/cmd" "$ROOT_DIR/internal" "$ROOT_DIR/go.mod" "$ROOT_DIR/go.sum" "$ROOT_DIR/config.yaml.example"
rm -rf "$ROOT_DIR/config" "$ROOT_DIR/handlers" "$ROOT_DIR/pkg" "$ROOT_DIR/main.go" "$ROOT_DIR/go.mod" "$ROOT_DIR/go.sum"
# Copy source files, excluding .git and keeping patches/ and scripts/
rsync -a --stats --exclude='.git' --exclude='internal/telegram-join-approval-bot' \
"$SUBMODULE_DIR/" "$ROOT_DIR/" \
rsync -a --stats --exclude='.git' "$SUBMODULE_DIR/" "$ROOT_DIR/" \
--exclude='patches' --exclude='scripts' --exclude='README.md' --exclude='Dockerfile'
# Remove scripts/ from .gitignore so we can track our sync script
@ -42,7 +35,7 @@ sed -i "s|^module git\.zio\.sh/astra/telegram-join-approval-bot|module git.zio.s
# Fix all import references in the copied source
echo "→ Rewriting import paths in .go files ..."
find "$ROOT_DIR" -name '*.go' -not -path "*/telegram-join-approval-bot/*" | xargs sed -i 's|git\.zio\.sh/astra/telegram-join-approval-bot|git.zio.sh/astra/telegram-join-approval-nuzzles|g'
find "$ROOT_DIR" -name '*.go' -not -path "*/telegram-join-approval-bot/telegram-join-approval-bot/*" | xargs sed -i 's|git\.zio\.sh/astra/telegram-join-approval-bot|git.zio.sh/astra/telegram-join-approval-nuzzles|g'
# ── 4. Apply string patch ────────────────────────────────────────────
if [[ -f "$PATCH_FILE" ]]; then