Expand description
Core command logic — platform-neutral.
Every command the bot exposes is implemented here as a do_* function
returning a PlatformMessage. Poise command wrappers (Discord) and the
intent dispatcher (free-form mentions) call the SAME functions, so there is
exactly one implementation of each command’s behavior. This is also the
generalization seam for future platforms (Telegram/Matrix/Slack/…): a new
adapter renders PlatformMessage natively and gets every command for free.
Structs§
- CoreCtx
- Shared state every
do_*needs (subset ofcommands::Data; kept platform-free — no Discord types).
Functions§
- do_ask
askcore — natural-language search.- do_body
bodycore — full-text body search.- do_
bookmark bookmarkcore (auth, ephemeral on Discord).- do_
download downloadcore — links (or lazy convert) for a URL.- do_
forum_ categories forum categoriescore — visible categories + topic counts (auth).- do_
forum_ create forum newcore — create a topic + OP post (auth).- do_
forum_ follow forum followcore — toggle follow on a topic (auth).- do_
forum_ mark_ read forum readcore — mark a topic read (auth).last_read_post_iddefaults to the topic’s newest post whenNone.- do_
forum_ reply forum replycore — reply to a topic, optionally quoting a post (auth).- do_
forum_ search forum searchcore — full-text search over topics + posts (auth).- do_
forum_ topic forum showcore — topic detail as numbered posts (auth). Accepts a numeric topic id or a canonical slug ({slugified-title}-{id}).- do_
forum_ topics forum topicscore — topic list for a category, cursor-paginated (auth).- do_help
helpcore — grounded answer from the FicHub docs RAG (/api/docs/ask).- do_
kudos kudoscore — kudos count for a URL.- do_
metadata metadatacore — metadata embed for a URL (auto-URL / context menu / mention).- do_
quote quotecore — metadata + body snippet for a URL.- do_recs
recscore (personalized recommendations, auth).- do_roll
rollcore — random pick from personal recs.- do_
search searchcore.user_idis the platform user id (used for the pagination session pointer + search log).interpis an optional “interpreted as” header shown to the user (free-form mentions set it;/searchleaves None).- render_
ask_ results - Render an
/askresponse (results + translation metadata). - render_
forum_ categories - Pure renderer for category rows (extracted for tests + TUI reuse).
- render_
forum_ search - Pure renderer for forum search results (extracted for tests + TUI reuse).
- render_
forum_ topic_ detail - Pure renderer for a topic detail (extracted for tests + TUI reuse).
- render_
forum_ topic_ list - Pure renderer for a topic list (extracted for tests + TUI reuse).
- render_
recs - Shared recs renderer (recs/fresh/gems/liked/roll).
- render_
search_ results - Shared search-results renderer (used by search/body/fallback).
- run_
search_ impl - The actual search execution (with cache + searchlog). Extracted so the intent fallback can reuse the same cache/analytics path.