onebots 0.1.8 → 0.1.10
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.
|
@@ -15,25 +15,27 @@ async function processMusic(target_type, target_id, element) {
|
|
|
15
15
|
}
|
|
16
16
|
exports.processMusic = processMusic;
|
|
17
17
|
async function processMessage(message, quote_id) {
|
|
18
|
-
const forward = message.find(e => e.type === '
|
|
18
|
+
const forward = message.find(e => e.type === 'forward');
|
|
19
19
|
if (forward)
|
|
20
20
|
(0, utils_1.remove)(message, forward);
|
|
21
21
|
let quote = message.find(e => e.type === 'reply');
|
|
22
22
|
if (quote)
|
|
23
23
|
(0, utils_1.remove)(message, quote);
|
|
24
|
+
// 直接发node?不允许,你用forward作为载体吧
|
|
25
|
+
message = message.filter(n => n.type !== 'node');
|
|
24
26
|
const element = V12_1.V12.fromSegment(message);
|
|
25
27
|
if (forward)
|
|
26
28
|
element.unshift(
|
|
27
29
|
// 构造抓发消息
|
|
28
30
|
await this.makeForwardMsg(await Promise.all(
|
|
29
31
|
// 处理转发消息段
|
|
30
|
-
forward.data.
|
|
32
|
+
forward.data.nodes.filter(n => n.type === 'node').map(async (forwardNode) => {
|
|
31
33
|
return {
|
|
32
34
|
// 转发套转发处理
|
|
33
|
-
message: (await processMessage.apply(this, [V12_1.V12.fromSegment(
|
|
34
|
-
user_id:
|
|
35
|
-
nickname:
|
|
36
|
-
time:
|
|
35
|
+
message: (await processMessage.apply(this, [V12_1.V12.fromSegment(forwardNode.data.message)])).element,
|
|
36
|
+
user_id: Number(forwardNode.data.user_id),
|
|
37
|
+
nickname: forwardNode.data.user_name,
|
|
38
|
+
time: forwardNode.data.time
|
|
37
39
|
};
|
|
38
40
|
}))));
|
|
39
41
|
if (quote && !quote_id)
|
|
@@ -60,7 +60,7 @@ export declare namespace V12 {
|
|
|
60
60
|
interface SegmentMap {
|
|
61
61
|
face: {
|
|
62
62
|
id: number;
|
|
63
|
-
text
|
|
63
|
+
text?: string;
|
|
64
64
|
};
|
|
65
65
|
text: {
|
|
66
66
|
text: string;
|
|
@@ -81,6 +81,9 @@ export declare namespace V12 {
|
|
|
81
81
|
file: {
|
|
82
82
|
file_id: string;
|
|
83
83
|
};
|
|
84
|
+
forward: {
|
|
85
|
+
nodes: SegmentElem<'node'>[];
|
|
86
|
+
};
|
|
84
87
|
music: {
|
|
85
88
|
type: "163" | 'qq' | 'xm' | 'custom';
|
|
86
89
|
id?: string;
|
|
@@ -91,11 +94,11 @@ export declare namespace V12 {
|
|
|
91
94
|
location: {
|
|
92
95
|
latitude: number;
|
|
93
96
|
longitude: number;
|
|
94
|
-
title
|
|
95
|
-
content
|
|
97
|
+
title?: string;
|
|
98
|
+
content?: string;
|
|
96
99
|
};
|
|
97
100
|
node: {
|
|
98
|
-
user_id:
|
|
101
|
+
user_id: string;
|
|
99
102
|
time?: number;
|
|
100
103
|
user_name?: string;
|
|
101
104
|
message: SegmentElem[];
|