From 62faa6c97452cb3f478503fa621de4ec04ba45dd Mon Sep 17 00:00:00 2001 From: Joren Date: Sat, 6 Jul 2024 21:01:44 +0200 Subject: [PATCH] Fix admin roles not applying --- main.go | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/main.go b/main.go index b496cf4..aa3e118 100644 --- a/main.go +++ b/main.go @@ -21,16 +21,16 @@ var ( ) type Config struct { - Discord Discord `toml:"discord"` - Database Database `toml:"database"` - AdminRoles []string `toml:"admin_roles"` + Discord Discord `toml:"discord"` + Database Database `toml:"database"` } type Discord struct { - Token string `toml:"token"` - AppID string `toml:"appid"` - GuildID string `toml:"guildid"` - CategoryID string `toml:"category_id"` + Token string `toml:"token"` + AppID string `toml:"appid"` + GuildID string `toml:"guildid"` + CategoryID string `toml:"category_id"` + AdminRoles []string `toml:"admin_roles"` } type Database struct { @@ -240,8 +240,11 @@ var ( return } - for _, roleID := range config.AdminRoles { - client.ChannelPermissionSet(channel.ID, roleID, discordgo.PermissionOverwriteTypeRole, discordgo.PermissionViewChannel, 0) + for _, roleID := range config.Discord.AdminRoles { + err := client.ChannelPermissionSet(channel.ID, roleID, discordgo.PermissionOverwriteTypeRole, discordgo.PermissionViewChannel|discordgo.PermissionSendMessages, 0) + if err != nil { + log.Printf("Error setting permissions for role %s: %v", roleID, err) + } } err = client.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{