From 0a445aa1c73bc1410899c53778ae090a24c38dac Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Tue, 13 May 2025 12:13:55 +0200 Subject: [PATCH] fix(config): limits one config per guild --- config/guild.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/guild.go b/config/guild.go index 242cc89..b4b7014 100644 --- a/config/guild.go +++ b/config/guild.go @@ -9,8 +9,8 @@ import ( type GuildConfig struct { gorm.Model - GuildID string `gorm:"not null"` - XpRoles []XpRole + GuildID string `gorm:"not null;unique"` + XpRoles []*XpRole DisabledChannels string FallbackChannel string } @@ -46,7 +46,7 @@ func (cfg *GuildConfig) IsDisabled(channelID string) bool { func (cfg *GuildConfig) FindXpRole(roleID string) (int, *XpRole) { for i, r := range cfg.XpRoles { if r.RoleID == roleID { - return i, &r + return i, r } } return 0, nil