onebots 0.4.47 → 0.4.48

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 (42) hide show
  1. package/dist/assets/{index-yG7HG4Oa.css → index-2tNhvoZy.css} +1 -1
  2. package/dist/assets/index-_Kz1yWe8.js +19 -0
  3. package/dist/index.html +2 -2
  4. package/lib/adapter.js +6 -8
  5. package/lib/adapters/dingtalk/index.d.ts +4 -4
  6. package/lib/adapters/dingtalk/index.js +56 -49
  7. package/lib/adapters/dingtalk/utils.js +5 -20
  8. package/lib/adapters/icqq/index.d.ts +4 -3
  9. package/lib/adapters/icqq/index.js +128 -101
  10. package/lib/adapters/icqq/utils.js +2 -2
  11. package/lib/adapters/qq/index.d.ts +4 -4
  12. package/lib/adapters/qq/index.js +63 -52
  13. package/lib/adapters/qq/utils.js +5 -20
  14. package/lib/adapters/wechat/index.d.ts +3 -3
  15. package/lib/adapters/wechat/index.js +63 -52
  16. package/lib/adapters/wechat/utils.js +5 -20
  17. package/lib/bin.js +6 -6
  18. package/lib/db.js +10 -10
  19. package/lib/onebot.d.ts +12 -12
  20. package/lib/onebot.js +25 -16
  21. package/lib/server/app.d.ts +2 -2
  22. package/lib/server/app.js +71 -70
  23. package/lib/server/router.d.ts +1 -1
  24. package/lib/server/router.js +5 -5
  25. package/lib/service/V11/action/common.d.ts +1 -0
  26. package/lib/service/V11/action/common.js +24 -24
  27. package/lib/service/V11/action/friend.js +16 -8
  28. package/lib/service/V11/action/group.js +52 -22
  29. package/lib/service/V11/index.js +86 -50
  30. package/lib/service/V12/action/common.d.ts +3 -3
  31. package/lib/service/V12/action/common.js +33 -31
  32. package/lib/service/V12/action/friend.js +8 -4
  33. package/lib/service/V12/action/group.js +50 -20
  34. package/lib/service/V12/action/guild.js +110 -35
  35. package/lib/service/V12/index.d.ts +18 -18
  36. package/lib/service/V12/index.js +189 -147
  37. package/lib/service/shareMusicCustom.js +14 -9
  38. package/lib/service.js +29 -27
  39. package/lib/utils.d.ts +1 -1
  40. package/lib/utils.js +44 -32
  41. package/package.json +1 -1
  42. package/dist/assets/index-YN4djyjB.js +0 -19
