@im-more/dsh-onebot 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/cordis.patch.yml +11 -0
- package/lib/index.js +2003 -0
- package/lib/index.js.map +1 -0
- package/lib/types/bot.d.ts +55 -0
- package/lib/types/bot.d.ts.map +1 -0
- package/lib/types/bot.js +140 -0
- package/lib/types/bot.js.map +1 -0
- package/lib/types/config.d.ts +40 -0
- package/lib/types/config.d.ts.map +1 -0
- package/lib/types/config.js +33 -0
- package/lib/types/config.js.map +1 -0
- package/lib/types/cqcode.d.ts +29 -0
- package/lib/types/cqcode.d.ts.map +1 -0
- package/lib/types/cqcode.js +73 -0
- package/lib/types/cqcode.js.map +1 -0
- package/lib/types/decode.d.ts +106 -0
- package/lib/types/decode.d.ts.map +1 -0
- package/lib/types/decode.js +433 -0
- package/lib/types/decode.js.map +1 -0
- package/lib/types/errors.d.ts +32 -0
- package/lib/types/errors.d.ts.map +1 -0
- package/lib/types/errors.js +117 -0
- package/lib/types/errors.js.map +1 -0
- package/lib/types/identity.d.ts +18 -0
- package/lib/types/identity.d.ts.map +1 -0
- package/lib/types/identity.js +27 -0
- package/lib/types/identity.js.map +1 -0
- package/lib/types/index.d.ts +7 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +6 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/modes/segment.d.ts +16 -0
- package/lib/types/modes/segment.d.ts.map +1 -0
- package/lib/types/modes/segment.js +80 -0
- package/lib/types/modes/segment.js.map +1 -0
- package/lib/types/modes/shared.d.ts +101 -0
- package/lib/types/modes/shared.d.ts.map +1 -0
- package/lib/types/modes/shared.js +208 -0
- package/lib/types/modes/shared.js.map +1 -0
- package/lib/types/request.d.ts +64 -0
- package/lib/types/request.d.ts.map +1 -0
- package/lib/types/request.js +108 -0
- package/lib/types/request.js.map +1 -0
- package/lib/types/send.d.ts +93 -0
- package/lib/types/send.d.ts.map +1 -0
- package/lib/types/send.js +161 -0
- package/lib/types/send.js.map +1 -0
- package/lib/types/transport/http.d.ts +29 -0
- package/lib/types/transport/http.d.ts.map +1 -0
- package/lib/types/transport/http.js +158 -0
- package/lib/types/transport/http.js.map +1 -0
- package/lib/types/transport/shared.d.ts +48 -0
- package/lib/types/transport/shared.d.ts.map +1 -0
- package/lib/types/transport/shared.js +75 -0
- package/lib/types/transport/shared.js.map +1 -0
- package/lib/types/transport/ws-reverse.d.ts +42 -0
- package/lib/types/transport/ws-reverse.d.ts.map +1 -0
- package/lib/types/transport/ws-reverse.js +178 -0
- package/lib/types/transport/ws-reverse.js.map +1 -0
- package/lib/types/transport/ws.d.ts +40 -0
- package/lib/types/transport/ws.d.ts.map +1 -0
- package/lib/types/transport/ws.js +233 -0
- package/lib/types/transport/ws.js.map +1 -0
- package/lib/types/types.d.ts +495 -0
- package/lib/types/types.d.ts.map +1 -0
- package/lib/types/types.js +191 -0
- package/lib/types/types.js.map +1 -0
- package/package.json +68 -3
- package/src/bot.ts +230 -0
- package/src/config.ts +66 -0
- package/src/cqcode.ts +85 -0
- package/src/decode.ts +524 -0
- package/src/errors.ts +134 -0
- package/src/identity.ts +34 -0
- package/src/index.ts +18 -0
- package/src/modes/segment.ts +109 -0
- package/src/modes/shared.ts +277 -0
- package/src/request.ts +128 -0
- package/src/send.ts +233 -0
- package/src/transport/http.ts +221 -0
- package/src/transport/shared.ts +98 -0
- package/src/transport/ws-reverse.ts +236 -0
- package/src/transport/ws.ts +286 -0
- package/src/types.ts +743 -0
- package/README.md +0 -3
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Dict } from '@deepseek-ai/cosmokit';
|
|
2
|
+
/**
|
|
3
|
+
* One message segment of a string-format message.
|
|
4
|
+
*
|
|
5
|
+
* `data` is the segment's parameters, unescaped; a `text` segment carries `data.text`. `capture` is the match of the
|
|
6
|
+
* upstream parser and stays on the shape the migrated `types.ts` imports.
|
|
7
|
+
*/
|
|
8
|
+
export interface CQCode {
|
|
9
|
+
type: string;
|
|
10
|
+
data: Dict<string>;
|
|
11
|
+
capture?: RegExpExecArray;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Undo the CQ code escapes of text outside segments and of one parameter value.
|
|
15
|
+
* @param source - escaped text.
|
|
16
|
+
* @returns the text with `[`, `]`, `,` and `&` restored.
|
|
17
|
+
*/
|
|
18
|
+
export declare function unescapeCQ(source: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Parse a string-format (CQ code) message into segments.
|
|
21
|
+
*
|
|
22
|
+
* Text outside segments becomes a `text` segment with its escapes undone. A `[CQ:` that does not open a well-formed
|
|
23
|
+
* segment stays literal text. Only the first `]` closes a segment: `]` inside a value is escaped as `]`.
|
|
24
|
+
*
|
|
25
|
+
* @param source - the raw `message` string (or `raw_message`).
|
|
26
|
+
* @returns the segments in order; empty for an empty input.
|
|
27
|
+
*/
|
|
28
|
+
export declare function parseCqCode(source: string): CQCode[];
|
|
29
|
+
//# sourceMappingURL=cqcode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cqcode.d.ts","sourceRoot":"","sources":["../../src/cqcode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAEjD;;;;;GAKG;AACH,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;IAClB,OAAO,CAAC,EAAE,eAAe,CAAA;CAC1B;AAKD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMjD;AAcD;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAiCpD"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/** Segment types are `\w+` in CQ code; anything else is literal text. */
|
|
2
|
+
const TYPE = /^[A-Za-z0-9_.-]+$/;
|
|
3
|
+
/**
|
|
4
|
+
* Undo the CQ code escapes of text outside segments and of one parameter value.
|
|
5
|
+
* @param source - escaped text.
|
|
6
|
+
* @returns the text with `[`, `]`, `,` and `&` restored.
|
|
7
|
+
*/
|
|
8
|
+
export function unescapeCQ(source) {
|
|
9
|
+
return source
|
|
10
|
+
.replaceAll('[', '[')
|
|
11
|
+
.replaceAll(']', ']')
|
|
12
|
+
.replaceAll(',', ',')
|
|
13
|
+
.replaceAll('&', '&');
|
|
14
|
+
}
|
|
15
|
+
/** Parse the parameter list after `[CQ:type`; a value may itself contain `=`. */
|
|
16
|
+
function parseParams(body) {
|
|
17
|
+
const data = {};
|
|
18
|
+
if (body === '')
|
|
19
|
+
return data;
|
|
20
|
+
for (const pair of body.split(',')) {
|
|
21
|
+
const equals = pair.indexOf('=');
|
|
22
|
+
if (equals <= 0)
|
|
23
|
+
continue;
|
|
24
|
+
data[pair.slice(0, equals)] = unescapeCQ(pair.slice(equals + 1));
|
|
25
|
+
}
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Parse a string-format (CQ code) message into segments.
|
|
30
|
+
*
|
|
31
|
+
* Text outside segments becomes a `text` segment with its escapes undone. A `[CQ:` that does not open a well-formed
|
|
32
|
+
* segment stays literal text. Only the first `]` closes a segment: `]` inside a value is escaped as `]`.
|
|
33
|
+
*
|
|
34
|
+
* @param source - the raw `message` string (or `raw_message`).
|
|
35
|
+
* @returns the segments in order; empty for an empty input.
|
|
36
|
+
*/
|
|
37
|
+
export function parseCqCode(source) {
|
|
38
|
+
const segments = [];
|
|
39
|
+
let cursor = 0;
|
|
40
|
+
let search = 0;
|
|
41
|
+
const flushText = (end) => {
|
|
42
|
+
if (end <= cursor)
|
|
43
|
+
return;
|
|
44
|
+
const text = unescapeCQ(source.slice(cursor, end));
|
|
45
|
+
if (text !== '')
|
|
46
|
+
segments.push({ type: 'text', data: { text } });
|
|
47
|
+
};
|
|
48
|
+
while (search < source.length) {
|
|
49
|
+
const start = source.indexOf('[CQ:', search);
|
|
50
|
+
if (start < 0)
|
|
51
|
+
break;
|
|
52
|
+
const end = source.indexOf(']', start + 4);
|
|
53
|
+
if (end < 0)
|
|
54
|
+
break;
|
|
55
|
+
const body = source.slice(start + 4, end);
|
|
56
|
+
const comma = body.indexOf(',');
|
|
57
|
+
const type = comma < 0 ? body : body.slice(0, comma);
|
|
58
|
+
if (!TYPE.test(type)) {
|
|
59
|
+
search = start + 4;
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
flushText(start);
|
|
63
|
+
segments.push({
|
|
64
|
+
type,
|
|
65
|
+
data: parseParams(comma < 0 ? '' : body.slice(comma + 1)),
|
|
66
|
+
});
|
|
67
|
+
cursor = end + 1;
|
|
68
|
+
search = cursor;
|
|
69
|
+
}
|
|
70
|
+
flushText(source.length);
|
|
71
|
+
return segments;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=cqcode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cqcode.js","sourceRoot":"","sources":["../../src/cqcode.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inbound decoding: one OneBot 11 event becomes an intake `Session`.
|
|
3
|
+
*
|
|
4
|
+
* Message events and the two recall notices are decoded; every other `post_type` is ignored. Segment content keeps
|
|
5
|
+
* its text: a segment the vocabulary cannot express becomes a readable placeholder instead of disappearing, and an
|
|
6
|
+
* event that carries no segment at all becomes an inbound `<raw>` element, because `InboundMessage.content` may not
|
|
7
|
+
* be empty.
|
|
8
|
+
*/
|
|
9
|
+
import { type ChatRef, type Element, type InboundMessage, type Session, type UserRef } from '@deepseek-ai/cordis-plugin-im-core';
|
|
10
|
+
import type { OneBotBot } from './bot.ts';
|
|
11
|
+
import { type CQCode } from './cqcode.ts';
|
|
12
|
+
import type { AnonymousInfo, Payload, SenderInfo } from './types.ts';
|
|
13
|
+
/** Adapter-private context carried through `Target.referrer`. */
|
|
14
|
+
export interface OneBotReferrer {
|
|
15
|
+
chatId: string;
|
|
16
|
+
messageId: string;
|
|
17
|
+
time: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The fields decoding reads: a `message` event, a `get_msg` answer, or the content of one forwarded node.
|
|
21
|
+
* Every field is optional because those three wire shapes differ in which ones they carry.
|
|
22
|
+
*/
|
|
23
|
+
export interface MessageLike {
|
|
24
|
+
message_id?: number;
|
|
25
|
+
real_id?: number;
|
|
26
|
+
time?: number;
|
|
27
|
+
post_type?: string;
|
|
28
|
+
notice_type?: string;
|
|
29
|
+
message_type?: 'private' | 'group' | 'guild';
|
|
30
|
+
sub_type?: string;
|
|
31
|
+
sender?: Partial<SenderInfo>;
|
|
32
|
+
user_id?: number;
|
|
33
|
+
target_id?: number;
|
|
34
|
+
group_id?: number;
|
|
35
|
+
message?: unknown;
|
|
36
|
+
raw_message?: string;
|
|
37
|
+
anonymous?: AnonymousInfo;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Validate one wire segment list.
|
|
41
|
+
*
|
|
42
|
+
* The array message format is JSON from another process, so every field is checked: a segment without a string `type`
|
|
43
|
+
* is dropped, and parameter values are kept only when they are strings or numbers.
|
|
44
|
+
*
|
|
45
|
+
* @param value - a `message` field or a forwarded node's `content`.
|
|
46
|
+
* @returns the segments that can be decoded.
|
|
47
|
+
*/
|
|
48
|
+
export declare function normalizeSegments(value: unknown): CQCode[];
|
|
49
|
+
/** What one segment list decodes to. */
|
|
50
|
+
interface ContentParts {
|
|
51
|
+
nodes: Element[];
|
|
52
|
+
quote: string | undefined;
|
|
53
|
+
mentions: {
|
|
54
|
+
self: boolean;
|
|
55
|
+
all: boolean;
|
|
56
|
+
users: UserRef[];
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Decode one message's segments into the element vocabulary.
|
|
61
|
+
*
|
|
62
|
+
* @param bot - the receiving adapter (its `selfId` decides `mentions.self`).
|
|
63
|
+
* @param segments - validated segments.
|
|
64
|
+
* @returns the content nodes, the quoted message id and the mentions.
|
|
65
|
+
*/
|
|
66
|
+
export declare function decodeSegments(bot: OneBotBot, segments: readonly CQCode[]): ContentParts;
|
|
67
|
+
/** The chat a message was sent in. */
|
|
68
|
+
export declare function chatOfMessage(data: MessageLike): ChatRef;
|
|
69
|
+
/**
|
|
70
|
+
* Decode one message payload.
|
|
71
|
+
* @param bot - the receiving adapter.
|
|
72
|
+
* @param data - a message event, or a `get_msg` answer.
|
|
73
|
+
* @param chat - the chat to report; a `get_msg` answer carries no group id, so the caller passes its own.
|
|
74
|
+
* @returns the inbound message.
|
|
75
|
+
*/
|
|
76
|
+
export declare function decodeMessage(bot: OneBotBot, data: MessageLike, chat?: ChatRef): InboundMessage;
|
|
77
|
+
/**
|
|
78
|
+
* Decode one platform event.
|
|
79
|
+
*
|
|
80
|
+
* The event id is synthesized because OneBot events carry none, and the host dedupes on it: `message_id` alone would
|
|
81
|
+
* collide with the ids some implementations restart from zero.
|
|
82
|
+
*
|
|
83
|
+
* @param bot - the receiving adapter.
|
|
84
|
+
* @param data - the event payload.
|
|
85
|
+
* @returns the session to publish, or undefined for an ignored event.
|
|
86
|
+
*/
|
|
87
|
+
export declare function decodePayload(bot: OneBotBot, data: Payload): Session | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* Whether a parsed frame is one platform event.
|
|
90
|
+
* @param value - a parsed JSON frame from the implementation.
|
|
91
|
+
* @returns whether it is an event rather than an action answer.
|
|
92
|
+
*/
|
|
93
|
+
export declare function isPayload(value: unknown): value is Payload;
|
|
94
|
+
/**
|
|
95
|
+
* Expand the merged forwards of one message into phrasing content, as the host's `im_read` expects.
|
|
96
|
+
*
|
|
97
|
+
* One forwarded node renders as its author in bold, a colon, the node content and a line break. The content model of
|
|
98
|
+
* `<forward>` is phrasing, so no block element may be inserted.
|
|
99
|
+
*
|
|
100
|
+
* @param bot - the adapter, used for the `get_forward_msg` call.
|
|
101
|
+
* @param message - the decoded message.
|
|
102
|
+
* @returns the same message with every `forward` element expanded.
|
|
103
|
+
*/
|
|
104
|
+
export declare function expandForward(bot: OneBotBot, message: InboundMessage): Promise<InboundMessage>;
|
|
105
|
+
export {};
|
|
106
|
+
//# sourceMappingURL=decode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../src/decode.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,OAAO,EAEZ,KAAK,cAAc,EAGnB,KAAK,OAAO,EACZ,KAAK,OAAO,EACb,MAAM,oCAAoC,CAAA;AAE3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACzC,OAAO,EAAE,KAAK,MAAM,EAAe,MAAM,aAAa,CAAA;AAEtD,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEpE,iEAAiE;AACjE,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,OAAO,CAAA;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAA;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,aAAa,CAAA;CAC1B;AA4DD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAmB1D;AAaD,wCAAwC;AACxC,UAAU,YAAY;IACpB,KAAK,EAAE,OAAO,EAAE,CAAA;IAChB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,QAAQ,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,GAAG,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,OAAO,EAAE,CAAA;KAAE,CAAA;CAC5D;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,SAAS,EACd,QAAQ,EAAE,SAAS,MAAM,EAAE,GAC1B,YAAY,CAiGd;AAoBD,sCAAsC;AACtC,wBAAgB,aAAa,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CASxD;AAgBD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,WAAW,EACjB,IAAI,GAAE,OAA6B,GAClC,cAAc,CAkChB;AA2BD;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,OAAO,GACZ,OAAO,GAAG,SAAS,CAuBrB;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAG1D;AAqDD;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,SAAS,EACd,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,cAAc,CAAC,CA2BzB"}
|
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inbound decoding: one OneBot 11 event becomes an intake `Session`.
|
|
3
|
+
*
|
|
4
|
+
* Message events and the two recall notices are decoded; every other `post_type` is ignored. Segment content keeps
|
|
5
|
+
* its text: a segment the vocabulary cannot express becomes a readable placeholder instead of disappearing, and an
|
|
6
|
+
* event that carries no segment at all becomes an inbound `<raw>` element, because `InboundMessage.content` may not
|
|
7
|
+
* be empty.
|
|
8
|
+
*/
|
|
9
|
+
import { h, normalize, PlatformError, } from '@deepseek-ai/cordis-plugin-im-core';
|
|
10
|
+
import { parseCqCode } from "./cqcode.js";
|
|
11
|
+
import { GROUP_PREFIX, PRIVATE_PREFIX } from "./modes/shared.js";
|
|
12
|
+
/** Text of a segment that has no element of its own. */
|
|
13
|
+
function placeholderOf(type, data) {
|
|
14
|
+
switch (type) {
|
|
15
|
+
case 'poke':
|
|
16
|
+
return '[戳一戳]';
|
|
17
|
+
case 'rps':
|
|
18
|
+
return '[猜拳]';
|
|
19
|
+
case 'dice':
|
|
20
|
+
return '[骰子]';
|
|
21
|
+
case 'shake':
|
|
22
|
+
return '[抖动]';
|
|
23
|
+
case 'anonymous':
|
|
24
|
+
return '[匿名消息]';
|
|
25
|
+
case 'contact':
|
|
26
|
+
return '[名片]';
|
|
27
|
+
case 'music':
|
|
28
|
+
return '[音乐]';
|
|
29
|
+
case 'tts':
|
|
30
|
+
return '[语音]';
|
|
31
|
+
case 'mface':
|
|
32
|
+
return '[表情]';
|
|
33
|
+
case 'markdown':
|
|
34
|
+
return '[Markdown]';
|
|
35
|
+
case 'keyboard':
|
|
36
|
+
return '[按钮]';
|
|
37
|
+
case 'node':
|
|
38
|
+
return '[合并转发节点]';
|
|
39
|
+
case 'location':
|
|
40
|
+
return `[位置 ${data.lat ?? '?'},${data.lon ?? '?'}]`;
|
|
41
|
+
default:
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/** The title of a JSON/XML card, when it carries one; the card body itself is not printed. */
|
|
46
|
+
function cardTitle(source) {
|
|
47
|
+
let parsed;
|
|
48
|
+
try {
|
|
49
|
+
parsed = JSON.parse(source);
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
// Not JSON: an XML card or a malformed payload, nothing to extract.
|
|
53
|
+
void error;
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
if (typeof parsed !== 'object' || parsed === null)
|
|
57
|
+
return undefined;
|
|
58
|
+
const meta = parsed.meta;
|
|
59
|
+
if (typeof meta === 'object' && meta !== null) {
|
|
60
|
+
const detail = meta.detail_1;
|
|
61
|
+
if (typeof detail === 'object' && detail !== null) {
|
|
62
|
+
const title = detail.title;
|
|
63
|
+
if (typeof title === 'string' && title !== '')
|
|
64
|
+
return title;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const prompt = parsed.prompt;
|
|
68
|
+
if (typeof prompt === 'string' && prompt !== '')
|
|
69
|
+
return prompt;
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Validate one wire segment list.
|
|
74
|
+
*
|
|
75
|
+
* The array message format is JSON from another process, so every field is checked: a segment without a string `type`
|
|
76
|
+
* is dropped, and parameter values are kept only when they are strings or numbers.
|
|
77
|
+
*
|
|
78
|
+
* @param value - a `message` field or a forwarded node's `content`.
|
|
79
|
+
* @returns the segments that can be decoded.
|
|
80
|
+
*/
|
|
81
|
+
export function normalizeSegments(value) {
|
|
82
|
+
if (typeof value === 'string')
|
|
83
|
+
return parseCqCode(value);
|
|
84
|
+
if (!Array.isArray(value))
|
|
85
|
+
return [];
|
|
86
|
+
const segments = [];
|
|
87
|
+
for (const item of value) {
|
|
88
|
+
if (typeof item !== 'object' || item === null)
|
|
89
|
+
continue;
|
|
90
|
+
const type = item.type;
|
|
91
|
+
if (typeof type !== 'string' || type === '')
|
|
92
|
+
continue;
|
|
93
|
+
const source = item.data;
|
|
94
|
+
const data = {};
|
|
95
|
+
if (typeof source === 'object' && source !== null) {
|
|
96
|
+
for (const [key, entry] of Object.entries(source)) {
|
|
97
|
+
if (typeof entry === 'string')
|
|
98
|
+
data[key] = entry;
|
|
99
|
+
else if (typeof entry === 'number')
|
|
100
|
+
data[key] = String(entry);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
segments.push({ type, data });
|
|
104
|
+
}
|
|
105
|
+
return segments;
|
|
106
|
+
}
|
|
107
|
+
/** The segments of one message: the `message` field by value, else the CQ string in `raw_message`. */
|
|
108
|
+
function segmentsOf(data) {
|
|
109
|
+
if (data.message !== undefined && data.message !== null) {
|
|
110
|
+
const segments = normalizeSegments(data.message);
|
|
111
|
+
if (segments.length > 0)
|
|
112
|
+
return segments;
|
|
113
|
+
}
|
|
114
|
+
return typeof data.raw_message === 'string'
|
|
115
|
+
? parseCqCode(data.raw_message)
|
|
116
|
+
: [];
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Decode one message's segments into the element vocabulary.
|
|
120
|
+
*
|
|
121
|
+
* @param bot - the receiving adapter (its `selfId` decides `mentions.self`).
|
|
122
|
+
* @param segments - validated segments.
|
|
123
|
+
* @returns the content nodes, the quoted message id and the mentions.
|
|
124
|
+
*/
|
|
125
|
+
export function decodeSegments(bot, segments) {
|
|
126
|
+
const nodes = [];
|
|
127
|
+
const mentions = {
|
|
128
|
+
self: false,
|
|
129
|
+
all: false,
|
|
130
|
+
users: [],
|
|
131
|
+
};
|
|
132
|
+
let quote;
|
|
133
|
+
for (const segment of segments) {
|
|
134
|
+
const data = segment.data;
|
|
135
|
+
switch (segment.type) {
|
|
136
|
+
case 'text':
|
|
137
|
+
nodes.push(h.text(data.text ?? ''));
|
|
138
|
+
break;
|
|
139
|
+
case 'face':
|
|
140
|
+
nodes.push(h('emoji', {
|
|
141
|
+
id: data.id ?? '',
|
|
142
|
+
...(data.name === undefined ? {} : { name: data.name }),
|
|
143
|
+
}));
|
|
144
|
+
break;
|
|
145
|
+
case 'image':
|
|
146
|
+
// The implementation's `url` or `file` is the source as-is; a bare file name is left for the host to skip.
|
|
147
|
+
nodes.push(h('img', { src: data.url || data.file || '' }));
|
|
148
|
+
if (data.type === 'flash')
|
|
149
|
+
nodes.push(h.text('[闪照]'));
|
|
150
|
+
break;
|
|
151
|
+
case 'record':
|
|
152
|
+
nodes.push(h('audio', { src: data.url || data.file || '' }));
|
|
153
|
+
break;
|
|
154
|
+
case 'video':
|
|
155
|
+
nodes.push(h('video', { src: data.url || data.file || '' }));
|
|
156
|
+
break;
|
|
157
|
+
case 'file':
|
|
158
|
+
nodes.push(h('file', {
|
|
159
|
+
src: data.url || data.file || '',
|
|
160
|
+
...(data.name === undefined ? {} : { name: data.name }),
|
|
161
|
+
}));
|
|
162
|
+
break;
|
|
163
|
+
case 'at': {
|
|
164
|
+
const qq = data.qq ?? '';
|
|
165
|
+
if (qq === 'all') {
|
|
166
|
+
mentions.all = true;
|
|
167
|
+
nodes.push(h('at', { type: 'all' }));
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
mentions.users.push({
|
|
171
|
+
id: qq,
|
|
172
|
+
...(data.name === undefined ? {} : { name: data.name }),
|
|
173
|
+
});
|
|
174
|
+
if (qq === bot.selfId)
|
|
175
|
+
mentions.self = true;
|
|
176
|
+
nodes.push(h('at', {
|
|
177
|
+
type: 'user',
|
|
178
|
+
id: qq,
|
|
179
|
+
...(data.name === undefined ? {} : { name: data.name }),
|
|
180
|
+
}));
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
case 'reply':
|
|
184
|
+
// The quoted message is an id only; the host formats the reply from what it stored.
|
|
185
|
+
quote = data.id ?? '';
|
|
186
|
+
break;
|
|
187
|
+
case 'forward':
|
|
188
|
+
nodes.push(h('forward', { id: data.id ?? '' }));
|
|
189
|
+
break;
|
|
190
|
+
case 'share':
|
|
191
|
+
nodes.push(h('a', { href: data.url ?? '' }, data.title ?? ''));
|
|
192
|
+
break;
|
|
193
|
+
case 'json':
|
|
194
|
+
case 'xml': {
|
|
195
|
+
const title = cardTitle(data.data ?? '');
|
|
196
|
+
nodes.push(h.text(title === undefined ? '[卡片]' : `[卡片] ${title}`));
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
default: {
|
|
200
|
+
const placeholder = placeholderOf(segment.type, data);
|
|
201
|
+
if (placeholder !== undefined) {
|
|
202
|
+
nodes.push(h.text(placeholder));
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
const text = data.text;
|
|
206
|
+
nodes.push(h.text(text !== undefined && text !== '' ? text : `[${segment.type}]`));
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return { nodes, quote, mentions };
|
|
212
|
+
}
|
|
213
|
+
/** A bounded description of an event that decoded to no content, so `<raw>` stays small. */
|
|
214
|
+
function rawPreview(data) {
|
|
215
|
+
const preview = {};
|
|
216
|
+
for (const key of [
|
|
217
|
+
'post_type',
|
|
218
|
+
'message_type',
|
|
219
|
+
'notice_type',
|
|
220
|
+
'sub_type',
|
|
221
|
+
'message_id',
|
|
222
|
+
'group_id',
|
|
223
|
+
'user_id',
|
|
224
|
+
]) {
|
|
225
|
+
const value = data[key];
|
|
226
|
+
if (value !== undefined)
|
|
227
|
+
preview[key] = String(value);
|
|
228
|
+
}
|
|
229
|
+
return preview;
|
|
230
|
+
}
|
|
231
|
+
/** The chat a message was sent in. */
|
|
232
|
+
export function chatOfMessage(data) {
|
|
233
|
+
if (data.message_type === 'group' ||
|
|
234
|
+
(data.message_type === undefined && data.group_id !== undefined)) {
|
|
235
|
+
return { id: `${GROUP_PREFIX}${data.group_id ?? 0}`, type: 'group' };
|
|
236
|
+
}
|
|
237
|
+
const userId = data.sender?.user_id ?? data.user_id ?? data.target_id ?? 0;
|
|
238
|
+
return { id: `${PRIVATE_PREFIX}${userId}`, type: 'direct' };
|
|
239
|
+
}
|
|
240
|
+
/** The sender of one message; an anonymous group message has no usable sender, so its anonymous id stands in. */
|
|
241
|
+
function senderOf(data) {
|
|
242
|
+
if (data.anonymous !== undefined) {
|
|
243
|
+
return { id: String(data.anonymous.id), name: '匿名用户' };
|
|
244
|
+
}
|
|
245
|
+
const sender = data.sender ?? {};
|
|
246
|
+
const name = sender.card || sender.nickname;
|
|
247
|
+
return {
|
|
248
|
+
id: String(sender.user_id ?? data.user_id ?? 0),
|
|
249
|
+
...(name === undefined || name === '' ? {} : { name }),
|
|
250
|
+
...(sender.role === undefined ? {} : { role: sender.role }),
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Decode one message payload.
|
|
255
|
+
* @param bot - the receiving adapter.
|
|
256
|
+
* @param data - a message event, or a `get_msg` answer.
|
|
257
|
+
* @param chat - the chat to report; a `get_msg` answer carries no group id, so the caller passes its own.
|
|
258
|
+
* @returns the inbound message.
|
|
259
|
+
*/
|
|
260
|
+
export function decodeMessage(bot, data, chat = chatOfMessage(data)) {
|
|
261
|
+
const parts = decodeSegments(bot, segmentsOf(data));
|
|
262
|
+
const id = String(data.message_id ?? 0);
|
|
263
|
+
const time = (data.time ?? Math.floor(Date.now() / 1_000)) * 1_000;
|
|
264
|
+
const content = normalize(parts.nodes.length > 0
|
|
265
|
+
? parts.nodes
|
|
266
|
+
: [
|
|
267
|
+
h('raw', {
|
|
268
|
+
platform: 'onebot',
|
|
269
|
+
type: data.post_type ?? 'message',
|
|
270
|
+
data: rawPreview(data),
|
|
271
|
+
}, h.text('')),
|
|
272
|
+
]);
|
|
273
|
+
const realId = data.real_id;
|
|
274
|
+
return {
|
|
275
|
+
id,
|
|
276
|
+
...(realId === undefined || String(realId) === id
|
|
277
|
+
? {}
|
|
278
|
+
: { aliases: [String(realId)] }),
|
|
279
|
+
chat,
|
|
280
|
+
sender: senderOf(data),
|
|
281
|
+
content,
|
|
282
|
+
...(parts.quote === undefined ? {} : { quote: { id: parts.quote } }),
|
|
283
|
+
mentions: parts.mentions,
|
|
284
|
+
time,
|
|
285
|
+
referrer: { chatId: chat.id, messageId: id, time },
|
|
286
|
+
raw: data,
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
/** One `notice` that reports a recalled message. */
|
|
290
|
+
function deletedSession(bot, data) {
|
|
291
|
+
const group = data.notice_type === 'group_recall';
|
|
292
|
+
const chat = group
|
|
293
|
+
? { id: `${GROUP_PREFIX}${data.group_id ?? 0}`, type: 'group' }
|
|
294
|
+
: {
|
|
295
|
+
id: `${PRIVATE_PREFIX}${data.user_id ?? data.target_id ?? 0}`,
|
|
296
|
+
type: 'direct',
|
|
297
|
+
};
|
|
298
|
+
const time = (data.time ?? Math.floor(Date.now() / 1_000)) * 1_000;
|
|
299
|
+
return bot.session({
|
|
300
|
+
type: 'message-deleted',
|
|
301
|
+
id: `notice:${data.notice_type}:${data.time}:${data.message_id}`,
|
|
302
|
+
timestamp: time,
|
|
303
|
+
deleted: {
|
|
304
|
+
id: String(data.message_id),
|
|
305
|
+
chat,
|
|
306
|
+
...(data.operator_id === undefined
|
|
307
|
+
? {}
|
|
308
|
+
: { operator: { id: String(data.operator_id) } }),
|
|
309
|
+
},
|
|
310
|
+
raw: data,
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Decode one platform event.
|
|
315
|
+
*
|
|
316
|
+
* The event id is synthesized because OneBot events carry none, and the host dedupes on it: `message_id` alone would
|
|
317
|
+
* collide with the ids some implementations restart from zero.
|
|
318
|
+
*
|
|
319
|
+
* @param bot - the receiving adapter.
|
|
320
|
+
* @param data - the event payload.
|
|
321
|
+
* @returns the session to publish, or undefined for an ignored event.
|
|
322
|
+
*/
|
|
323
|
+
export function decodePayload(bot, data) {
|
|
324
|
+
if (data.post_type === 'message') {
|
|
325
|
+
if (data.message_type !== 'private' && data.message_type !== 'group') {
|
|
326
|
+
return undefined;
|
|
327
|
+
}
|
|
328
|
+
const message = decodeMessage(bot, data);
|
|
329
|
+
return bot.session({
|
|
330
|
+
type: 'message',
|
|
331
|
+
id: `message:${data.message_id}:${data.time}`,
|
|
332
|
+
timestamp: message.time,
|
|
333
|
+
message,
|
|
334
|
+
raw: data,
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
if (data.post_type === 'notice') {
|
|
338
|
+
if (data.notice_type === 'group_recall' ||
|
|
339
|
+
data.notice_type === 'friend_recall') {
|
|
340
|
+
return deletedSession(bot, data);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
return undefined;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Whether a parsed frame is one platform event.
|
|
347
|
+
* @param value - a parsed JSON frame from the implementation.
|
|
348
|
+
* @returns whether it is an event rather than an action answer.
|
|
349
|
+
*/
|
|
350
|
+
export function isPayload(value) {
|
|
351
|
+
if (typeof value !== 'object' || value === null)
|
|
352
|
+
return false;
|
|
353
|
+
return typeof value.post_type === 'string';
|
|
354
|
+
}
|
|
355
|
+
/** Read the node list of a `get_forward_msg` answer; the standard calls it `message`, go-cqhttp `messages`. */
|
|
356
|
+
function forwardNodesOf(source) {
|
|
357
|
+
if (typeof source !== 'object' || source === null)
|
|
358
|
+
return [];
|
|
359
|
+
const record = source;
|
|
360
|
+
const list = Array.isArray(record.messages)
|
|
361
|
+
? record.messages
|
|
362
|
+
: Array.isArray(record.message)
|
|
363
|
+
? record.message
|
|
364
|
+
: [];
|
|
365
|
+
const nodes = [];
|
|
366
|
+
for (const entry of list) {
|
|
367
|
+
if (typeof entry !== 'object' || entry === null)
|
|
368
|
+
continue;
|
|
369
|
+
if (entry.type !== 'node')
|
|
370
|
+
continue;
|
|
371
|
+
const data = entry.data;
|
|
372
|
+
if (typeof data !== 'object' || data === null)
|
|
373
|
+
continue;
|
|
374
|
+
const fields = data;
|
|
375
|
+
const nickname = typeof fields.nickname === 'string'
|
|
376
|
+
? fields.nickname
|
|
377
|
+
: typeof fields.name === 'string'
|
|
378
|
+
? fields.name
|
|
379
|
+
: '';
|
|
380
|
+
nodes.push({ nickname, content: fields.content });
|
|
381
|
+
}
|
|
382
|
+
return nodes;
|
|
383
|
+
}
|
|
384
|
+
/** Collect the empty `forward` placeholders of a decoded message. */
|
|
385
|
+
function collectForwards(content) {
|
|
386
|
+
const found = [];
|
|
387
|
+
const walk = (element) => {
|
|
388
|
+
if (element.type === 'forward') {
|
|
389
|
+
if (element.children.length === 0)
|
|
390
|
+
found.push(element);
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
for (const child of element.children)
|
|
394
|
+
walk(child);
|
|
395
|
+
};
|
|
396
|
+
walk(content);
|
|
397
|
+
return found;
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Expand the merged forwards of one message into phrasing content, as the host's `im_read` expects.
|
|
401
|
+
*
|
|
402
|
+
* One forwarded node renders as its author in bold, a colon, the node content and a line break. The content model of
|
|
403
|
+
* `<forward>` is phrasing, so no block element may be inserted.
|
|
404
|
+
*
|
|
405
|
+
* @param bot - the adapter, used for the `get_forward_msg` call.
|
|
406
|
+
* @param message - the decoded message.
|
|
407
|
+
* @returns the same message with every `forward` element expanded.
|
|
408
|
+
*/
|
|
409
|
+
export async function expandForward(bot, message) {
|
|
410
|
+
const forwards = collectForwards(message.content);
|
|
411
|
+
if (forwards.length === 0)
|
|
412
|
+
return message;
|
|
413
|
+
const request = bot.internal._request;
|
|
414
|
+
if (request === undefined) {
|
|
415
|
+
throw new PlatformError('retryable', 'onebot: cannot read the forwarded message while the transport is not connected', { published: 'unknown' });
|
|
416
|
+
}
|
|
417
|
+
for (const element of forwards) {
|
|
418
|
+
const response = await request('get_forward_msg', {
|
|
419
|
+
message_id: element.attrs.id,
|
|
420
|
+
});
|
|
421
|
+
if (response.retcode !== 0)
|
|
422
|
+
continue;
|
|
423
|
+
const children = [];
|
|
424
|
+
for (const node of forwardNodesOf(response.data)) {
|
|
425
|
+
children.push(h('b', {}, h.text(node.nickname)), h.text(': '));
|
|
426
|
+
children.push(...decodeSegments(bot, normalizeSegments(node.content)).nodes);
|
|
427
|
+
children.push(h('br'));
|
|
428
|
+
}
|
|
429
|
+
element.children = children;
|
|
430
|
+
}
|
|
431
|
+
return message;
|
|
432
|
+
}
|
|
433
|
+
//# sourceMappingURL=decode.js.map
|