fix(config): limits one config per guild
This commit is contained in:
parent
b088cfb7b0
commit
0a445aa1c7
1 changed files with 3 additions and 3 deletions
|
@ -9,8 +9,8 @@ import (
|
||||||
|
|
||||||
type GuildConfig struct {
|
type GuildConfig struct {
|
||||||
gorm.Model
|
gorm.Model
|
||||||
GuildID string `gorm:"not null"`
|
GuildID string `gorm:"not null;unique"`
|
||||||
XpRoles []XpRole
|
XpRoles []*XpRole
|
||||||
DisabledChannels string
|
DisabledChannels string
|
||||||
FallbackChannel string
|
FallbackChannel string
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ func (cfg *GuildConfig) IsDisabled(channelID string) bool {
|
||||||
func (cfg *GuildConfig) FindXpRole(roleID string) (int, *XpRole) {
|
func (cfg *GuildConfig) FindXpRole(roleID string) (int, *XpRole) {
|
||||||
for i, r := range cfg.XpRoles {
|
for i, r := range cfg.XpRoles {
|
||||||
if r.RoleID == roleID {
|
if r.RoleID == roleID {
|
||||||
return i, &r
|
return i, r
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0, nil
|
return 0, nil
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue