Matrix Music Bot Dev c0a378554d feat(reaction_store): 搜索结果反应(m.reaction)选择存储(M7.1)
新增模块:src/reaction_store.rs

ReactionSession:
  - (room_id, message_event_id) → Vec<SongCandidate> + requester + created_at
  - find_by_reaction("1️⃣"/"1"/"1️⃣" etc.) → Option<&SongCandidate>
  - is_expired(ttl) 默认 60s

ReactionStore(in-memory):
  - record(session):插入并清理过期
  - take(event_id):消费式取出(防止重复入队)
  - peek(event_id):仅查看
  - cleanup_expired():定期清理

parse_emoji_index() 支持多种 emoji 格式:
  "1️⃣" / "1" / "1️⃣" / "2️⃣" / ... / "5️⃣"

测试:cargo test reaction_store → 4 passed
  - parse_emoji_index_works:多种格式都能识别
  - session_find_by_reaction:1️⃣/3️⃣ → 对应候选
  - store_record_and_take:record + take 二次取 None
  - expired_sessions_are_removed:60s TTL 过期清理

后续 M7.2:
  - !req 改造为发搜索列表 + 记录 session
  - 注册 m.reaction event handler
  - reaction handler 查 ReactionStore 找候选并入队
2026-07-02 22:04:03 +08:00
S
Description
No description provided
361 KiB
Languages
Rust 89.9%
Shell 7.6%
Dockerfile 2.5%