main.go aktualisiert
All checks were successful
release-tag / release-image (push) Successful in 1m27s

This commit is contained in:
2025-08-10 17:54:35 +00:00
parent 2b9ed0e804
commit 9683f9d5fe

19
main.go
View File

@@ -262,7 +262,7 @@ func createPrivateVCAndMove(
break
}
wait := time.Duration(150*(attempt+1)) * time.Millisecond
log.Printf("Move fehlgeschlagen (Versuch %d): %v retry in %s", attempt+1, moveErr, wait)
log.Printf("Move fehlgeschlagen (Versuch %d): %v - retry in %s", attempt+1, moveErr, wait)
time.Sleep(wait)
}
if moveErr != nil {
@@ -589,6 +589,22 @@ func onInteractionCreate(_ string) func(s *discordgo.Session, i *discordgo.Inter
}
}
// Handler: Commands registrieren, wenn Bot auf neuen Server kommt
func onGuildCreate(s *discordgo.Session, g *discordgo.GuildCreate) {
appID := s.State.User.ID
log.Printf("Registriere Commands in neuer Guild: %s (%s)", g.Name, g.ID)
for _, cmd := range slashCommands {
c, err := s.ApplicationCommandCreate(appID, g.ID, cmd)
if err != nil {
log.Printf("Command-Registrierung in %s fehlgeschlagen: %v", g.Name, err)
continue
}
cfgMu.Lock()
createdCmds[g.ID] = append(createdCmds[g.ID], c)
cfgMu.Unlock()
}
}
// ===== Commands Definition =====
var (
adminPerm = int64(discordgo.PermissionAdministrator)
@@ -661,6 +677,7 @@ func main() {
s.Identify.Intents = discordgo.IntentsGuilds | discordgo.IntentsGuildVoiceStates
s.AddHandler(onVoiceStateUpdate)
s.AddHandler(onGuildCreate)
s.AddHandler(onInteractionCreate(""))
s.AddHandler(func(s *discordgo.Session, r *discordgo.Ready) {
log.Printf("Eingeloggt als %s", r.User.Username)