fix(bot): collect /vaga descricao via modal, not a single-line option

Merged
LU
3mo ago
+152-13

Problem

/vaga's published requirements list was coming out as one run-on paragraph instead of a bullet list, e.g.:

  • Requisito A. - Requisito B. - Requisito C.

Root cause

descricao was a plain Discord slash-command string option — a single-line input. Discord doesn't support real newlines there. Whoever ran /vaga almost certainly pasted the requirements from a job-board page, and browsers flatten <li> list items into one line with spaces when you copy them. The bot itself was passing the string straight through — nothing to fix in the formatting logic, the input channel just couldn't carry multi-line text.

Fix

descricao is now collected via a Modal with a paragraph-style text input (TextInputStyle.Paragraph), which does support real line breaks. Flow: /vaga titulo:... url:... modalidade:... senioridade:... → modal popup for descrição → existing preview/confirm/publish flow continues unchanged.

Test plan

  • 3 new tests: modal shown before any lookups, real line breaks preserved end-to-end in the published message, timeout on modal submission does nothing further
  • All 4 existing tests updated for the new modal-based interaction shape, still passing
  • npx jest src/functions/general/commands/vaga.spec.ts — 7/7 passing
  • Full bot package suite — 2851/2852 passing (1 pre-existing skip, unrelated)
  • tsc --noEmit clean (full monorepo typecheck via pre-commit hook)
  • eslint clean (pre-existing complexity warning on execute, 17→18, not newly introduced — already over budget before this change)

Summary by cubic

Fixes /vaga so the job description is collected via a modal with a paragraph field, preserving real line breaks. Published posts now render bullet lists correctly and avoid mixing fields across concurrent runs.

  • Bug Fixes
    • Collect descricao via a modal (TextInputStyle.Paragraph) instead of a single-line option.
    • Keep the preview/confirm/publish flow; replies now come from the modal submission interaction.
    • Scope the modal to the current invocation using a unique customId and filter on user + customId, rejecting stale/concurrent submissions.
    • Handle modal submit timeout gracefully (no follow-ups if the user doesn’t submit).
    • Validate preview length and show an error if it exceeds 2000 characters.

Summary by CodeRabbit

  • New Features

    • The /vaga command now collects the “Descrição / requisitos” field through a modal, making it easier to enter longer text.
    • Multiline descriptions are preserved as typed in the preview and published message.
  • Bug Fixes

    • Added safer handling when the description step times out, preventing an incomplete post from being published.
    • Improved the preview flow so publishing and cancel actions continue to work smoothly after submission.