onebots 0.4.23 → 0.4.25

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.
Files changed (77) hide show
  1. package/README.md +25 -3
  2. package/lib/adapter.d.ts +55 -0
  3. package/lib/adapter.js +60 -0
  4. package/lib/adapters/icqq/index.d.ts +36 -0
  5. package/lib/adapters/icqq/index.js +300 -0
  6. package/lib/adapters/qq/bot.d.ts +24 -0
  7. package/lib/adapters/qq/bot.js +20 -0
  8. package/lib/adapters/qq/constans.d.ts +69 -0
  9. package/lib/adapters/qq/constans.js +128 -0
  10. package/lib/adapters/qq/elements.d.ts +125 -0
  11. package/lib/adapters/qq/elements.js +8 -0
  12. package/lib/adapters/qq/entries/channel.d.ts +17 -0
  13. package/lib/adapters/qq/entries/channel.js +2 -0
  14. package/lib/adapters/qq/entries/friend.d.ts +8 -0
  15. package/lib/adapters/qq/entries/friend.js +2 -0
  16. package/lib/adapters/qq/entries/group.d.ts +6 -0
  17. package/lib/adapters/qq/entries/group.js +2 -0
  18. package/lib/adapters/qq/entries/groupMember.d.ts +7 -0
  19. package/lib/adapters/qq/entries/groupMember.js +2 -0
  20. package/lib/adapters/qq/entries/guild.d.ts +21 -0
  21. package/lib/adapters/qq/entries/guild.js +2 -0
  22. package/lib/adapters/qq/entries/guildMember.d.ts +9 -0
  23. package/lib/adapters/qq/entries/guildMember.js +2 -0
  24. package/lib/adapters/qq/entries/user.d.ts +9 -0
  25. package/lib/adapters/qq/entries/user.js +2 -0
  26. package/lib/adapters/qq/event.d.ts +28 -0
  27. package/lib/adapters/qq/event.js +24 -0
  28. package/lib/adapters/qq/index.d.ts +35 -0
  29. package/lib/adapters/qq/index.js +170 -0
  30. package/lib/adapters/qq/message.d.ts +83 -0
  31. package/lib/adapters/qq/message.js +272 -0
  32. package/lib/adapters/qq/qqBot.d.ts +122 -0
  33. package/lib/adapters/qq/qqBot.js +438 -0
  34. package/lib/adapters/qq/sessionManager.d.ts +33 -0
  35. package/lib/adapters/qq/sessionManager.js +257 -0
  36. package/lib/adapters/qq/types.d.ts +45 -0
  37. package/lib/adapters/qq/types.js +2 -0
  38. package/lib/adapters/qq/utils.d.ts +12 -0
  39. package/lib/adapters/qq/utils.js +86 -0
  40. package/lib/bin.js +17 -2
  41. package/lib/config.sample.yaml +11 -5
  42. package/lib/onebot.d.ts +32 -24
  43. package/lib/onebot.js +51 -188
  44. package/lib/server/app.d.ts +22 -12
  45. package/lib/server/app.js +97 -71
  46. package/lib/service/V11/action/common.d.ts +9 -11
  47. package/lib/service/V11/action/common.js +27 -64
  48. package/lib/service/V11/action/friend.d.ts +5 -13
  49. package/lib/service/V11/action/friend.js +6 -16
  50. package/lib/service/V11/action/group.d.ts +19 -22
  51. package/lib/service/V11/action/group.js +20 -30
  52. package/lib/service/V11/action/index.d.ts +1 -1
  53. package/lib/service/V11/db_entities.d.ts +1 -1
  54. package/lib/service/V11/db_entities.js +1 -1
  55. package/lib/service/V11/db_sqlite.d.ts +1 -1
  56. package/lib/service/V11/index.d.ts +47 -16
  57. package/lib/service/V11/index.js +142 -164
  58. package/lib/service/V12/action/common.d.ts +3 -67
  59. package/lib/service/V12/action/common.js +9 -63
  60. package/lib/service/V12/action/friend.d.ts +4 -10
  61. package/lib/service/V12/action/friend.js +4 -12
  62. package/lib/service/V12/action/group.d.ts +19 -21
  63. package/lib/service/V12/action/group.js +19 -27
  64. package/lib/service/V12/action/guild.d.ts +40 -13
  65. package/lib/service/V12/action/guild.js +99 -11
  66. package/lib/service/V12/action/index.d.ts +1 -1
  67. package/lib/service/V12/index.d.ts +37 -13
  68. package/lib/service/V12/index.js +44 -72
  69. package/lib/service.d.ts +7 -2
  70. package/lib/service.js +32 -30
  71. package/lib/utils.d.ts +7 -4
  72. package/lib/utils.js +33 -28
  73. package/package.json +5 -4
  74. package/lib/service/V12/utils.d.ts +0 -8
  75. package/lib/service/V12/utils.js +0 -47
  76. /package/lib/{service/V11 → adapters/icqq}/utils.d.ts +0 -0
  77. /package/lib/{service/V11 → adapters/icqq}/utils.js +0 -0
