refactor(api): move interaction methods to InteractionApi (#6 commit 6/13)

Folds the entire `actions/interaction.ts` (sendPoke / sendLike /
setGroupReaction / getEmojiLikes) plus the lone-survivor
`setGroupEssence` from `actions/group-message.ts` into
`apis/interaction.ts::InteractionApi`. Both action files deleted —
the recall + markRead halves of group-message were already absorbed
into MessageApi back in commit 1.

Skipping the planned standalone GroupMessageApi commit: with only one
method left (`setGroupEssence`), giving it its own Api class would be
pure overhead. Essence is conceptually an "interaction" anyway (mark
a message as essence is parallel to "react with an emoji").

Method renaming (Api namespace already says "interaction"):

  sendPoke              → sendPoke     (no rename — already minimal)
  sendLike              → sendLike
  setGroupReaction      → setReaction
  setGroupEssence       → setEssence
  getEmojiLikes         → getEmojiLikes (no rename — read-side, fine)

Callers updated: `instance-context.ts`, `modules/message-actions.ts`,
`actions/extended.ts`. Tests `interaction.test.ts` rewritten to use
`new InteractionApi(bridge as any).method(...)` and gained a
`setEssence` test. `group-message.test.ts` rewritten to target
MessageApi.recall* / markRead* methods that were already moved.

587/587 tests pass.
This commit is contained in:
DrSmoothl committed 2026-05-20 23:17:51 +08:00
1 parent c92daa56df
commit 73f1cd3c80
11 files changed
+155 -221

No files matched your search

@@ -85,7 +85,7 @@ export async function setEssenceMessage(
): Promise<void> {
const meta = messageStore.findMeta(messageId);
if (!meta || !meta.isGroup) throw new Error('message not found or not a group message');
await bridge.setGroupEssence(meta.targetId, meta.sequence, meta.random, enable);
await bridge.apis.interaction.setEssence(meta.targetId, meta.sequence, meta.random, enable);
}
export async function sendPrivateMessage(