onebots 0.4.15 → 0.4.16
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/README.md +2 -0
- package/lib/service/V11/action/common.d.ts +1 -1
- package/lib/service/V11/action/common.js +1 -2
- package/lib/service/V11/action/friend.d.ts +1 -1
- package/lib/service/V11/action/friend.js +2 -2
- package/lib/service/V11/action/group.d.ts +1 -1
- package/lib/service/V11/action/group.js +2 -2
- package/lib/service/V11/index.js +9 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
<h1>基于icqq的oneBot实现</h1>
|
|
3
3
|
<p>
|
|
4
4
|
|
|
5
|
+

|
|
6
|
+
[](https://github.com/icqqjs/onebots/actions/workflows/release.yml)
|
|
5
7
|
[](https://www.npmjs.com/package/onebots)
|
|
6
8
|
[](https://onebot.dev/)
|
|
7
9
|
[](https://12.onebot.dev/)
|
|
@@ -16,7 +16,7 @@ export declare class CommonAction {
|
|
|
16
16
|
* 获取消息
|
|
17
17
|
* @param message_id {string} 消息id
|
|
18
18
|
*/
|
|
19
|
-
getMsg(this: V11, message_id:
|
|
19
|
+
getMsg(this: V11, message_id: string): Promise<import("icqq").GroupMessage | import("icqq").PrivateMessage>;
|
|
20
20
|
/**
|
|
21
21
|
* 获取合并消息
|
|
22
22
|
* @param id {string} 合并id
|
|
@@ -8,7 +8,7 @@ export declare class FriendAction {
|
|
|
8
8
|
* @param message {import('icqq').Sendable} 发送的消息
|
|
9
9
|
* @param message_id {string} 引用的消息ID
|
|
10
10
|
*/
|
|
11
|
-
sendPrivateMsg(this: V11, user_id: number, message: string | SegmentElem | SegmentElem[], message_id?: string): Promise<import("icqq").MessageRet>;
|
|
11
|
+
sendPrivateMsg(this: V11, user_id: number, message: string | SegmentElem | SegmentElem[], message_id?: string): Promise<void | import("icqq").MessageRet>;
|
|
12
12
|
/**
|
|
13
13
|
* 获取好友列表
|
|
14
14
|
*/
|
|
@@ -13,9 +13,9 @@ class FriendAction {
|
|
|
13
13
|
const msg = message_id ? await this.client.getMsg(message_id) : undefined;
|
|
14
14
|
const { element, quote, music, share } = await utils_1.processMessage.apply(this.client, [message, msg]);
|
|
15
15
|
if (music)
|
|
16
|
-
await this.client.pickFriend(user_id).shareMusic(music.
|
|
16
|
+
return await this.client.pickFriend(user_id).shareMusic(music.platform, music.id);
|
|
17
17
|
if (share)
|
|
18
|
-
await this.client.pickFriend(user_id).shareUrl(music.data);
|
|
18
|
+
return await this.client.pickFriend(user_id).shareUrl(music.data);
|
|
19
19
|
if (element.length) {
|
|
20
20
|
return await this.client.sendPrivateMsg(user_id, element, quote ? await this.client.getMsg(quote.data.message_id) : undefined);
|
|
21
21
|
}
|
|
@@ -7,7 +7,7 @@ export declare class GroupAction {
|
|
|
7
7
|
* @param message {import('icqq').Sendable} 消息
|
|
8
8
|
* @param message_id {string} 引用的消息ID
|
|
9
9
|
*/
|
|
10
|
-
sendGroupMsg(this: V11, group_id: number, message: string | SegmentElem | SegmentElem[], message_id?: string): Promise<import("icqq").MessageRet>;
|
|
10
|
+
sendGroupMsg(this: V11, group_id: number, message: string | SegmentElem | SegmentElem[], message_id?: string): Promise<void | import("icqq").MessageRet>;
|
|
11
11
|
/**
|
|
12
12
|
* 群组踢人
|
|
13
13
|
* @param group_id {number} 群id
|
|
@@ -13,9 +13,9 @@ class GroupAction {
|
|
|
13
13
|
const msg = message_id ? await this.client.getMsg(message_id) : undefined;
|
|
14
14
|
const { element, quote, music, share } = await utils_1.processMessage.apply(this.client, [message, msg]);
|
|
15
15
|
if (music)
|
|
16
|
-
await this.client.pickGroup(group_id).shareMusic(music.
|
|
16
|
+
return await this.client.pickGroup(group_id).shareMusic(music.platform, music.id);
|
|
17
17
|
if (share)
|
|
18
|
-
await this.client.pickGroup(group_id).shareUrl(music.data);
|
|
18
|
+
return await this.client.pickGroup(group_id).shareUrl(music.data);
|
|
19
19
|
if (element.length) {
|
|
20
20
|
return await this.client.sendGroupMsg(group_id, element, quote ? await this.client.getMsg(quote.data.message_id) : undefined);
|
|
21
21
|
}
|
package/lib/service/V11/index.js
CHANGED
|
@@ -412,6 +412,8 @@ class V11 extends events_1.EventEmitter {
|
|
|
412
412
|
else
|
|
413
413
|
throw new Error('required message_type or input (user_id/group_id)');
|
|
414
414
|
}
|
|
415
|
+
if (action === 'send_like')
|
|
416
|
+
action = 'send_user_like';
|
|
415
417
|
const method = (0, utils_1.toHump)(action);
|
|
416
418
|
if (Reflect.has(this.action, method)) {
|
|
417
419
|
const ARGS = String(Reflect.get(this.action, method)).match(/\(.*\)/)?.[0]
|
|
@@ -426,9 +428,16 @@ class V11 extends events_1.EventEmitter {
|
|
|
426
428
|
params[k] = (0, utils_1.toBool)(params[k]);
|
|
427
429
|
if (k === 'message') {
|
|
428
430
|
if (typeof params[k] === 'string') {
|
|
431
|
+
if (/[CQ:music,type=.+,id=.+]/.test(params[k])) {
|
|
432
|
+
params[k] = params[k].replace(',type=', ',platform=');
|
|
433
|
+
}
|
|
429
434
|
params[k] = (0, icqq_cq_enable_1.fromCqcode)(params[k]);
|
|
430
435
|
}
|
|
431
436
|
else {
|
|
437
|
+
if (params[k][0].type == 'music' && params[k][0]?.data?.type) {
|
|
438
|
+
params[k][0].data.platform = params[k][0].data.type;
|
|
439
|
+
delete params[k][0].data.type;
|
|
440
|
+
}
|
|
432
441
|
params[k] = (0, icqq_cq_enable_1.fromSegment)(params[k]);
|
|
433
442
|
}
|
|
434
443
|
params['message_id'] = params[k].find(e => e.type === 'reply')?.message_id;
|