mirror of
https://github.com/Xevion/r2park.git
synced 2025-12-09 04:08:13 -06:00
Fix FormToComponents only adding licnese plates, add default for unexpected component
This commit is contained in:
10
form.go
10
form.go
@@ -1,6 +1,9 @@
|
||||
package main
|
||||
|
||||
import "github.com/bwmarrin/discordgo"
|
||||
import (
|
||||
"github.com/bwmarrin/discordgo"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// FormToComponents converts the form requested into usable modal components.
|
||||
func FormToComponents(form GetFormResult) []discordgo.MessageComponent {
|
||||
@@ -49,14 +52,17 @@ func FormToComponents(form GetFormResult) []discordgo.MessageComponent {
|
||||
MinLength: 1,
|
||||
MaxLength: 9,
|
||||
}
|
||||
default:
|
||||
log.Warnf("unexpected field handled for \"%s\" (%v, %s)", form.propertyName, field.id, field.text)
|
||||
}
|
||||
|
||||
// Each field is contained within its own row.
|
||||
components = append(components, discordgo.ActionsRow{
|
||||
Components: []discordgo.MessageComponent{
|
||||
component,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return components
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user