feat(onebot): expose bidirectional message history
Add reverse_order to group and private history actions, preserve latest-page behavior without an anchor, and keep local fallback results chronologically ordered. Key self-sent private messages and reply targets by the conversation peer, reject cross-conversation anchors, and include request context when a server fetch falls back to local history. Refs #229
This commit is contained in:
17 files changed
+468
-70
No files matched your search
@@ -91,8 +91,12 @@ describe('convertEvent — message kinds', () => {
|
||||
});
|
||||
|
||||
it('friend_message self → post_type "message_sent"', async () => {
|
||||
const out = await convertEvent(bareCtx(), makeFriendMessage(SELF_ID));
|
||||
const event = { ...makeFriendMessage(SELF_ID), peerUin: PEER_UIN } as FriendMessage;
|
||||
const resolver = (_isGroup: boolean, sessionId: number, seq: number) => sessionId + seq;
|
||||
const out = await convertEvent(bareCtx({ messageIdResolver: resolver }), event);
|
||||
expect(out!.post_type).toBe('message_sent');
|
||||
expect(out!.target_id).toBe(PEER_UIN);
|
||||
expect(out!.message_id).toBe(PEER_UIN + 1);
|
||||
});
|
||||
|
||||
it('group_message peer → post_type "message", sub_type "normal", group_id set', async () => {
|
||||
|
||||
Reference in new issue
Block a user