mirror of
https://github.com/Xevion/r2park.git
synced 2025-12-11 06:08:20 -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
|
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.
|
// FormToComponents converts the form requested into usable modal components.
|
||||||
func FormToComponents(form GetFormResult) []discordgo.MessageComponent {
|
func FormToComponents(form GetFormResult) []discordgo.MessageComponent {
|
||||||
@@ -49,14 +52,17 @@ func FormToComponents(form GetFormResult) []discordgo.MessageComponent {
|
|||||||
MinLength: 1,
|
MinLength: 1,
|
||||||
MaxLength: 9,
|
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 = append(components, discordgo.ActionsRow{
|
||||||
Components: []discordgo.MessageComponent{
|
Components: []discordgo.MessageComponent{
|
||||||
component,
|
component,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return components
|
return components
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user