From 8f1dece5a9ea77f08a37950c2ffa8cc499bcae2e Mon Sep 17 00:00:00 2001 From: biast12 <53872542+biast12@users.noreply.github.com> Date: Wed, 23 Sep 2026 19:45:37 +0200 Subject: [PATCH 1/2] Add Text Display Avoids adding feedback controls when no responses exist, validates modal component types before parsing answers, supports top-level text displays, and handles empty survey question titles safely. Enables the local database module replacement in go.mod. --- bot/button/handlers/exitsurveysubmit.go | 4 ++++ bot/button/handlers/form.go | 4 ++-- bot/button/handlers/panel.go | 3 +++ bot/button/handlers/viewsurvey.go | 2 +- go.mod | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/bot/button/handlers/exitsurveysubmit.go b/bot/button/handlers/exitsurveysubmit.go index fdde5d0b..3776af7b 100644 --- a/bot/button/handlers/exitsurveysubmit.go +++ b/bot/button/handlers/exitsurveysubmit.go @@ -148,6 +148,10 @@ func (h *ExitSurveySubmitHandler) Execute(cmd *cmdcontext.ModalContext) { cmd.EditWithRaw(customisation.Green, "Success", "Thank you for your feedback!") // TODO: i18n + if len(responses) == 0 { + return + } + if err := addViewFeedbackButton(ctx, cmd, ticket); err != nil { cmd.HandleError(err) return diff --git a/bot/button/handlers/form.go b/bot/button/handlers/form.go index 7582125f..335fe00c 100644 --- a/bot/button/handlers/form.go +++ b/bot/button/handlers/form.go @@ -104,13 +104,13 @@ func parseModalComponents(actionRows []interaction.ModalSubmitInteractionActionR case component.ComponentRadioGroup: answer = c.Value } - if input, ok := inputsByCustomId[c.CustomId]; ok { + if input, ok := inputsByCustomId[c.CustomId]; ok && component.ComponentType(input.Type) == c.Type { answers[input] = answer } continue } for _, comp := range actionRow.Components { - if formInput, ok := inputsByCustomId[comp.CustomId]; ok { + if formInput, ok := inputsByCustomId[comp.CustomId]; ok && component.ComponentType(formInput.Type) == comp.Type { answers[formInput] = comp.Value } } diff --git a/bot/button/handlers/panel.go b/bot/button/handlers/panel.go index 8957b1ab..af35de4a 100644 --- a/bot/button/handlers/panel.go +++ b/bot/button/handlers/panel.go @@ -238,6 +238,9 @@ func buildFormComponents(inputs []database.FormInput, inputOptions map[int][]dat MaxValues: maxLength, Required: utils.Ptr(input.Required), }) + case int(component.ComponentTextDisplay): + components[i] = component.BuildTextDisplay(component.TextDisplay{Content: utils.ValueOrZero(input.Content)}) + continue // Discord only allows Text Display at the top level, not inside a Label } label := component.Label{ diff --git a/bot/button/handlers/viewsurvey.go b/bot/button/handlers/viewsurvey.go index 610b9acd..9fd3fa04 100644 --- a/bot/button/handlers/viewsurvey.go +++ b/bot/button/handlers/viewsurvey.go @@ -102,7 +102,7 @@ func (h *ViewSurveyHandler) Execute(ctx *context.ButtonContext) { for _, answer := range surveyResponse.Responses { var title string - if answer.Question == nil { + if answer.Question == nil || *answer.Question == "" { title = "Unknown Question" } else { title = *answer.Question diff --git a/go.mod b/go.mod index 855b27a1..747192c3 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/TicketsBot-cloud/worker go 1.26.0 -// replace github.com/TicketsBot-cloud/database => ../database +replace github.com/TicketsBot-cloud/database => ../database // replace github.com/TicketsBot-cloud/common => ../common From 479ffceab4ab74d1f1d47ece913bbd68d5773192 Mon Sep 17 00:00:00 2001 From: biast12 <53872542+biast12@users.noreply.github.com> Date: Fri, 2 Oct 2026 17:51:35 +0200 Subject: [PATCH 2/2] Bump database --- go.mod | 6 +++--- go.sum | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 747192c3..38020eba 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/TicketsBot-cloud/worker go 1.26.0 -replace github.com/TicketsBot-cloud/database => ../database +// replace github.com/TicketsBot-cloud/database => ../database // replace github.com/TicketsBot-cloud/common => ../common @@ -15,8 +15,8 @@ replace github.com/TicketsBot-cloud/database => ../database require ( cloud.google.com/go/profiler v0.4.2 github.com/TicketsBot-cloud/archiverclient v0.0.0-20251015181023-f0b66a074704 - github.com/TicketsBot-cloud/common v0.0.0-20260905165836-38e4090764a4 - github.com/TicketsBot-cloud/database v0.0.0-20260913165941-c2ecc7191b02 + github.com/TicketsBot-cloud/common v0.0.0-20260927072029-424264fc4be2 + github.com/TicketsBot-cloud/database v0.0.0-20261002063446-01dca52a987e github.com/TicketsBot-cloud/gdl v0.0.0-20260426095953-999472e6e538 github.com/caarlos0/env/v10 v10.0.0 github.com/elliotchance/orderedmap v1.8.0 diff --git a/go.sum b/go.sum index df93d4ec..57eed28a 100644 --- a/go.sum +++ b/go.sum @@ -27,10 +27,10 @@ github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0 github.com/ReneKroon/ttlcache v1.6.0/go.mod h1:DG6nbhXKUQhrExfwwLuZUdH7UnRDDRA1IW+nBuCssvs= github.com/TicketsBot-cloud/archiverclient v0.0.0-20251015181023-f0b66a074704 h1:liLfvCrzoJ89DXFHzsd1iK3cyP8s4i0CnZPRFEj53zg= github.com/TicketsBot-cloud/archiverclient v0.0.0-20251015181023-f0b66a074704/go.mod h1:Mux1bEPpOHwRw1wo6Fa6qJLJH9Erk9qv1yAIfLi1Wmw= -github.com/TicketsBot-cloud/common v0.0.0-20260905165836-38e4090764a4 h1:zcPcJ+03xW9qalqzqllM6j0ZPdhuL+mrtGw8woLrAMo= -github.com/TicketsBot-cloud/common v0.0.0-20260905165836-38e4090764a4/go.mod h1:yL+VPSYNVK5gxUkA+fbb0WdTjGfWXnr7ScfL0rwk29g= -github.com/TicketsBot-cloud/database v0.0.0-20260913165941-c2ecc7191b02 h1:3Z8PpXBUbdYn2srMRg3Nj0MDxnTB53CzIEAOUBIubhM= -github.com/TicketsBot-cloud/database v0.0.0-20260913165941-c2ecc7191b02/go.mod h1:0fKn7nPX6KeljYNQtGQiuZ5aJ/TczgXvBhnbz+4GEc8= +github.com/TicketsBot-cloud/common v0.0.0-20260927072029-424264fc4be2 h1:qeebeGGdrsDXrngOVrKMDt9G3JUTJwT/IEPTB61d46s= +github.com/TicketsBot-cloud/common v0.0.0-20260927072029-424264fc4be2/go.mod h1:yL+VPSYNVK5gxUkA+fbb0WdTjGfWXnr7ScfL0rwk29g= +github.com/TicketsBot-cloud/database v0.0.0-20261002063446-01dca52a987e h1:kZS42Mp+6wBhApK7zA6F1SX8ZYYG18cVRHB2ZDTvx94= +github.com/TicketsBot-cloud/database v0.0.0-20261002063446-01dca52a987e/go.mod h1:0fKn7nPX6KeljYNQtGQiuZ5aJ/TczgXvBhnbz+4GEc8= github.com/TicketsBot-cloud/gdl v0.0.0-20260426095953-999472e6e538 h1:ewKw1Wv1x/yi8h1IH7EofcYnPUxWZaVTIPFkT97nhn0= github.com/TicketsBot-cloud/gdl v0.0.0-20260426095953-999472e6e538/go.mod h1:CdwBR2egPtxUXjD2CgC9ZwfuB8dz9HPePM8nuG6dt7Y= github.com/TicketsBot-cloud/logarchiver v0.0.0-20251018211319-7a7df5cacbdc h1:qTLNpCvIqM7UwZ6MdWQ9EztcDsIJfHh+VJdG+ULLEaA=