validate that both parameters are present for claim

Fixes #1
absences
William Perron 2 years ago
parent 0f9668704d
commit c2d8cf2b83

@ -166,6 +166,19 @@ func main() {
} }
opts := i.ApplicationCommandData().Options opts := i.ApplicationCommandData().Options
if len(opts) != 2 {
err = s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: &discordgo.InteractionResponseData{
Content: "`claim-type` and `name` are mandatory parameters",
},
})
if err != nil {
log.Println("[error] failed to respond to command:", err)
}
return
}
claimType, err := themis.ClaimTypeFromString(opts[0].StringValue()) claimType, err := themis.ClaimTypeFromString(opts[0].StringValue())
if err != nil { if err != nil {
err = s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{ err = s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{

Loading…
Cancel
Save