@@ -9,7 +9,11 @@ class GroupAction {
9
9
  * @param source {source} 引用消息id
10
10
  */
11
11
  async sendGroupMsg(group_id, message, source) {
12
- return this.adapter.call(this.oneBot.uin, 'V12', 'sendGroupMessage', [group_id, message, source]);
12
+ return this.adapter.call(this.oneBot.uin, "V12", "sendGroupMessage", [
13
+ group_id,
14
+ message,
15
+ source,
16
+ ]);
13
17
  }
14
18
  /**
15
19
  * 群组踢人
@@ -18,28 +22,32 @@ class GroupAction {
18
22
  * @param reject_add_request {boolean} 是否禁止此人加群请求
19
23
  */
20
24
  setGroupKick(group_id, user_id, reject_add_request) {
21
- return this.adapter.call(this.oneBot.uin, 'V12', 'setGroupKick', [group_id, user_id, reject_add_request]);
25
+ return this.adapter.call(this.oneBot.uin, "V12", "setGroupKick", [
26
+ group_id,
27
+ user_id,
28
+ reject_add_request,
29
+ ]);
22
30
  }
23
31
  /**
24
32
  * 设置群精华
25
33
  * @param message_id
26
34
  */
27
35
  setEssenceMessage(message_id) {
28
- return this.adapter.call(this.oneBot.uin, 'V12', 'setEssenceMessage', [message_id]);
36
+ return this.adapter.call(this.oneBot.uin, "V12", "setEssenceMessage", [message_id]);
29
37
  }
30
38
  /**
31
39
  * 移除群精华
32
40
  * @param message_id
33
41
  */
34
42
  deleteEssenceMessage(message_id) {
35
- return this.adapter.call(this.oneBot.uin, 'V12', 'deleteEssenceMessage', [message_id]);
43
+ return this.adapter.call(this.oneBot.uin, "V12", "deleteEssenceMessage", [message_id]);
36
44
  }
37
45
  /**
38
46
  * 群打卡
39
47
  * @param group_id 群id
40
48
  */
41
49
  sendGroupSign(group_id) {
42
- return this.adapter.call(this.oneBot.uin, 'V12', 'sendGroupSign', [group_id]);
50
+ return this.adapter.call(this.oneBot.uin, "V12", "sendGroupSign", [group_id]);
43
51
  }
44
52
  /**
45
53
  * 群禁言指定人
@@ -48,7 +56,11 @@ class GroupAction {
48
56
  * @param duration {number} 禁言时长(单位:秒)
49
57
  */
50
58
  setGroupBan(group_id, user_id, duration = 1800) {
51
- return this.adapter.call(this.oneBot.uin, 'V12', 'setGroupBan', [group_id, user_id, duration]);
59
+ return this.adapter.call(this.oneBot.uin, "V12", "setGroupBan", [
60
+ group_id,
61
+ user_id,
62
+ duration,
63
+ ]);
52
64
  }
53
65
  /**
54
66
  * 群禁言匿名者
@@ -57,7 +69,11 @@ class GroupAction {
57
69
  * @param duration {number} 禁言时长(单位:秒)
58
70
  */
59
71
  setGroupAnonymousBan(group_id, flag, duration = 1800) {
60
- return this.adapter.call(this.oneBot.uin, 'V12', 'setGroupAnonymousBan', [group_id, flag, duration]);
72
+ return this.adapter.call(this.oneBot.uin, "V12", "setGroupAnonymousBan", [
73
+ group_id,
74
+ flag,
75
+ duration,
76
+ ]);
61
77
  }
62
78
  /**
63
79
  * 群全体禁言
@@ -65,7 +81,7 @@ class GroupAction {
65
81
  * @param enable {boolean} 是否禁言
66
82
  */
67
83
  setGroupWholeBan(group_id, enable) {
68
- return this.adapter.call(this.oneBot.uin, 'V12', 'setGroupWholeBan', [group_id, enable]);
84
+ return this.adapter.call(this.oneBot.uin, "V12", "setGroupWholeBan", [group_id, enable]);
69
85
  }
70
86
  /**
71
87
  * 群匿名聊天
@@ -73,7 +89,7 @@ class GroupAction {
73
89
  * @param enable {boolean} 是否开启
74
90
  */
75
91
  setGroupAnonymous(group_id, enable) {
76
- return this.adapter.call(this.oneBot.uin, 'V12', 'setGroupAnonymous', [group_id, enable]);
92
+ return this.adapter.call(this.oneBot.uin, "V12", "setGroupAnonymous", [group_id, enable]);
77
93
  }
78
94
  /**
79
95
  * 设置群管
@@ -82,7 +98,11 @@ class GroupAction {
82
98
  * @param enable {boolean} true 设为管理,false 取消管理
83
99
  */
84
100
  setGroupAdmin(group_id, user_id, enable) {
85
- return this.adapter.call(this.oneBot.uin, 'V12', 'setGroupAdmin', [group_id, user_id, enable]);
101
+ return this.adapter.call(this.oneBot.uin, "V12", "setGroupAdmin", [
102
+ group_id,
103
+ user_id,
104
+ enable,
105
+ ]);
86
106
  }
87
107
  /**
88
108
  * 设置群成员名片(成员备注)
@@ -91,7 +111,7 @@ class GroupAction {
91
111
  * @param card {string} 名片信息,不传或传空串则为 删除名片
92
112
  */
93
113
  setGroupCard(group_id, user_id, card) {
94
- return this.adapter.call(this.oneBot.uin, 'V12', 'setGroupCard', [group_id, user_id, card]);
114
+ return this.adapter.call(this.oneBot.uin, "V12", "setGroupCard", [group_id, user_id, card]);
95
115
  }
96
116
  /**
97
117
  * 设置群名
@@ -99,14 +119,14 @@ class GroupAction {
99
119
  * @param name {string} 新群名
100
120
  */
101
121
  setGroupName(group_id, name) {
102
- return this.adapter.call(this.oneBot.uin, 'V12', 'setGroupName', [group_id, name]);
122
+ return this.adapter.call(this.oneBot.uin, "V12", "setGroupName", [group_id, name]);
103
123
  }
104
124
  /**
105
125
  * 退出指定群聊
106
126
  * @param group_id {number} 群id
107
127
  */
108
128
  leaveGroup(group_id) {
109
- return this.adapter.call(this.oneBot.uin, 'V12', 'leaveGroup', [group_id]);
129
+ return this.adapter.call(this.oneBot.uin, "V12", "leaveGroup", [group_id]);
110
130
  }
111
131
  /**
112
132
  * 设置群成员头衔
@@ -116,7 +136,12 @@ class GroupAction {
116
136
  * @param duration {number} 持有时长 不传则永久
117
137
  */
118
138
  setGroupSpecialTitle(group_id, user_id, special_title, duration = -1) {
119
- return this.adapter.call(this.oneBot.uin, 'V12', 'setGroupSpecialTitle', [group_id, user_id, special_title, duration]);
139
+ return this.adapter.call(this.oneBot.uin, "V12", "setGroupSpecialTitle", [
140
+ group_id,
141
+ user_id,
142
+ special_title,
143
+ duration,
144
+ ]);
120
145
  }
121
146
  /**
122
147
  * 处理加群请求
@@ -125,28 +150,33 @@ class GroupAction {
125
150
  * @param reason {string} 拒绝理由,approve为false时有效(默认为空)
126
151
  * @param block {boolean} 拒绝时是否加入黑名单,(默认:false)
127
152
  */
128
- setGroupAddRequest(flag, approve = true, reason = '', block = false) {
129
- return this.adapter.call(this.oneBot.uin, 'V12', 'setGroupAddRequest', [flag, approve, reason, block]);
153
+ setGroupAddRequest(flag, approve = true, reason = "", block = false) {
154
+ return this.adapter.call(this.oneBot.uin, "V12", "setGroupAddRequest", [
155
+ flag,
156
+ approve,
157
+ reason,
158
+ block,
159
+ ]);
130
160
  }
131
161
  /**
132
162
  * 获取群列表
133
163
  */
134
164
  async getGroupList() {
135
- return this.adapter.call(this.oneBot.uin, 'V12', 'getGroupList');
165
+ return this.adapter.call(this.oneBot.uin, "V12", "getGroupList");
136
166
  }
137
167
  /**
138
168
  * 获取指定群信息
139
169
  * @param group_id
140
170
  */
141
171
  getGroupInfo(group_id) {
142
- return this.adapter.call(this.oneBot.uin, 'V12', 'getGroupInfo', [group_id]);
172
+ return this.adapter.call(this.oneBot.uin, "V12", "getGroupInfo", [group_id]);
143
173
  }
144
174
  /**
145
175
  * 获取群成员列表
146
176
  * @param group_id
147
177
  */
148
178
  async getGroupMemberList(group_id) {
149
- return this.adapter.call(this.oneBot.uin, 'V12', 'getGroupMemberList', [group_id]);
179
+ return this.adapter.call(this.oneBot.uin, "V12", "getGroupMemberList", [group_id]);
150
180
  }
151
181
  /**
152
182
  * 获取指定群成员信息
@@ -154,7 +184,7 @@ class GroupAction {
154
184
  * @param user_id
155
185
  */
156
186
  getGroupMemberInfo(group_id, user_id) {
157
- return this.adapter.call(this.oneBot.uin, 'V12', 'getGroupMemberInfo', [group_id, user_id]);
187
+ return this.adapter.call(this.oneBot.uin, "V12", "getGroupMemberInfo", [group_id, user_id]);
158
188
  }
159
189
  }
160
190
  exports.GroupAction = GroupAction;
@@ -3,100 +3,164 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GuildAction = void 0;
4
4
  class GuildAction {
5
5
  async getGuildSelfInfo() {
6
- return this.adapter.call(this.oneBot.uin, 'V12', 'getSelfInfo');
6
+ return this.adapter.call(this.oneBot.uin, "V12", "getSelfInfo");
7
7
  }
8
8
  async getChannelPermissionOfRole(channel_id, role_id) {
9
- return this.adapter.call(this.oneBot.uin, 'V12', 'getChannelPermissionOfRole', [channel_id, role_id]);
9
+ return this.adapter.call(this.oneBot.uin, "V12", "getChannelPermissionOfRole", [
10
+ channel_id,
11
+ role_id,
12
+ ]);
10
13
  }
11
14
  async setChannelAnnounce(guild_id, channel_id, message_id) {
12
- return this.adapter.call(this.oneBot.uin, 'V12', 'setChannelAnnounce', [guild_id, channel_id, message_id]);
15
+ return this.adapter.call(this.oneBot.uin, "V12", "setChannelAnnounce", [
16
+ guild_id,
17
+ channel_id,
18
+ message_id,
19
+ ]);
13
20
  }
14
21
  async updateChannelPermissionOfRole(channel_id, role_id, permission) {
15
- return this.adapter.call(this.oneBot.uin, 'V12', 'updateChannelPermissionOfRole', [channel_id, role_id, permission]);
22
+ return this.adapter.call(this.oneBot.uin, "V12", "updateChannelPermissionOfRole", [
23
+ channel_id,
24
+ role_id,
25
+ permission,
26
+ ]);
16
27
  }
17
28
  async getChannelMemberPermission(channel_id, member_id) {
18
- return this.adapter.call(this.oneBot.uin, 'V12', 'getChannelMemberPermission', [channel_id, member_id]);
29
+ return this.adapter.call(this.oneBot.uin, "V12", "getChannelMemberPermission", [
30
+ channel_id,
31
+ member_id,
32
+ ]);
19
33
  }
20
34
  async updateChannelMemberPermission(channel_id, member_id, permission) {
21
- return this.adapter.call(this.oneBot.uin, 'V12', 'updateChannelMemberPermission', [channel_id, member_id, permission]);
35
+ return this.adapter.call(this.oneBot.uin, "V12", "updateChannelMemberPermission", [
36
+ channel_id,
37
+ member_id,
38
+ permission,
39
+ ]);
22
40
  }
23
41
  async getChannelPins(channel_id) {
24
- return this.adapter.call(this.oneBot.uin, 'V12', 'getChannelPins', [channel_id]);
42
+ return this.adapter.call(this.oneBot.uin, "V12", "getChannelPins", [channel_id]);
25
43
  }
26
44
  async pinChannelMessage(channel_id, message_id) {
27
- return this.adapter.call(this.oneBot.uin, 'V12', 'pinChannelMessage', [channel_id, message_id]);
45
+ return this.adapter.call(this.oneBot.uin, "V12", "pinChannelMessage", [
46
+ channel_id,
47
+ message_id,
48
+ ]);
28
49
  }
29
50
  async unPinChannelMessage(channel_id, message_id) {
30
- return this.adapter.call(this.oneBot.uin, 'V12', 'unPinChannelMessage', [channel_id, message_id]);
51
+ return this.adapter.call(this.oneBot.uin, "V12", "unPinChannelMessage", [
52
+ channel_id,
53
+ message_id,
54
+ ]);
31
55
  }
32
56
  async createChannel(guild_id, channelInfo) {
33
- return this.adapter.call(this.oneBot.uin, 'V12', 'createChannel', [guild_id, channelInfo]);
57
+ return this.adapter.call(this.oneBot.uin, "V12", "createChannel", [guild_id, channelInfo]);
34
58
  }
35
59
  async updateChannel({ channel_id, ...updateInfo }) {
36
- return this.adapter.call(this.oneBot.uin, 'V12', 'updateChannel', [channel_id, updateInfo]);
60
+ return this.adapter.call(this.oneBot.uin, "V12", "updateChannel", [channel_id, updateInfo]);
37
61
  }
38
62
  async deleteChannel(channel_id) {
39
- return this.adapter.call(this.oneBot.uin, 'V12', 'deleteChannel', [channel_id]);
63
+ return this.adapter.call(this.oneBot.uin, "V12", "deleteChannel", [channel_id]);
40
64
  }
41
65
  async getGuildRoles(guild_id) {
42
- return this.adapter.call(this.oneBot.uin, 'V12', 'getGuildRoles', [guild_id]);
66
+ return this.adapter.call(this.oneBot.uin, "V12", "getGuildRoles", [guild_id]);
43
67
  }
44
68
  async creatGuildRole(guild_id, role) {
45
- return this.adapter.call(this.oneBot.uin, 'V12', 'creatGuildRole', [guild_id, role]);
69
+ return this.adapter.call(this.oneBot.uin, "V12", "creatGuildRole", [guild_id, role]);
46
70
  }
47
71
  async updateGuildRole(guild_id, { id, ...role }) {
48
- return this.adapter.call(this.oneBot.uin, 'V12', 'updateGuildRole', [guild_id, role]);
72
+ return this.adapter.call(this.oneBot.uin, "V12", "updateGuildRole", [guild_id, role]);
49
73
  }
50
74
  async deleteGuildRole(role_id) {
51
- return this.adapter.call(this.oneBot.uin, 'V12', 'deleteGuildRole', [role_id]);
75
+ return this.adapter.call(this.oneBot.uin, "V12", "deleteGuildRole", [role_id]);
52
76
  }
53
77
  async getGuildAccessApis(guild_id) {
54
- return this.adapter.call(this.oneBot.uin, 'V12', 'getGuildAccessApis', [guild_id]);
78
+ return this.adapter.call(this.oneBot.uin, "V12", "getGuildAccessApis", [guild_id]);
55
79
  }
56
80
  async applyGuildAccess(guild_id, channel_id, apiInfo, desc) {
57
- return this.adapter.call(this.oneBot.uin, 'V12', 'applyGuildAccess', [guild_id, channel_id, apiInfo, desc]);
81
+ return this.adapter.call(this.oneBot.uin, "V12", "applyGuildAccess", [
82
+ guild_id,
83
+ channel_id,
84
+ apiInfo,
85
+ desc,
86
+ ]);
58
87
  }
59
88
  async unMuteGuild(guild_id) {
60
- return this.adapter.call(this.oneBot.uin, 'V12', 'unMuteGuild', [guild_id]);
89
+ return this.adapter.call(this.oneBot.uin, "V12", "unMuteGuild", [guild_id]);
61
90
  }
62
91
  async muteGuild(guild_id, seconds, end_time) {
63
- return this.adapter.call(this.oneBot.uin, 'V12', 'muteGuild', [guild_id, seconds, end_time]);
92
+ return this.adapter.call(this.oneBot.uin, "V12", "muteGuild", [
93
+ guild_id,
94
+ seconds,
95
+ end_time,
96
+ ]);
64
97
  }
65
98
  async unMuteGuildMembers(guild_id, member_ids) {
66
- return this.adapter.call(this.oneBot.uin, 'V12', 'unMuteGuildMembers', [guild_id, member_ids]);
99
+ return this.adapter.call(this.oneBot.uin, "V12", "unMuteGuildMembers", [
100
+ guild_id,
101
+ member_ids,
102
+ ]);
67
103
  }
68
104
  async muteGuildMembers(guild_id, member_ids, seconds, end_time) {
69
- return this.adapter.call(this.oneBot.uin, 'V12', 'muteGuildMembers', [guild_id, member_ids, seconds, end_time]);
105
+ return this.adapter.call(this.oneBot.uin, "V12", "muteGuildMembers", [
106
+ guild_id,
107
+ member_ids,
108
+ seconds,
109
+ end_time,
110
+ ]);
70
111
  }
71
112
  async addGuildMemberRoles(guild_id, channel_id, member_id, role_id) {
72
- return this.adapter.call(this.oneBot.uin, 'V12', 'addGuildMemberRoles', [guild_id, channel_id, member_id, role_id]);
113
+ return this.adapter.call(this.oneBot.uin, "V12", "addGuildMemberRoles", [
114
+ guild_id,
115
+ channel_id,
116
+ member_id,
117
+ role_id,
118
+ ]);
73
119
  }
74
120
  async removeGuildMemberRoles(guild_id, channel_id, member_id, role_id) {
75
- return this.adapter.call(this.oneBot.uin, 'V12', 'removeGuildMemberRoles', [guild_id, channel_id, member_id, role_id]);
121
+ return this.adapter.call(this.oneBot.uin, "V12", "removeGuildMemberRoles", [
122
+ guild_id,
123
+ channel_id,
124
+ member_id,
125
+ role_id,
126
+ ]);
76
127
  }
77
128
  async kickGuildMember(guild_id, member_id, clean = 0, blacklist) {
78
- return this.adapter.call(this.oneBot.uin, 'V12', 'kickGuildMember', [guild_id, member_id, clean, blacklist]);
129
+ return this.adapter.call(this.oneBot.uin, "V12", "kickGuildMember", [
130
+ guild_id,
131
+ member_id,
132
+ clean,
133
+ blacklist,
134
+ ]);
79
135
  }
80
136
  async unMuteGuildMember(guild_id, member_id) {
81
- return this.adapter.call(this.oneBot.uin, 'V12', 'unMuteGuildMember', [guild_id, member_id]);
137
+ return this.adapter.call(this.oneBot.uin, "V12", "unMuteGuildMember", [
138
+ guild_id,
139
+ member_id,
140
+ ]);
82
141
  }
83
142
  async muteGuildMember(guild_id, member_id, seconds, end_time) {
84
- return this.adapter.call(this.oneBot.uin, 'V12', 'muteGuildMember', [guild_id, member_id, seconds, end_time]);
143
+ return this.adapter.call(this.oneBot.uin, "V12", "muteGuildMember", [
144
+ guild_id,
145
+ member_id,
146
+ seconds,
147
+ end_time,
148
+ ]);
85
149
  }
86
150
  getGuildList() {
87
- return this.adapter.call(this.oneBot.uin, 'V12', 'getGuildList');
151
+ return this.adapter.call(this.oneBot.uin, "V12", "getGuildList");
88
152
  }
89
153
  getGuildInfo(guild_id) {
90
- return this.adapter.call(this.oneBot.uin, 'V12', 'getGuildInfo', [guild_id]);
154
+ return this.adapter.call(this.oneBot.uin, "V12", "getGuildInfo", [guild_id]);
91
155
  }
92
156
  getChannelList(guild_id) {
93
- return this.adapter.call(this.oneBot.uin, 'V12', 'getChannelList', [guild_id]);
157
+ return this.adapter.call(this.oneBot.uin, "V12", "getChannelList", [guild_id]);
94
158
  }
95
159
  getChannelInfo(channel_id) {
96
- return this.adapter.call(this.oneBot.uin, 'V12', 'getChannelInfo', [channel_id]);
160
+ return this.adapter.call(this.oneBot.uin, "V12", "getChannelInfo", [channel_id]);
97
161
  }
98
162
  getGuildMemberList(guild_id) {
99
- return this.adapter.call(this.oneBot.uin, 'V12', 'getGuildMemberList', [guild_id]);
163
+ return this.adapter.call(this.oneBot.uin, "V12", "getGuildMemberList", [guild_id]);
100
164
  }
101
165
  /**
102
166
  * 发送频道消息
@@ -105,13 +169,24 @@ class GuildAction {
105
169
  * @param source
106
170
  */
107
171
  async sendGuildMsg(channel_id, message, source) {
108
- return this.adapter.call(this.oneBot.uin, 'V12', 'sendGuildMessage', [channel_id, message, source]);
172
+ return this.adapter.call(this.oneBot.uin, "V12", "sendGuildMessage", [
173
+ channel_id,
174
+ message,
175
+ source,
176
+ ]);
109
177
  }
110
178
  async createDirectSession(guild_id, user_id) {
111
- return this.adapter.call(this.oneBot.uin, 'V12', 'createDirectSession', [guild_id, user_id]);
179
+ return this.adapter.call(this.oneBot.uin, "V12", "createDirectSession", [
180
+ guild_id,
181
+ user_id,
182
+ ]);
112
183
  }
113
184
  async sendDirectMsg(guild_id, message, source) {
114
- return this.adapter.call(this.oneBot.uin, 'V12', 'sendDirectMessage', [guild_id, message, source]);
185
+ return this.adapter.call(this.oneBot.uin, "V12", "sendDirectMessage", [
186
+ guild_id,
187
+ message,
188
+ source,
189
+ ]);
115
190
  }
116
191
  }
117
192
  exports.GuildAction = GuildAction;
@@ -1,15 +1,15 @@
1
1
  /// <reference types="node" />
2
2
  import { EventMap } from "icqq";
3
- import { Config } from './config';
3
+ import { Config } from "./config";
4
4
  import { OneBot } from "../../onebot";
5
5
  import { Action } from "./action";
6
6
  import { Logger } from "log4js";
7
7
  import { WebSocket, WebSocketServer } from "ws";
8
8
  import { Service } from "../../service";
9
9
  import { Dict } from "@zhinjs/shared";
10
- export declare class V12 extends Service<'V12'> implements OneBot.Base {
10
+ export declare class V12 extends Service<"V12"> implements OneBot.Base {
11
11
  oneBot: OneBot;
12
- config: OneBot.Config<'V12'>;
12
+ config: OneBot.Config<"V12">;
13
13
  version: OneBot.Version;
14
14
  action: Action;
15
15
  protected timestamp: number;
@@ -18,7 +18,7 @@ export declare class V12 extends Service<'V12'> implements OneBot.Base {
18
18
  wss?: WebSocketServer;
19
19
  wsr: Set<WebSocket>;
20
20
  private db;
21
- constructor(oneBot: OneBot, config: OneBot.Config<'V12'>);
21
+ constructor(oneBot: OneBot, config: OneBot.Config<"V12">);
22
22
  addHistory(payload: V12.Payload<keyof Action>): number;
23
23
  shiftHistory(): unknown;
24
24
  get history(): V12.Payload<keyof Action>[];
@@ -102,7 +102,7 @@ export declare namespace V12 {
102
102
  file_id: string;
103
103
  };
104
104
  music: {
105
- type: "163" | 'qq' | 'xm' | 'custom';
105
+ type: "163" | "qq" | "xm" | "custom";
106
106
  id?: string;
107
107
  url?: string;
108
108
  audio?: string;
@@ -130,7 +130,7 @@ export declare namespace V12 {
130
130
  message: SegmentElem[];
131
131
  };
132
132
  forward: {
133
- nodes: SegmentElem<'node'>[];
133
+ nodes: SegmentElem<"node">[];
134
134
  };
135
135
  }
136
136
  type SegmentElem<K extends keyof SegmentMap = keyof SegmentMap> = {
@@ -165,7 +165,7 @@ export declare namespace V12 {
165
165
  url: string;
166
166
  }
167
167
  interface Result<T extends any> {
168
- status: 'ok' | 'failed';
168
+ status: "ok" | "failed";
169
169
  retcode: 0 | 10001 | 10002 | 10003 | 10004 | 10005 | 10006 | 10007;
170
170
  data: T;
171
171
  message: string;
@@ -174,7 +174,7 @@ export declare namespace V12 {
174
174
  const defaultConfig: Config;
175
175
  type Payload<T = Dict> = {
176
176
  id: string;
177
- impl: 'onebots';
177
+ impl: "onebots";
178
178
  version: 12;
179
179
  platform: string;
180
180
  self: {
@@ -182,7 +182,7 @@ export declare namespace V12 {
182
182
  user_id: string;
183
183
  };
184
184
  time: number;
185
- type: 'meta' | 'message' | 'notice' | 'request';
185
+ type: "meta" | "message" | "notice" | "request";
186
186
  detail_type: string;
187
187
  sub_type: string;
188
188
  } & T;
@@ -198,17 +198,17 @@ export declare namespace V12 {
198
198
  system: Record<string, any>;
199
199
  connect: {
200
200
  type: any;
201
- detail_type: 'connect';
202
- version: ReturnType<Action['getVersion']>;
201
+ detail_type: "connect";
202
+ version: ReturnType<Action["getVersion"]>;
203
203
  };
204
204
  heartbeat: {
205
- detail_type: 'heartbeat';
206
- status: ReturnType<Action['getStatus']>;
205
+ detail_type: "heartbeat";
206
+ status: ReturnType<Action["getStatus"]>;
207
207
  interval: number;
208
208
  };
209
209
  status_update: {
210
- detail_type: 'status_update';
211
- status: ReturnType<Action['getStatus']>;
210
+ detail_type: "status_update";
211
+ status: ReturnType<Action["getStatus"]>;
212
212
  };
213
213
  } & TransformEventMap;
214
214
  type TransformEventMap = {
@@ -221,8 +221,8 @@ export declare namespace V12 {
221
221
  } : {
222
222
  args: T;
223
223
  };
224
- function success<T extends any>(data: T, retcode?: Result<T>['retcode'], echo?: string): Result<T>;
225
- function error(message: string, retcode?: Result<null>['retcode'], echo?: string): Result<null>;
224
+ function success<T extends any>(data: T, retcode?: Result<T>["retcode"], echo?: string): Result<T>;
225
+ function error(message: string, retcode?: Result<null>["retcode"], echo?: string): Result<null>;
226
226
  function formatPayload<K extends keyof BotEventMap>(uin: string, type: K, data: Omit<BotEventMap[K], K>): {
227
227
  self_id: string;
228
228
  time: number;
@@ -240,7 +240,7 @@ export declare namespace V12 {
240
240
  echo?: number;
241
241
  };
242
242
  type FileInfo = {
243
- type: 'url' | 'path' | 'data';
243
+ type: "url" | "path" | "data";
244
244
  name: string;
245
245
  url?: string;
246
246
  headers?: Record<string, any>;