onebots 0.1.7 → 0.1.9
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,25 @@ 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
|
|
19
|
-
if (
|
|
20
|
-
(
|
|
18
|
+
const forwardNodes = message.filter(e => e.type === 'node');
|
|
19
|
+
if (forwardNodes.length)
|
|
20
|
+
message = message.filter((segment) => !forwardNodes.includes(segment));
|
|
21
21
|
let quote = message.find(e => e.type === 'reply');
|
|
22
22
|
if (quote)
|
|
23
23
|
(0, utils_1.remove)(message, quote);
|
|
24
24
|
const element = V12_1.V12.fromSegment(message);
|
|
25
|
-
if (
|
|
25
|
+
if (forwardNodes)
|
|
26
26
|
element.unshift(
|
|
27
27
|
// 构造抓发消息
|
|
28
28
|
await this.makeForwardMsg(await Promise.all(
|
|
29
29
|
// 处理转发消息段
|
|
30
|
-
|
|
30
|
+
forwardNodes.map(async (forwardNode) => {
|
|
31
31
|
return {
|
|
32
32
|
// 转发套转发处理
|
|
33
|
-
message: (await processMessage.apply(this, [V12_1.V12.fromSegment(
|
|
34
|
-
user_id:
|
|
35
|
-
nickname:
|
|
36
|
-
time:
|
|
33
|
+
message: (await processMessage.apply(this, [V12_1.V12.fromSegment(forwardNode.data.message)])).element,
|
|
34
|
+
user_id: Number(forwardNode.data.user_id),
|
|
35
|
+
nickname: forwardNode.data.user_name,
|
|
36
|
+
time: forwardNode.data.time
|
|
37
37
|
};
|
|
38
38
|
}))));
|
|
39
39
|
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;
|
|
@@ -91,11 +91,11 @@ export declare namespace V12 {
|
|
|
91
91
|
location: {
|
|
92
92
|
latitude: number;
|
|
93
93
|
longitude: number;
|
|
94
|
-
title
|
|
95
|
-
content
|
|
94
|
+
title?: string;
|
|
95
|
+
content?: string;
|
|
96
96
|
};
|
|
97
97
|
node: {
|
|
98
|
-
user_id:
|
|
98
|
+
user_id: string;
|
|
99
99
|
time?: number;
|
|
100
100
|
user_name?: string;
|
|
101
101
|
message: SegmentElem[];
|
package/lib/service/V12/index.js
CHANGED
|
@@ -556,8 +556,15 @@ class V12 extends events_1.EventEmitter {
|
|
|
556
556
|
}));
|
|
557
557
|
}
|
|
558
558
|
});
|
|
559
|
-
this.dispatch(V12.formatPayload(this.oneBot.uin, "connect",
|
|
560
|
-
|
|
559
|
+
this.dispatch(V12.formatPayload(this.oneBot.uin, "connect", {
|
|
560
|
+
detail_type: "connect",
|
|
561
|
+
type: 'meta',
|
|
562
|
+
version: this.action.getVersion.apply(this)
|
|
563
|
+
}));
|
|
564
|
+
this.dispatch(V12.formatPayload(this.oneBot.uin, "status_update", {
|
|
565
|
+
detail_type: 'status_update',
|
|
566
|
+
status: this.action.getStatus.apply(this)
|
|
567
|
+
}));
|
|
561
568
|
}
|
|
562
569
|
}
|
|
563
570
|
exports.V12 = V12;
|