aboutsummaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <anhgelus@anhgelus.world>2025-05-13 12:13:55 +0200
committerAnhgelus Morhtuuzh <anhgelus@anhgelus.world>2025-05-13 12:13:55 +0200
commit0a445aa1c73bc1410899c53778ae090a24c38dac (patch)
tree60faa90ac28e62eba55ed232282ab2dc52cba0cc /config
parentb088cfb7b0c0ecf0cb63551dd5942a53247fb59f (diff)
fix(config): limits one config per guild
Diffstat (limited to 'config')
-rw-r--r--config/guild.go6
1 files 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