[WIP] Intro autopost on new intro creation#113
Conversation
- Add lfg_batch_search agent tool to support batch game thread lookups - Takes list of game names as input - Returns found threads grouped by game with missing games list - Queries forum cache for each game and aggregates results - Create intro/interactions.go with button handler for game thread lookup - Handles intro_lookup_games:: custom ID from button clicks - Extracts thread ID and user ID from custom ID format - Defers response and logs action - Dispatches to agent for full orchestration - Update module_handler.go to route intro button interactions - Added case for intro_lookup_games:: prefix - Routes to intro module's HandleComponent method - Add comprehensive tests - agent_tools_test.go: tests batch search with various scenarios - interactions_test.go: tests button routing and component handling Contract: - Button custom ID format: intro_lookup_games::<thread_id>::<user_id> - Agent tool lfg_batch_search accepts game_names []string - Returns batchSearchResult with games and missingGames fields Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Changed button custom_id format from 'intro_lookup_games::<thread_id>::<user_id>' to 'intro:lookup-games' (simple prefix) for consistency with existing LFG patterns. Thread ID and user ID now extracted from interaction metadata: - threadID from i.ChannelID (threads are channels in Discord) - userID from i.Member.User.ID or i.User.ID This aligns with simpler LFG button IDs like 'lfg_panel_open_modal' and reduces custom_id parsing complexity. Updated: - interactions.go: Simplified to extract context from metadata instead of parsing custom_id - interactions_test.go: Updated test helper to use new format - module_handler.go: Updated prefix check to 'intro:lookup-games' Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add PostAutoMessageToThread() to IntroFeedService that posts an embed with: * Feed channel link/mention * /intro command help text * /bump-intro command help text * 'Lookup Game Threads' button with custom_id 'intro:lookup-games' - Modify HandleNewIntroThread() to call PostAutoMessageToThread() after successful feed post. Auto-post errors don't fail the overall flow. - Add HandleComponent() to intro module to handle 'intro:lookup-games' button clicks. Responds with ephemeral placeholder message (actual game-thread lookup deferred to future session). - Update module_handler HandleComponentInteraction() to route 'intro:' custom_id prefixes to intro module instead of LFG catch-all. Prevents intro buttons from being mishandled by LFG routing. - Add unit tests for PostAutoMessageToThread() error handling - Add tests for HandleComponent() button recognition - Verify routing and module availability Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- route intro component custom_id intro:lookup-games in module handler
- add intro component handler that defers interaction, calls agent with exact
prompt Find the game threads for the games <@{userID}> plays. and parses
JSON response into deterministic markdown output
- inject agent into shared command dependencies via ComponentAgent interface
- add Agent.HandleComponent(s, i, prompt) entrypoint that receives full
InteractionCreate context and enforces JSON-only output contract
- extend lfg agent tools with lfg_batch_search for multi-game lookup,
returning games, missing_games, and create-a-thread note fallback/mention
- add tests for intro component flow, lfg batch lookup, and agent JSON
normalization behavior
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- sync internal request prompt artifacts from planning session by adding internal_request_mode.md and prompt-contract tests - update agent run path to accept explicit system prompt + mode, keeping base queries on original sys_prompt behavior and internal queries on internal-only prompt behavior - replace component interaction entrypoint with HandleInternal(s, prompt) returning raw model response text - update intro lookup flow to call internal handle, parse internal JSON shape, and build deterministic markdown inline in handler - remove obsolete agent JSON normalization component tests and add prompt contract tests for internal request mode Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- change NewModuleHandler to receive the agent instance from bot.New instead of deriving it inside module handler - pass the single shared agent from bot.New to module handler deps - update agentadapter module to wrap the injected agent and stop creating a second agent instance Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This reverts commit e0c0159.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…t-s-intro-autopost-plan
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Squashed from sub-session commits: b770ce4, ce2ac1c, ac098d8 (excluding 9c63fd4). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Bug review — "Lookup Game Threads" buttonInvestigated the reported issue that clicking the refresh/lookup button "doesn't work." Build and tests pass, so these are behavioral/robustness issues rather than compile errors. 1. The button is destroyed on every path, so it can never be retried (the reported symptom)In
The moment the button is clicked it disappears. If the lookup fails for any reason, the user is left with an error message and no button to click again — even though two of those messages say "Please try again." From the user's perspective: one click, an error, and it's gone. A retry/refresh button should keep its components on the error paths. 2. The lookup fails silently and brittly on non-JSON agent output
The internal prompt ( 3. All interaction errors are swallowedEvery 4. Import block isn't gofmt-clean
- "slices"
"regexp"
+ "slices"It compiles and Minor observations (not bugs)
The single change most likely to resolve the "doesn't work" report is #1 (don't strip the button on failure), closely followed by #2 (tolerate fenced JSON). |
- Refactor intro lookup auto-post state flow - Use DB timestamp for lookup execution upsert - Adjust intro lookup logs - Add intro auto-message service logs - Remove AccentColor from intro auto-message container Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- strip fenced JSON in HandleInternal - move system prompt assembly to Handle/HandleInternal callers Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Combined commit messages: refactor: enhance auto-message handling and component parsing for intro threads refactor: rename `AutoMessage` to `AutoPost` refactor intro auto post state handling add intro auto post helpers Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
❌ Development deployment to Azure Container Apps failed. |
|
❌ Development deployment to Azure Container Apps failed. |
|
❌ Development deployment to Azure Container Apps failed. |
|
❌ Development deployment to Azure Container Apps failed. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This PR implements a feature to auto-post in newly created intro posts + provides a button to lookup game threads for the mentioned games in the post.
Something like this:

Changes are made in following areas:
Intro Feed Service- auto-posts after successful creation of an intro postAgent,LFG Agent Tools,Module Handler- implements routing and handler for responding to internal query in JSON structure. Modules can now useAgentandAgent Toolsto retrieve information from free-form text queries.Agentis passed to modules throughDependenciesModule Handler&Intro Module Interactions- routing and handlingLookup Game Threadsbutton click