onebots 0.4.85 → 0.4.87
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.
|
@@ -136,7 +136,9 @@ class IcqqAdapter extends adapter_1.Adapter {
|
|
|
136
136
|
if (version === "V11" && result.message_id) {
|
|
137
137
|
result.message_id = oneBot.V11.transformToInt("message_id", result.message_id);
|
|
138
138
|
}
|
|
139
|
-
return result
|
|
139
|
+
return Object.fromEntries(Object.entries(result).filter(([_, value]) => {
|
|
140
|
+
return typeof value === "function";
|
|
141
|
+
}));
|
|
140
142
|
}
|
|
141
143
|
async sendPrivateMessage(uin, version, args) {
|
|
142
144
|
const [user_id, message, source] = args;
|
|
@@ -235,8 +237,12 @@ class IcqqAdapter extends adapter_1.Adapter {
|
|
|
235
237
|
return []
|
|
236
238
|
.concat(segment)
|
|
237
239
|
.map(segment => {
|
|
238
|
-
if (version === "V12" && ["image", "video", "audio"].includes(segment.type))
|
|
239
|
-
|
|
240
|
+
if (version === "V12" && ["image", "video", "audio"].includes(segment.type)) {
|
|
241
|
+
const result = onebot.V12.transformMedia(segment);
|
|
242
|
+
result.data["file"] =
|
|
243
|
+
result.data["file"] || result.data["file_id"] || result.data["url"];
|
|
244
|
+
return result;
|
|
245
|
+
}
|
|
240
246
|
return segment;
|
|
241
247
|
})
|
|
242
248
|
.map(item => {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { MessageElem } from "@icqqjs/icqq";
|
|
2
|
-
import { OneBot } from "../../onebot";
|
|
1
|
+
import { MessageElem, Sendable } from "@icqqjs/icqq";
|
|
3
2
|
import IcqqAdapter from "../../adapters/icqq/index";
|
|
4
|
-
export declare function processMessages(this: IcqqAdapter, uin: string, target_id: number, target_type: "group" | "private", list:
|
|
3
|
+
export declare function processMessages(this: IcqqAdapter, uin: string, target_id: number, target_type: "group" | "private", list: Sendable): Promise<MessageElem[]>;
|
|
@@ -4,43 +4,41 @@ exports.processMessages = processMessages;
|
|
|
4
4
|
const shareMusicCustom_1 = require("./shareMusicCustom");
|
|
5
5
|
async function processMessages(uin, target_id, target_type, list) {
|
|
6
6
|
let result = [];
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
console.log(list);
|
|
8
|
+
for (const item of [].concat(list).filter(Boolean)) {
|
|
9
|
+
const { type, ...data } = item;
|
|
9
10
|
switch (type) {
|
|
10
11
|
case "node": {
|
|
11
|
-
const node = data || { ...other };
|
|
12
12
|
result.push({
|
|
13
13
|
type,
|
|
14
|
-
...
|
|
15
|
-
user_id:
|
|
16
|
-
message: await processMessages.call(this, uin,
|
|
14
|
+
...data,
|
|
15
|
+
user_id: data.user_id,
|
|
16
|
+
message: await processMessages.call(this, uin, data.user_id, "private", data.message || []),
|
|
17
17
|
});
|
|
18
18
|
break;
|
|
19
19
|
}
|
|
20
20
|
case "music": {
|
|
21
|
-
if (String(item.
|
|
22
|
-
item.
|
|
21
|
+
if (String(item.platform) === "custom") {
|
|
22
|
+
item.platform = item["subtype"]; // gocq 的平台数据存储在 subtype 内,兼容 icqq 时要求前端必须发送 id 字段
|
|
23
23
|
}
|
|
24
24
|
await shareMusicCustom_1.shareMusic.call(this[target_type === "private" ? "pickFriend" : "pickGroup"](target_id), {
|
|
25
25
|
type,
|
|
26
|
-
...
|
|
26
|
+
...data,
|
|
27
27
|
});
|
|
28
28
|
break;
|
|
29
29
|
}
|
|
30
30
|
case "share": {
|
|
31
|
-
await this[target_type === "private" ? "pickFriend" : "pickGroup"](target_id).shareUrl(
|
|
31
|
+
await this[target_type === "private" ? "pickFriend" : "pickGroup"](target_id).shareUrl(data);
|
|
32
32
|
break;
|
|
33
33
|
}
|
|
34
34
|
case "video":
|
|
35
35
|
case "audio":
|
|
36
36
|
case "image": {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
item["file"] = Buffer.from(item["file"].slice(9), "base64");
|
|
37
|
+
if (data["file"]?.startsWith("base64://"))
|
|
38
|
+
data["file"] = Buffer.from(data["file"].slice(9), "base64");
|
|
40
39
|
result.push({
|
|
41
40
|
type: type,
|
|
42
41
|
...data,
|
|
43
|
-
...other,
|
|
44
42
|
});
|
|
45
43
|
break;
|
|
46
44
|
}
|
|
@@ -58,7 +56,6 @@ async function processMessages(uin, target_id, target_type, list) {
|
|
|
58
56
|
result.push({
|
|
59
57
|
type: type,
|
|
60
58
|
...data,
|
|
61
|
-
...other,
|
|
62
59
|
});
|
|
63
60
|
}
|
|
64
61
|
}
|