help-me.ts
@file /help-me — collect the context once, match it, escalate honestly.
Overview
@file /help-me — collect the context once, match it, escalate honestly.
The whole point of this bot. Support here costs three or four round trips
before anyone knows which board, which image, and what the console said, so
this asks for all of it in one form and posts a thread that already has the
answer or already says there isn't one.
Two interactions, not one. Discord will not let a command defer and then
open a modal, so board and image are command options (enumerated, validated
by Discord) and the free text is collected by the modal that the command
returns. The selections ride through on the modal's custom_id.
The matcher never speculates. No match is reported as no match and pings the
maintainer, because "I don't recognise this" is a useful thing to tell
somebody and a plausible guess is not.
depends on api.ts boards.ts citations.ts command.ts db.ts discord.ts followup.ts images.ts rigs.ts signatures.ts · used by index.ts
API
Fexport function parseModalId(customId: string): Selections | null
Parse what the modal carried through, rejecting anything not on the lists.
onModalSubmit · calls isKnownBoard, isKnownImageFexport function threadName(board: string, expected: string, actual: string): string
Discord caps a thread name at 100 characters and newlines read badly in a channel list.
onModalSubmit · calls boardLabelFexport function consoleBlock(text: string): string
The console paste, fenced, with the truncation stated rather than implied.
onModalSubmitFexport function contextBlock(input: BlockInput): string
The context block. Says what is known, what matched and why, and what is still unknown. The last part matters: a report that looks complete but silently omits the NCS pin costs the round trip this bot exists to remove.
onModalSubmit · calls boardLabel, imageLabel, matchesSectionFfunction matchesSection(matches: BlockInput["matches"], budget: number): string
The match list, trimmed to budget characters, saying what it dropped.
contextBlock · calls formatCitationsUndocumented (3)
optionBoolean, handler, onModalSubmit