chore: build

This commit is contained in:
2026-06-14 17:50:35 +02:00
parent 3c92a0371f
commit 3a0f725159
93 changed files with 5311 additions and 4224 deletions
+27 -4
View File
@@ -1,7 +1,3 @@
// ============================================
// main.go - VERSION SIMPLIFIÉE AVEC CLEANUP AUTO
// ============================================
package main
import (
@@ -42,6 +38,13 @@ func main() {
geoService := services.NewGeoService(db.Redis, db.RedisCtx)
log.Println("✅ Service de géolocalisation initialisé")
lbService := services.NewLBTelegramService()
if lbService.IsConfigured() {
log.Println("✅ Service LBTelegram initialisé")
} else {
log.Println("️ Service LBTelegram désactivé (LBTELEGRAM_URL non défini)")
}
telegramService := services.NewTelegramService()
if telegramService.IsConfigured() {
log.Println("✅ Service Telegram initialisé")
@@ -69,6 +72,26 @@ func main() {
}
}
// Ré-enrôler tous les comptes déjà liés dans lbtelegram (au cas où lbtelegram a redémarré)
if lbService.IsConfigured() {
go func() {
accounts, err := database.GetAllLinkedTelegramAccounts()
if err != nil {
log.Printf("⚠️ [LB_SYNC] Erreur lecture comptes liés: %v", err)
return
}
ok, fail := 0, 0
for _, a := range accounts {
if err := lbService.EnrollUser(a.ChatID, a.Username, a.Role); err != nil {
fail++
} else {
ok++
}
}
log.Printf("✅ [LB_SYNC] Re-enrollment terminé: %d OK, %d échecs (total %d comptes)", ok, fail, len(accounts))
}()
}
log.Println("")
log.Println("🧹 Démarrage du nettoyage des commandes invalides...")
removed, err := database.CleanupInvalidQueueCommands()