@@ -5,25 +5,25 @@ export declare class CommonAction {
5
5
  * 获取登录信息
6
6
  */
7
7
  getLoginInfo(this: V11): {
8
- user_id: number;
8
+ user_id: string;
9
9
  nickname: string;
10
10
  };
11
11
  /**
12
12
  * 撤回消息
13
13
  * @param message_id {string} 消息id
14
14
  */
15
- deleteMsg(this: V11, message_id: string): Promise<boolean>;
15
+ deleteMsg(this: V11, message_id: number): Promise<any>;
16
16
  /**
17
17
  * 获取消息
18
18
  * @param message_id {string} 消息id
19
19
  * @param onebot_id {number}
20
20
  */
21
- getMsg(this: V11, message_id: string, onebot_id: number): Promise<Message>;
21
+ getMsg(this: V11, message_id: number): Promise<Message>;
22
22
  /**
23
23
  * 获取合并消息
24
24
  * @param id {string} 合并id
25
25
  */
26
- getForwardMsg(this: V11, id: string): Promise<import("icqq").ForwardMessage[]>;
26
+ getForwardMsg(this: V11, id: string): Promise<any>;
27
27
  /**
28
28
  * 获取 Cookies
29
29
  * @param domain {string} 域名
@@ -32,14 +32,14 @@ export declare class CommonAction {
32
32
  /**
33
33
  * 获取 CSRF Token
34
34
  */
35
- getCsrfToken(this: V11): number;
35
+ getCsrfToken(this: V11): Promise<any>;
36
36
  /**
37
37
  * 获取 QQ 相关接口凭证
38
38
  * @param domain
39
39
  */
40
40
  getCredentials(this: V11, domain: string): {
41
- cookies: any;
42
- csrf_token: number;
41
+ cookies: Promise<any>;
42
+ csrf_token: Promise<any>;
43
43
  };
44
44
  /**
45
45
  * 获取版本信息
@@ -58,10 +58,8 @@ export declare class CommonAction {
58
58
  online: boolean;
59
59
  good: boolean;
60
60
  };
61
- callLogin(this: V11, func: string, ...args: any[]): Promise<unknown>;
62
61
  submitSlider(this: V11, ticket: string): Promise<any>;
63
62
  submitSmsCode(this: V11, code: string): Promise<any>;
64
- sendSmsCode(this: V11): Promise<any>;
65
- login(this: V11, password?: string): any;
66
- logout(this: V11, keepalive?: boolean): Promise<unknown>;
63
+ login(this: V11, password?: string): Promise<any>;
64
+ logout(this: V11, keepalive?: boolean): Promise<any>;
67
65
  }
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CommonAction = void 0;
4
4
  const onebot_1 = require("../../../onebot");
5
- const icqq_1 = require("icqq");
6
5
  class CommonAction {
7
6
  /**
8
7
  * 获取登录信息
@@ -10,7 +9,7 @@ class CommonAction {
10
9
  getLoginInfo() {
11
10
  return {
12
11
  user_id: this.oneBot.uin,
13
- nickname: this.client.nickname,
12
+ nickname: this.adapter.getSelfInfo(this.oneBot.uin, 'V11').nickname
14
13
  };
15
14
  }
16
15
  /**
@@ -18,17 +17,27 @@ class CommonAction {
18
17
  * @param message_id {string} 消息id
19
18
  */
20
19
  async deleteMsg(message_id) {
21
- return this.client.deleteMsg(message_id);
20
+ if (message_id == 0)
21
+ throw new Error('getMsg: message_id[0] is invalid');
22
+ let msg_entry = await this.db.getMsgById(message_id);
23
+ if (!msg_entry)
24
+ throw new Error(`getMsg: can not find msg[${message_id}] in db`);
25
+ return this.adapter.call(this.oneBot.uin, 'V11', 'deleteMsg', [msg_entry.base64_id]);
22
26
  }
23
27
  /**
24
28
  * 获取消息
25
29
  * @param message_id {string} 消息id
26
30
  * @param onebot_id {number}
27
31
  */
28
- async getMsg(message_id, onebot_id) {
29
- let msg = await this.client.getMsg(message_id);
30
- msg.message_id = String(onebot_id); // nonebot v11 要求 message_id number 类型
31
- msg["real_id"] = onebot_id; // nonebot 的reply类型会检测real_id是否存在,虽然它从未使用
32
+ async getMsg(message_id) {
33
+ if (message_id == 0)
34
+ throw new Error('getMsg: message_id[0] is invalid');
35
+ let msg_entry = await this.db.getMsgById(message_id);
36
+ if (!msg_entry)
37
+ throw new Error(`getMsg: can not find msg[${message_id}] in db`);
38
+ let msg = await this.adapter.call(this.oneBot.uin, 'V11', 'getMsg', [msg_entry.base64_id]);
39
+ msg.message_id = String(message_id); // nonebot v11 要求 message_id 是 number 类型
40
+ msg["real_id"] = msg.message_id; // nonebot 的reply类型会检测real_id是否存在,虽然它从未使用
32
41
  return msg;
33
42
  }
34
43
  /**
@@ -36,20 +45,20 @@ class CommonAction {
36
45
  * @param id {string} 合并id
37
46
  */
38
47
  getForwardMsg(id) {
39
- return this.client.getForwardMsg(id);
48
+ return this.adapter.call(this.oneBot.uin, 'V11', 'getForwardMsg', [id]);
40
49
  }
41
50
  /**
42
51
  * 获取 Cookies
43
52
  * @param domain {string} 域名
44
53
  */
45
54
  getCookies(domain) {
46
- return this.client.cookies[domain];
55
+ return this.adapter.call['getCookies']([domain]);
47
56
  }
48
57
  /**
49
58
  * 获取 CSRF Token
50
59
  */
51
60
  getCsrfToken() {
52
- return this.client.getCsrfToken();
61
+ return this.adapter.call(this.oneBot.uin, 'V11', 'getCsrfToken');
53
62
  }
54
63
  /**
55
64
  * 获取 QQ 相关接口凭证
@@ -57,8 +66,8 @@ class CommonAction {
57
66
  */
58
67
  getCredentials(domain) {
59
68
  return {
60
- cookies: this.client.cookies[domain],
61
- csrf_token: this.client.getCsrfToken(),
69
+ cookies: this.adapter.call(this.oneBot.uin, 'V11', 'getCookies', [domain]),
70
+ csrf_token: this.adapter.call(this.oneBot.uin, 'V11', 'getCsrfToken')
62
71
  };
63
72
  }
64
73
  /**
@@ -80,67 +89,21 @@ class CommonAction {
80
89
  }
81
90
  getStatus() {
82
91
  return {
83
- online: this.client.status === icqq_1.OnlineStatus.Online,
84
- good: this.oneBot.status === onebot_1.OneBotStatus.Good,
92
+ online: this.adapter.getSelfInfo(this.oneBot.uin, 'V11').status === onebot_1.OneBotStatus.Online,
93
+ good: this.oneBot.status === onebot_1.OneBotStatus.Good
85
94
  };
86
95
  }
87
- callLogin(func, ...args) {
88
- return new Promise(async (resolve) => {
89
- const receiveResult = (event) => {
90
- this.client.offTrap("system.login.qrcode");
91
- this.client.offTrap("system.login.device");
92
- this.client.offTrap("system.login.slider");
93
- this.client.offTrap("system.login.error");
94
- resolve(event);
95
- };
96
- this.client.trap("system.login.qrcode", receiveResult);
97
- this.client.trap("system.login.device", receiveResult);
98
- this.client.trap("system.login.slider", receiveResult);
99
- this.client.trap("system.login.error", receiveResult);
100
- this.client.trapOnce("system.online", receiveResult);
101
- try {
102
- await this.client[func](...args);
103
- }
104
- catch (reason) {
105
- receiveResult(reason);
106
- }
107
- });
108
- }
109
96
  async submitSlider(ticket) {
110
- return this.action.callLogin.apply(this, ["submitSlider", ticket]);
97
+ return this.adapter.call(this.oneBot.uin, 'V11', 'callLogin', ['submitSlider', ticket]);
111
98
  }
112
99
  async submitSmsCode(code) {
113
- return this.action.callLogin.apply(this, ["submitSmsCode", code]);
114
- }
115
- sendSmsCode() {
116
- return new Promise((resolve) => {
117
- const receiveResult = (e) => {
118
- const callback = (data) => {
119
- this.client.offTrap("internal.verbose");
120
- this.client.offTrap("system.login.error");
121
- resolve(data);
122
- };
123
- if ((typeof e === "string" && e.includes("已发送")) || typeof e !== "string") {
124
- callback(e);
125
- }
126
- };
127
- this.client.trap("internal.verbose", receiveResult);
128
- this.client.trap("system.login.error", receiveResult);
129
- this.client.sendSmsCode();
130
- });
100
+ return this.adapter.call(this.oneBot.uin, 'V11', 'callLogin', ['submitSmsCode', code]);
131
101
  }
132
102
  login(password) {
133
- return this.action.callLogin.apply(this, ["login", password]);
103
+ return this.adapter.call(this.oneBot.uin, 'V11', 'callLogin', ['login', password]);
134
104
  }
135
105
  logout(keepalive) {
136
- return new Promise(async (resolve) => {
137
- const receiveResult = (e) => {
138
- this.client.offTrap("system.offline");
139
- resolve(e);
140
- };
141
- this.client.trap("system.offline", receiveResult);
142
- await this.client.logout(keepalive);
143
- });
106
+ return this.adapter.call(this.oneBot.uin, 'V11', 'logout', [keepalive]);
144
107
  }
145
108
  }
146
109
  exports.CommonAction = CommonAction;
@@ -1,6 +1,4 @@
1
- import { OneBot } from "../../../onebot";
2
1
  import { V11 } from "../../../service/V11";
3
- import { MessageElem } from "icqq/lib/message";
4
2
  export declare class FriendAction {
5
3
  /**
6
4
  * 发送私聊消息
@@ -8,33 +6,27 @@ export declare class FriendAction {
8
6
  * @param message {MessageElem[]} 发送的消息
9
7
  * @param message_id {string} 引用的消息ID
10
8
  */
11
- sendPrivateMsg(this: V11, user_id: number, message: MessageElem[], message_id?: string): Promise<any>;
9
+ sendPrivateMsg(this: V11, user_id: number, message: V11.MessageElement[], message_id?: string): Promise<any>;
12
10
  /**
13
11
  * 获取好友列表
14
12
  */
15
- getFriendList(this: OneBot<"V11">): Promise<import("icqq").FriendInfo[]>;
13
+ getFriendList(this: V11): Promise<any>;
16
14
  /**
17
15
  * 处理好友添加请求
18
16
  * @param flag {string} 请求flag
19
17
  * @param approve {boolean} 是否同意
20
18
  * @param remark {string} 添加后的备注
21
19
  */
22
- setFriendAddRequest(this: OneBot<"V11">, flag: string, approve?: boolean, remark?: string): Promise<boolean>;
20
+ setFriendAddRequest(this: V11, flag: string, approve?: boolean, remark?: string): Promise<any>;
23
21
  /**
24
22
  * 获取陌生人信息
25
23
  * @param user_id {number} 用户id
26
24
  */
27
- getStrangerInfo(this: OneBot<"V11">, user_id: number): Promise<{
28
- user_id: number;
29
- nickname: string;
30
- sex: import("icqq").Gender;
31
- age: number;
32
- area: string;
33
- }>;
25
+ getStrangerInfo(this: V11, user_id: number): Promise<any>;
34
26
  /**
35
27
  * 为指定用户点赞
36
28
  * @param user_id {number} 用户id
37
29
  * @param times 点赞次数
38
30
  */
39
- sendUserLike(this: OneBot<"V11">, user_id: number, times?: number): Promise<boolean>;
31
+ sendUserLike(this: V11, user_id: number, times?: number): Promise<any>;
40
32
  }
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FriendAction = void 0;
4
- const utils_1 = require("../../../service/V11/utils");
5
- const shareMusicCustom_1 = require("../../../service/shareMusicCustom");
6
4
  class FriendAction {
7
5
  /**
8
6
  * 发送私聊消息
@@ -11,21 +9,13 @@ class FriendAction {
11
9
  * @param message_id {string} 引用的消息ID
12
10
  */
13
11
  async sendPrivateMsg(user_id, message, message_id) {
14
- const msg = message_id ? await this.client.getMsg(message_id) : undefined;
15
- const { element, music, share } = await utils_1.processMessage.apply(this.client, [message]);
16
- if (music)
17
- return await shareMusicCustom_1.shareMusic.call(this.client.pickFriend(user_id), music);
18
- if (share)
19
- return await this.client.pickFriend(user_id).shareUrl(music.data);
20
- if (!element.length)
21
- throw new Error("Empty message");
22
- return await this.client.sendPrivateMsg(user_id, element, msg);
12
+ return this.adapter.call(this.oneBot.uin, 'V11', 'sendPrivateMessage', [user_id, message, message_id]);
23
13
  }
24
14
  /**
25
15
  * 获取好友列表
26
16
  */
27
17
  async getFriendList() {
28
- return [...(await this.client.getFriendList()).values()];
18
+ return this.adapter.call(this.oneBot.uin, 'V11', 'getFriendList');
29
19
  }
30
20
  /**
31
21
  * 处理好友添加请求
@@ -33,15 +23,15 @@ class FriendAction {
33
23
  * @param approve {boolean} 是否同意
34
24
  * @param remark {string} 添加后的备注
35
25
  */
36
- async setFriendAddRequest(flag, approve = true, remark = "") {
37
- return await this.client.setFriendAddRequest(flag, approve, remark);
26
+ async setFriendAddRequest(flag, approve = true, remark = '') {
27
+ return this.adapter.call(this.oneBot.uin, 'V11', 'setFriendAddRequest', [flag, approve, remark]);
38
28
  }
39
29
  /**
40
30
  * 获取陌生人信息
41
31
  * @param user_id {number} 用户id
42
32
  */
43
33
  async getStrangerInfo(user_id) {
44
- return await this.client.getStrangerInfo(user_id);
34
+ return this.adapter.call(this.oneBot.uin, 'V11', 'getStrangerInfo', [user_id]);
45
35
  }
46
36
  /**
47
37
  * 为指定用户点赞
@@ -49,7 +39,7 @@ class FriendAction {
49
39
  * @param times 点赞次数
50
40
  */
51
41
  async sendUserLike(user_id, times) {
52
- return this.client.sendLike(user_id, times);
42
+ return this.adapter.call(this.oneBot.uin, 'V11', 'sendUserLike', [user_id, times]);
53
43
  }
54
44
  }
55
45
  exports.FriendAction = FriendAction;
@@ -1,5 +1,4 @@
1
1
  import { V11 } from "../../../service/V11";
2
- import { MessageElem } from "icqq/lib/message";
3
2
  export declare class GroupAction {
4
3
  /**
5
4
  * 发送群聊消息
@@ -7,82 +6,80 @@ export declare class GroupAction {
7
6
  * @param message {MessageElem[]} 消息
8
7
  * @param message_id {string} 引用的消息ID
9
8
  */
10
- sendGroupMsg(this: V11, group_id: number, message: MessageElem[], message_id?: string): Promise<any>;
9
+ sendGroupMsg(this: V11, group_id: number, message: V11.MessageElement[], message_id?: string): Promise<any>;
11
10
  /**
12
11
  * 群组踢人
13
12
  * @param group_id {number} 群id
14
13
  * @param user_id {number} 成员id
15
14
  * @param reject_add_request {boolean} 是否禁止此人加群请求
16
15
  */
17
- setGroupKick(this: V11, group_id: number, user_id: number, reject_add_request?: boolean): Promise<boolean>;
16
+ setGroupKick(this: V11, group_id: number, user_id: number, reject_add_request?: boolean): Promise<any>;
18
17
  /**
19
18
  * 群禁言指定人
20
19
  * @param group_id {number} 群id
21
20
  * @param user_id {number} 成员id
22
21
  * @param duration {number} 禁言时长(单位:秒)
23
22
  */
24
- setGroupBan(this: V11, group_id: number, user_id: number, duration?: number): Promise<void>;
23
+ setGroupBan(this: V11, group_id: number, user_id: number, duration?: number): Promise<any>;
25
24
  /**
26
25
  * 群禁言匿名者
27
26
  * @param group_id {number} 群id
28
27
  * @param flag {string} 匿名者flag
29
28
  * @param duration {number} 禁言时长(单位:秒)
30
29
  */
31
- setGroupAnonymousBan(this: V11, group_id: number, flag: string, duration?: number): Promise<void>;
30
+ setGroupAnonymousBan(this: V11, group_id: number, flag: string, duration?: number): Promise<any>;
32
31
  /**
33
32
  * 群全体禁言
34
33
  * @param group_id {number} 群id
35
34
  * @param enable {boolean} 是否禁言
36
35
  */
37
- setGroupWholeBan(this: V11, group_id: number, enable?: boolean): Promise<boolean>;
36
+ setGroupWholeBan(this: V11, group_id: number, enable?: boolean): Promise<any>;
38
37
  /**
39
38
  * 群匿名聊天
40
39
  * @param group_id {number} 群id
41
40
  * @param enable {boolean} 是否开启
42
41
  */
43
- setGroupAnonymous(this: V11, group_id: number, enable?: boolean): Promise<boolean>;
42
+ setGroupAnonymous(this: V11, group_id: number, enable?: boolean): Promise<any>;
44
43
  /**
45
44
  * 设置群管
46
45
  * @param group_id {number} 群id
47
46
  * @param user_id {number} 成员id
48
47
  * @param enable {boolean} true 设为管理,false 取消管理
49
48
  */
50
- setGroupAdmin(this: V11, group_id: number, user_id: number, enable?: boolean): Promise<boolean>;
49
+ setGroupAdmin(this: V11, group_id: number, user_id: number, enable?: boolean): Promise<any>;
51
50
  /**
52
51
  * 设置群成员名片(成员备注)
53
52
  * @param group_id {number} 群id
54
53
  * @param user_id {number} 成员id
55
54
  * @param card {string} 名片信息,不传或传空串则为 删除名片
56
55
  */
57
- setGroupCard(this: V11, group_id: number, user_id: number, card?: string): Promise<boolean>;
56
+ setGroupCard(this: V11, group_id: number, user_id: number, card?: string): Promise<any>;
58
57
  /**
59
58
  * 设置群精华
60
59
  * @param message_id 消息id
61
60
  */
62
- setEssenceMessage(this: V11, message_id: string): Promise<string>;
61
+ setEssenceMessage(this: V11, message_id: string): Promise<any>;
63
62
  /**
64
63
  * 群打卡
65
64
  * @param group_id 群id
66
65
  */
67
- sendGroupSign(this: V11, group_id: number): Promise<{
68
- result: number;
69
- }>;
66
+ sendGroupSign(this: V11, group_id: number): Promise<any>;
70
67
  /**
71
68
  * 移除群精华
72
69
  * @param message_id
73
70
  */
74
- deleteEssenceMessage(this: V11, message_id: string): Promise<string>;
71
+ deleteEssenceMessage(this: V11, message_id: string): Promise<any>;
75
72
  /**
76
73
  * 设置群名
77
74
  * @param group_id {number} 群id
78
75
  * @param name {string} 新群名
79
76
  */
80
- setGroupName(this: V11, group_id: number, name: string): Promise<boolean>;
77
+ setGroupName(this: V11, group_id: number, name: string): Promise<any>;
81
78
  /**
82
79
  * 退出指定群聊
83
80
  * @param group_id {number} 群id
84
81
  */
85
- setGroupLeave(this: V11, group_id: number): Promise<boolean>;
82
+ setGroupLeave(this: V11, group_id: number): Promise<any>;
86
83
  /**
87
84
  * 设置群成员头衔
88
85
  * @param group_id {number} 群id
@@ -90,7 +87,7 @@ export declare class GroupAction {
90
87
  * @param special_title {string} 头衔
91
88
  * @param duration {number} 持有时长 不传则永久
92
89
  */
93
- setGroupSpecialTitle(this: V11, group_id: number, user_id: number, special_title: string, duration?: number): Promise<boolean>;
90
+ setGroupSpecialTitle(this: V11, group_id: number, user_id: number, special_title: string, duration?: number): Promise<any>;
94
91
  /**
95
92
  * 处理加群请求
96
93
  * @param flag {string} 加群flag
@@ -98,25 +95,25 @@ export declare class GroupAction {
98
95
  * @param reason {string} 拒绝理由,approve为false时有效(默认为空)
99
96
  * @param block {boolean} 拒绝时是否加入黑名单,(默认:false)
100
97
  */
101
- setGroupAddRequest(this: V11, flag: string, approve?: boolean, reason?: string, block?: boolean): Promise<boolean>;
98
+ setGroupAddRequest(this: V11, flag: string, approve?: boolean, reason?: string, block?: boolean): Promise<any>;
102
99
  /**
103
100
  * 获取群列表
104
101
  */
105
- getGroupList(this: V11): Promise<Map<number, import("icqq").GroupInfo>>;
102
+ getGroupList(this: V11): Promise<any>;
106
103
  /**
107
104
  * 获取指定群信息
108
105
  * @param group_id
109
106
  */
110
- getGroupInfo(this: V11, group_id: number): Promise<import("icqq").GroupInfo>;
107
+ getGroupInfo(this: V11, group_id: number): Promise<any>;
111
108
  /**
112
109
  * 获取群成员列表
113
110
  * @param group_id
114
111
  */
115
- getGroupMemberList(this: V11, group_id: number): Promise<Map<number, import("icqq").MemberInfo>>;
112
+ getGroupMemberList(this: V11, group_id: number): Promise<any>;
116
113
  /**
117
114
  * 获取指定群成员信息
118
115
  * @param group_id
119
116
  * @param user_id
120
117
  */
121
- getGroupMemberInfo(this: V11, group_id: number, user_id: number): Promise<import("icqq").MemberInfo>;
118
+ getGroupMemberInfo(this: V11, group_id: number, user_id: number): Promise<any>;
122
119
  }
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GroupAction = void 0;
4
- const utils_1 = require("../../../service/V11/utils");
5
- const shareMusicCustom_1 = require("../../../service/shareMusicCustom");
6
4
  class GroupAction {
7
5
  /**
8
6
  * 发送群聊消息
@@ -11,15 +9,7 @@ class GroupAction {
11
9
  * @param message_id {string} 引用的消息ID
12
10
  */
13
11
  async sendGroupMsg(group_id, message, message_id) {
14
- const msg = message_id ? await this.client.getMsg(message_id) : undefined;
15
- const { element, music, share } = await utils_1.processMessage.apply(this.client, [message]);
16
- if (music)
17
- return await shareMusicCustom_1.shareMusic.call(this.client.pickGroup(group_id), music);
18
- if (share)
19
- return await this.client.pickGroup(group_id).shareUrl(music.data);
20
- if (!element.length)
21
- throw new Error("Empty message");
22
- return await this.client.sendGroupMsg(group_id, element, msg);
12
+ return this.adapter.call(this.oneBot.uin, 'V11', 'sendGroupMessage', [group_id, message, message_id]);
23
13
  }
24
14
  /**
25
15
  * 群组踢人
@@ -28,7 +18,7 @@ class GroupAction {
28
18
  * @param reject_add_request {boolean} 是否禁止此人加群请求
29
19
  */
30
20
  setGroupKick(group_id, user_id, reject_add_request) {
31
- return this.client.setGroupKick(group_id, user_id, reject_add_request);
21
+ return this.adapter.call(this.oneBot.uin, 'V11', 'setGroupKick', [group_id, user_id, reject_add_request]);
32
22
  }
33
23
  /**
34
24
  * 群禁言指定人
@@ -37,7 +27,7 @@ class GroupAction {
37
27
  * @param duration {number} 禁言时长(单位:秒)
38
28
  */
39
29
  setGroupBan(group_id, user_id, duration = 1800) {
40
- return this.client.setGroupBan(group_id, user_id, duration);
30
+ return this.adapter.call(this.oneBot.uin, 'V11', 'setGroupBan', [group_id, user_id, duration]);
41
31
  }
42
32
  /**
43
33
  * 群禁言匿名者
@@ -46,7 +36,7 @@ class GroupAction {
46
36
  * @param duration {number} 禁言时长(单位:秒)
47
37
  */
48
38
  setGroupAnonymousBan(group_id, flag, duration = 1800) {
49
- return this.client.setGroupAnonymousBan(group_id, flag, duration);
39
+ return this.adapter.call(this.oneBot.uin, 'V11', 'setGroupAnonymousBan', [group_id, flag, duration]);
50
40
  }
51
41
  /**
52
42
  * 群全体禁言
@@ -54,7 +44,7 @@ class GroupAction {
54
44
  * @param enable {boolean} 是否禁言
55
45
  */
56
46
  setGroupWholeBan(group_id, enable) {
57
- return this.client.setGroupWholeBan(group_id, enable);
47
+ return this.adapter.call(this.oneBot.uin, 'V11', 'setGroupWholeBan', [group_id, enable]);
58
48
  }
59
49
  /**
60
50
  * 群匿名聊天
@@ -62,7 +52,7 @@ class GroupAction {
62
52
  * @param enable {boolean} 是否开启
63
53
  */
64
54
  setGroupAnonymous(group_id, enable) {
65
- return this.client.setGroupAnonymous(group_id, enable);
55
+ return this.adapter.call(this.oneBot.uin, 'V11', 'setGroupAnonymous', [group_id, enable]);
66
56
  }
67
57
  /**
68
58
  * 设置群管
@@ -71,7 +61,7 @@ class GroupAction {
71
61
  * @param enable {boolean} true 设为管理,false 取消管理
72
62
  */
73
63
  setGroupAdmin(group_id, user_id, enable) {
74
- return this.client.setGroupAdmin(group_id, user_id, enable);
64
+ return this.adapter.call(this.oneBot.uin, 'V11', 'setGroupAdmin', [group_id, user_id, enable]);
75
65
  }
76
66
  /**
77
67
  * 设置群成员名片(成员备注)
@@ -80,28 +70,28 @@ class GroupAction {
80
70
  * @param card {string} 名片信息,不传或传空串则为 删除名片
81
71
  */
82
72
  setGroupCard(group_id, user_id, card) {
83
- return this.client.setGroupCard(group_id, user_id, card);
73
+ return this.adapter.call(this.oneBot.uin, 'V11', 'setGroupCard', [group_id, user_id, card]);
84
74
  }
85
75
  /**
86
76
  * 设置群精华
87
77
  * @param message_id 消息id
88
78
  */
89
79
  setEssenceMessage(message_id) {
90
- return this.client.setEssenceMessage(message_id);
80
+ return this.adapter.call(this.oneBot.uin, 'V11', 'setEssenceMessage', [message_id]);
91
81
  }
92
82
  /**
93
83
  * 群打卡
94
84
  * @param group_id 群id
95
85
  */
96
86
  sendGroupSign(group_id) {
97
- return this.client.pickGroup(group_id).sign();
87
+ return this.adapter.call(this.oneBot.uin, 'V11', 'sendGroupSign', [group_id]);
98
88
  }
99
89
  /**
100
90
  * 移除群精华
101
91
  * @param message_id
102
92
  */
103
93
  deleteEssenceMessage(message_id) {
104
- return this.client.removeEssenceMessage(message_id);
94
+ return this.adapter.call(this.oneBot.uin, 'V11', 'removeEssenceMessage', [message_id]);
105
95
  }
106
96
  /**
107
97
  * 设置群名
@@ -109,14 +99,14 @@ class GroupAction {
109
99
  * @param name {string} 新群名
110
100
  */
111
101
  setGroupName(group_id, name) {
112
- return this.client.setGroupName(group_id, name);
102
+ return this.adapter.call(this.oneBot.uin, 'V11', 'setGroupName', [group_id, name]);
113
103
  }
114
104
  /**
115
105
  * 退出指定群聊
116
106
  * @param group_id {number} 群id
117
107
  */
118
108
  setGroupLeave(group_id) {
119
- return this.client.setGroupLeave(group_id);
109
+ return this.adapter.call(this.oneBot.uin, 'V11', 'setGroupLeave', [group_id]);
120
110
  }
121
111
  /**
122
112
  * 设置群成员头衔
@@ -126,7 +116,7 @@ class GroupAction {
126
116
  * @param duration {number} 持有时长 不传则永久
127
117
  */
128
118
  setGroupSpecialTitle(group_id, user_id, special_title, duration = -1) {
129
- return this.client.setGroupSpecialTitle(group_id, user_id, special_title, duration);
119
+ return this.adapter.call(this.oneBot.uin, 'V11', 'setGroupSpecialTitle', [group_id, user_id, special_title, duration]);
130
120
  }
131
121
  /**
132
122
  * 处理加群请求
@@ -135,28 +125,28 @@ class GroupAction {
135
125
  * @param reason {string} 拒绝理由,approve为false时有效(默认为空)
136
126
  * @param block {boolean} 拒绝时是否加入黑名单,(默认:false)
137
127
  */
138
- setGroupAddRequest(flag, approve = true, reason = "", block = false) {
139
- return this.client.setGroupAddRequest(flag, approve, reason, block);
128
+ setGroupAddRequest(flag, approve = true, reason = '', block = false) {
129
+ return this.adapter.call(this.oneBot.uin, 'V11', 'setGroupAddRequest', [flag, approve, reason, block]);
140
130
  }
141
131
  /**
142
132
  * 获取群列表
143
133
  */
144
134
  async getGroupList() {
145
- return this.client.getGroupList();
135
+ return this.adapter.call(this.oneBot.uin, 'V11', 'getGroupList');
146
136
  }
147
137
  /**
148
138
  * 获取指定群信息
149
139
  * @param group_id
150
140
  */
151
141
  getGroupInfo(group_id) {
152
- return this.client.getGroupInfo(group_id);
142
+ return this.adapter.call(this.oneBot.uin, 'V11', 'getGroupInfo', [group_id]);
153
143
  }
154
144
  /**
155
145
  * 获取群成员列表
156
146
  * @param group_id
157
147
  */
158
148
  async getGroupMemberList(group_id) {
159
- return this.client.getGroupMemberList(group_id);
149
+ return this.adapter.call(this.oneBot.uin, 'V11', 'getGroupMemberList', [group_id]);
160
150
  }
161
151
  /**
162
152
  * 获取指定群成员信息
@@ -164,7 +154,7 @@ class GroupAction {
164
154
  * @param user_id
165
155
  */
166
156
  getGroupMemberInfo(group_id, user_id) {
167
- return this.client.getGroupMemberInfo(group_id, user_id);
157
+ return this.adapter.call(this.oneBot.uin, 'V11', 'getGroupMemberInfo', [group_id, user_id]);
168
158
  }
169
159
  }
170
160
  exports.GroupAction = GroupAction;
@@ -3,7 +3,7 @@ import { FriendAction } from "./friend";
3
3
  import { GroupAction } from "./group";
4
4
  export interface Action extends CommonAction, FriendAction, GroupAction {
5
5
  }
6
- declare const Action_base: import("../../../utils").Class;
6
+ declare const Action_base: import("../../../utils").Class<any>;
7
7
  export declare class Action extends Action_base {
8
8
  }
9
9
  export {};
@@ -2,7 +2,7 @@ export declare class MsgEntry {
2
2
  id?: number;
3
3
  base64_id: string;
4
4
  seq: number;
5
- user_id: number;
5
+ user_id: string;
6
6
  nickname: string;
7
7
  group_id: number;
8
8
  group_name: string;