From fb2e178e93f9c42266ec4e73fd0f23bed310a1d6 Mon Sep 17 00:00:00 2001 From: Xevion Date: Wed, 28 Feb 2024 04:09:41 -0600 Subject: [PATCH] Parse, log, and use residentId for submission contexts before modal emit --- commands.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/commands.go b/commands.go index 516a628..1dae59f 100644 --- a/commands.go +++ b/commands.go @@ -249,6 +249,19 @@ func RegisterCommandHandler(session *discordgo.Session, interaction *discordgo.I HandleError(session, interaction, parseErr, "Error occurred while parsing interaction message identifier") } + // Parse resident profile ID + residentProfileId, parseErr := strconv.ParseUint(form.residentProfileId, 10, 64) + if parseErr != nil { + HandleError(session, interaction, parseErr, "Error occurred while parsing resident profile identifier") + } + + // Log the registration context at debug + log.WithFields(logrus.Fields{ + "registerIdentifier": registerIdentifier, + "propertyId": location_id, + "residentId": form.residentProfileId, + }) + // Store the registration context for later use SubmissionContexts.Set(registerIdentifier, &RegisterContext{ hiddenKeys: form.hiddenInputs, @@ -256,7 +269,7 @@ func RegisterCommandHandler(session *discordgo.Session, interaction *discordgo.I requiredFormKeys: lo.Map(form.fields, func(field Field, _ int) string { return field.id }), - residentId: 0, // TODO: Find where this comes from, what it is, etc. + residentId: uint(residentProfileId), }, time.Hour) registrationFormComponents = append(registrationFormComponents, discordgo.ActionsRow{