huh why didn't i wrote a for loop

This commit is contained in:
2024-02-14 11:40:11 +01:00
parent a05c6c5876
commit 8634cede8a

16
main.go
View File

@@ -59,16 +59,12 @@ func ready(s *discordgo.Session, event *discordgo.Ready) {
} }
for _, guild := range event.Guilds { for _, guild := range event.Guilds {
_, err := s.ApplicationCommandCreate(s.State.User.ID, guild.ID, commands[0]) for _, command := range commands {
if err != nil { _, err := s.ApplicationCommandCreate(s.State.User.ID, guild.ID, command)
fmt.Println("error creating command,", err) if err != nil {
continue // Continue to the next guild fmt.Println("error creating command,", err)
} continue // Continue to the next guild
}
_, err = s.ApplicationCommandCreate(s.State.User.ID, guild.ID, commands[1])
if err != nil {
fmt.Println("error creating command,", err)
continue // Continue to the next guild
} }
} }
} }