tried adding notify command

This commit is contained in:
2024-02-20 14:06:35 +01:00
parent c3d20a2218
commit 10e57fe2a0
3 changed files with 64 additions and 35 deletions

View File

@@ -23,7 +23,7 @@ func ready(s *discordgo.Session, event *discordgo.Ready) {
_, err := s.ApplicationCommandCreate(s.State.User.ID, guild.ID, &command.Definition)
if err != nil {
fmt.Println("error creating command,", err)
continue // Continue to the next guild
continue
}
}
}
@@ -64,36 +64,3 @@ func removeCommandFromAllGuilds(s *discordgo.Session) {
}
}
}
/*
func hasManageServerPermissions(s *discordgo.Session, userID string, guildID string) bool {
member, err := s.GuildMember(guildID, userID)
if err != nil {
fmt.Printf("Error fetching guild member: %v\n", err)
return false
}
guild, err := s.Guild(guildID)
if err != nil {
fmt.Printf("Error fetching guild: %v\n", err)
return false
}
if guild.OwnerID == userID {
return true
}
for _, roleID := range member.Roles {
role, err := s.State.Role(guildID, roleID)
if err != nil {
fmt.Printf("Error fetching role: %v\n", err)
continue
}
if role.Permissions&discordgo.PermissionManageServer != 0 || role.Permissions&discordgo.PermissionAdministrator != 0 {
return true
}
}
return false
}
*/