From c2d8cf2b8363e6ee55baac63be2ecbe8eb514c4f Mon Sep 17 00:00:00 2001 From: William Perron Date: Fri, 9 Sep 2022 17:14:11 +0000 Subject: [PATCH] validate that both parameters are present for claim Fixes #1 --- cmd/themis-server/main.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cmd/themis-server/main.go b/cmd/themis-server/main.go index 69f094b..c24f681 100644 --- a/cmd/themis-server/main.go +++ b/cmd/themis-server/main.go @@ -166,6 +166,19 @@ func main() { } 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()) if err != nil { err = s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{