Merge pull request #1 from e-zk/updates

Fix getconfig
master
Marc 2021-10-15 16:48:38 +01:00 committed by GitHub
commit 6ceb5be68d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -88,12 +88,12 @@ func (c *Commands) handleGetConfig(s *discordgo.Session, m *discordgo.MessageCre
msg := "" msg := ""
rt := reflect.TypeOf(c.Config) rt := reflect.TypeOf(*c.Config)
for i := 0; i < rt.NumField(); i++ { for i := 0; i < rt.NumField(); i++ {
x := rt.Field(i) x := rt.Field(i)
tagVal := strings.Split(x.Tag.Get("json"), ",")[0] tagVal := strings.Split(x.Tag.Get("json"), ",")[0]
tagName := x.Name tagName := x.Name
prop := reflect.ValueOf(&c.Config).Elem().FieldByName(tagName) prop := reflect.ValueOf(c.Config).Elem().FieldByName(tagName)
if configKey == "all" { if configKey == "all" {
switch prop.Interface().(type) { switch prop.Interface().(type) {