node-karin 0.6.21 → 0.6.22
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/lib/adapter/input/index.js +5 -5
- package/lib/adapter/kritor/grpc.js +59 -59
- package/lib/adapter/onebot/11/convert.js +16 -17
- package/lib/adapter/onebot/11/event.js +21 -21
- package/lib/adapter/onebot/11/index.js +50 -52
- package/lib/cli/init.js +1 -20
- package/lib/cli/restart.js +10 -0
- package/lib/cli/start.d.ts +2 -0
- package/lib/cli/start.js +10 -0
- package/lib/cli/stop.d.ts +2 -0
- package/lib/cli/stop.js +10 -0
- package/lib/cli/up.d.ts +0 -0
- package/lib/cli/up.js +1 -0
- package/lib/core/init.js +8 -0
- package/lib/core/karin.js +2 -3
- package/lib/core/plugin.app.js +1 -2
- package/lib/core/plugin.js +1 -2
- package/lib/core/plugin.loader.d.ts +7 -16
- package/lib/core/plugin.loader.js +100 -146
- package/lib/core/process.js +3 -3
- package/lib/core/server.js +2 -5
- package/lib/event/notice.handler.js +16 -17
- package/lib/event/request.handler.js +3 -4
- package/lib/types/event/contact.d.ts +1 -1
- package/lib/types/event/contact.js +1 -13
- package/lib/types/event/event.d.ts +5 -5
- package/lib/types/event/event.js +1 -234
- package/lib/types/event/notice.js +1 -2
- package/lib/types/event/request.js +1 -2
- package/lib/types/event/sender.d.ts +2 -2
- package/lib/types/event/sender.js +1 -22
- package/lib/types/onebot11/api.d.ts +1 -1
- package/lib/types/onebot11/api.js +1 -54
- package/lib/types/onebot11/event.d.ts +5 -5
- package/lib/types/onebot11/event.js +1 -55
- package/lib/types/onebot11/params.d.ts +1 -1
- package/lib/types/onebot11/params.js +1 -7
- package/lib/types/onebot11/response.js +1 -1
- package/lib/types/onebot11/segment.d.ts +1 -1
- package/lib/types/onebot11/segment.js +1 -30
- package/lib/utils/common.d.ts +2 -3
- package/lib/utils/common.js +6 -6
- package/lib/utils/init.d.ts +1 -1
- package/lib/utils/init.js +25 -20
- package/package.json +11 -22
- package/lib/cli/postinstall.js +0 -25
- package/pnpm-workspace.yaml +0 -2
- /package/lib/cli/{postinstall.d.ts → restart.d.ts} +0 -0
|
@@ -5,7 +5,7 @@ import { Reply, replyCallback } from './reply.js';
|
|
|
5
5
|
/**
|
|
6
6
|
* 事件类型枚举
|
|
7
7
|
*/
|
|
8
|
-
export declare enum EventType {
|
|
8
|
+
export declare const enum EventType {
|
|
9
9
|
/**
|
|
10
10
|
* - 消息事件
|
|
11
11
|
*/
|
|
@@ -22,7 +22,7 @@ export declare enum EventType {
|
|
|
22
22
|
/**
|
|
23
23
|
* 消息事件子类型枚举
|
|
24
24
|
*/
|
|
25
|
-
export declare enum MessageSubType {
|
|
25
|
+
export declare const enum MessageSubType {
|
|
26
26
|
/**
|
|
27
27
|
* - 群消息
|
|
28
28
|
*/
|
|
@@ -47,7 +47,7 @@ export declare enum MessageSubType {
|
|
|
47
47
|
/**
|
|
48
48
|
* 通知事件子类型枚举
|
|
49
49
|
*/
|
|
50
|
-
export declare enum NoticeSubType {
|
|
50
|
+
export declare const enum NoticeSubType {
|
|
51
51
|
/**
|
|
52
52
|
* - 私聊戳一戳
|
|
53
53
|
*/
|
|
@@ -116,7 +116,7 @@ export declare enum NoticeSubType {
|
|
|
116
116
|
/**
|
|
117
117
|
* 请求事件子类型枚举
|
|
118
118
|
*/
|
|
119
|
-
export declare enum RequestSubType {
|
|
119
|
+
export declare const enum RequestSubType {
|
|
120
120
|
/**
|
|
121
121
|
* - 好友申请
|
|
122
122
|
*/
|
|
@@ -141,7 +141,7 @@ export type EventToSubEvent = {
|
|
|
141
141
|
/**
|
|
142
142
|
* 组合事件类型枚举
|
|
143
143
|
*/
|
|
144
|
-
export declare enum CombinedEventType {
|
|
144
|
+
export declare const enum CombinedEventType {
|
|
145
145
|
/**
|
|
146
146
|
* - 消息事件: 群消息
|
|
147
147
|
*/
|
package/lib/types/event/event.js
CHANGED
|
@@ -1,234 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* 事件类型枚举
|
|
3
|
-
*/
|
|
4
|
-
export var EventType;
|
|
5
|
-
(function (EventType) {
|
|
6
|
-
/**
|
|
7
|
-
* - 消息事件
|
|
8
|
-
*/
|
|
9
|
-
EventType["Message"] = "message";
|
|
10
|
-
/**
|
|
11
|
-
* - 通知事件
|
|
12
|
-
*/
|
|
13
|
-
EventType["Notice"] = "notice";
|
|
14
|
-
/**
|
|
15
|
-
* - 请求事件
|
|
16
|
-
*/
|
|
17
|
-
EventType["Request"] = "request";
|
|
18
|
-
})(EventType || (EventType = {}));
|
|
19
|
-
/**
|
|
20
|
-
* 消息事件子类型枚举
|
|
21
|
-
*/
|
|
22
|
-
export var MessageSubType;
|
|
23
|
-
(function (MessageSubType) {
|
|
24
|
-
/**
|
|
25
|
-
* - 群消息
|
|
26
|
-
*/
|
|
27
|
-
MessageSubType["GroupMessage"] = "group_message";
|
|
28
|
-
/**
|
|
29
|
-
* - 私聊消息
|
|
30
|
-
*/
|
|
31
|
-
MessageSubType["PrivateMessage"] = "private_message";
|
|
32
|
-
/**
|
|
33
|
-
* - 频道消息
|
|
34
|
-
*/
|
|
35
|
-
MessageSubType["GuildMessage"] = "guild_message";
|
|
36
|
-
/**
|
|
37
|
-
* - 附近消息
|
|
38
|
-
*/
|
|
39
|
-
MessageSubType["Nearby"] = "nearby";
|
|
40
|
-
/**
|
|
41
|
-
* - 陌生人消息
|
|
42
|
-
*/
|
|
43
|
-
MessageSubType["Stranger"] = "stranger";
|
|
44
|
-
})(MessageSubType || (MessageSubType = {}));
|
|
45
|
-
/**
|
|
46
|
-
* 通知事件子类型枚举
|
|
47
|
-
*/
|
|
48
|
-
export var NoticeSubType;
|
|
49
|
-
(function (NoticeSubType) {
|
|
50
|
-
/**
|
|
51
|
-
* - 私聊戳一戳
|
|
52
|
-
*/
|
|
53
|
-
NoticeSubType["PrivatePoke"] = "private_poke";
|
|
54
|
-
/**
|
|
55
|
-
* - 私聊撤回消息
|
|
56
|
-
*/
|
|
57
|
-
NoticeSubType["PrivateRecall"] = "private_recall";
|
|
58
|
-
/**
|
|
59
|
-
* - 私聊发送文件
|
|
60
|
-
*/
|
|
61
|
-
NoticeSubType["PrivateFileUploaded"] = "private_file_uploaded";
|
|
62
|
-
/**
|
|
63
|
-
* - 群聊戳一戳
|
|
64
|
-
*/
|
|
65
|
-
NoticeSubType["GroupPoke"] = "group_poke";
|
|
66
|
-
/**
|
|
67
|
-
* - 群聊名片变动
|
|
68
|
-
*/
|
|
69
|
-
NoticeSubType["GroupCardChanged"] = "group_card_changed";
|
|
70
|
-
/**
|
|
71
|
-
* - 群聊成员头衔变动
|
|
72
|
-
*/
|
|
73
|
-
NoticeSubType["GroupMemberUniqueTitleChanged"] = "group_member_unique_title_changed";
|
|
74
|
-
/**
|
|
75
|
-
* - 群聊精华消息变动
|
|
76
|
-
*/
|
|
77
|
-
NoticeSubType["GroupEssenceChanged"] = "group_essence_changed";
|
|
78
|
-
/**
|
|
79
|
-
* - 群聊撤回消息
|
|
80
|
-
*/
|
|
81
|
-
NoticeSubType["GroupRecall"] = "group_recall";
|
|
82
|
-
/**
|
|
83
|
-
* - 群聊成员增加
|
|
84
|
-
*/
|
|
85
|
-
NoticeSubType["GroupMemberIncrease"] = "group_member_increase";
|
|
86
|
-
/**
|
|
87
|
-
* - 群聊成员减少
|
|
88
|
-
*/
|
|
89
|
-
NoticeSubType["GroupMemberDecrease"] = "group_member_decrease";
|
|
90
|
-
/**
|
|
91
|
-
* - 群聊管理员变动
|
|
92
|
-
*/
|
|
93
|
-
NoticeSubType["GroupAdminChanged"] = "group_admin_changed";
|
|
94
|
-
/**
|
|
95
|
-
* - 群聊成员禁言
|
|
96
|
-
*/
|
|
97
|
-
NoticeSubType["GroupMemberBan"] = "group_member_ban";
|
|
98
|
-
/**
|
|
99
|
-
* - 群聊签到
|
|
100
|
-
*/
|
|
101
|
-
NoticeSubType["GroupSignIn"] = "group_sign_in";
|
|
102
|
-
/**
|
|
103
|
-
* - 群聊全员禁言
|
|
104
|
-
*/
|
|
105
|
-
NoticeSubType["GroupWholeBan"] = "group_whole_ban";
|
|
106
|
-
/**
|
|
107
|
-
* - 群聊发送文件
|
|
108
|
-
*/
|
|
109
|
-
NoticeSubType["GroupFileUploaded"] = "group_file_uploaded";
|
|
110
|
-
/**
|
|
111
|
-
* - 群聊消息表情动态回应
|
|
112
|
-
*/
|
|
113
|
-
NoticeSubType["GroupMessageReaction"] = "group_message_reaction";
|
|
114
|
-
})(NoticeSubType || (NoticeSubType = {}));
|
|
115
|
-
/**
|
|
116
|
-
* 请求事件子类型枚举
|
|
117
|
-
*/
|
|
118
|
-
export var RequestSubType;
|
|
119
|
-
(function (RequestSubType) {
|
|
120
|
-
/**
|
|
121
|
-
* - 好友申请
|
|
122
|
-
*/
|
|
123
|
-
RequestSubType["PrivateApply"] = "private_apply";
|
|
124
|
-
/**
|
|
125
|
-
* - 群聊申请
|
|
126
|
-
*/
|
|
127
|
-
RequestSubType["GroupApply"] = "group_apply";
|
|
128
|
-
/**
|
|
129
|
-
* - 邀请入群
|
|
130
|
-
*/
|
|
131
|
-
RequestSubType["InvitedGroup"] = "invited_group";
|
|
132
|
-
})(RequestSubType || (RequestSubType = {}));
|
|
133
|
-
/**
|
|
134
|
-
* 组合事件类型枚举
|
|
135
|
-
*/
|
|
136
|
-
export var CombinedEventType;
|
|
137
|
-
(function (CombinedEventType) {
|
|
138
|
-
/**
|
|
139
|
-
* - 消息事件: 群消息
|
|
140
|
-
*/
|
|
141
|
-
CombinedEventType["MessageGroupMessage"] = "message.group_message";
|
|
142
|
-
/**
|
|
143
|
-
* - 消息事件: 私聊消息
|
|
144
|
-
*/
|
|
145
|
-
CombinedEventType["MessagePrivateMessage"] = "message.private_message";
|
|
146
|
-
/**
|
|
147
|
-
* - 消息事件: 频道消息
|
|
148
|
-
*/
|
|
149
|
-
CombinedEventType["MessageGuildMessage"] = "message.guild_message";
|
|
150
|
-
/**
|
|
151
|
-
* - 消息事件: 附近消息
|
|
152
|
-
*/
|
|
153
|
-
CombinedEventType["MessageNearby"] = "message.nearby";
|
|
154
|
-
/**
|
|
155
|
-
* - 消息事件: 陌生人消息
|
|
156
|
-
*/
|
|
157
|
-
CombinedEventType["MessageStranger"] = "message.stranger";
|
|
158
|
-
/**
|
|
159
|
-
* - 通知事件: 私聊戳一戳
|
|
160
|
-
*/
|
|
161
|
-
CombinedEventType["NoticePrivatePoke"] = "notice.private_poke";
|
|
162
|
-
/**
|
|
163
|
-
* - 通知事件: 私聊撤回消息
|
|
164
|
-
*/
|
|
165
|
-
CombinedEventType["NoticePrivateRecall"] = "notice.private_recall";
|
|
166
|
-
/**
|
|
167
|
-
* - 通知事件: 私聊发送文件
|
|
168
|
-
*/
|
|
169
|
-
CombinedEventType["NoticePrivateFileUploaded"] = "notice.private_file_uploaded";
|
|
170
|
-
/**
|
|
171
|
-
* - 通知事件: 群聊戳一戳
|
|
172
|
-
*/
|
|
173
|
-
CombinedEventType["NoticeGroupPoke"] = "notice.group_poke";
|
|
174
|
-
/**
|
|
175
|
-
* - 通知事件: 群聊名片变动
|
|
176
|
-
*/
|
|
177
|
-
CombinedEventType["NoticeGroupCardChanged"] = "notice.group_card_changed";
|
|
178
|
-
/**
|
|
179
|
-
* - 通知事件: 群聊成员头衔变动
|
|
180
|
-
*/
|
|
181
|
-
CombinedEventType["NoticeGroupMemberUniqueTitleChanged"] = "notice.group_member_unique_title_changed";
|
|
182
|
-
/**
|
|
183
|
-
* - 通知事件: 群聊精华消息变动
|
|
184
|
-
*/
|
|
185
|
-
CombinedEventType["NoticeGroupEssenceChanged"] = "notice.group_essence_changed";
|
|
186
|
-
/**
|
|
187
|
-
* - 通知事件: 群聊撤回消息
|
|
188
|
-
*/
|
|
189
|
-
CombinedEventType["NoticeGroupRecall"] = "notice.group_recall";
|
|
190
|
-
/**
|
|
191
|
-
* - 通知事件: 群聊成员增加
|
|
192
|
-
*/
|
|
193
|
-
CombinedEventType["NoticeGroupMemberIncrease"] = "notice.group_member_increase";
|
|
194
|
-
/**
|
|
195
|
-
* - 通知事件: 群聊成员减少
|
|
196
|
-
*/
|
|
197
|
-
CombinedEventType["NoticeGroupMemberDecrease"] = "notice.group_member_decrease";
|
|
198
|
-
/**
|
|
199
|
-
* - 通知事件: 群聊管理员变动
|
|
200
|
-
*/
|
|
201
|
-
CombinedEventType["NoticeGroupAdminChanged"] = "notice.group_admin_changed";
|
|
202
|
-
/**
|
|
203
|
-
* - 通知事件: 群聊成员禁言
|
|
204
|
-
*/
|
|
205
|
-
CombinedEventType["NoticeGroupMemberBan"] = "notice.group_member_ban";
|
|
206
|
-
/**
|
|
207
|
-
* - 通知事件: 群聊签到
|
|
208
|
-
*/
|
|
209
|
-
CombinedEventType["NoticeGroupSignIn"] = "notice.group_sign_in";
|
|
210
|
-
/**
|
|
211
|
-
* - 通知事件: 群聊全员禁言
|
|
212
|
-
*/
|
|
213
|
-
CombinedEventType["NoticeGroupWholeBan"] = "notice.group_whole_ban";
|
|
214
|
-
/**
|
|
215
|
-
* - 通知事件: 群聊发送文件
|
|
216
|
-
*/
|
|
217
|
-
CombinedEventType["NoticeGroupFileUploaded"] = "notice.group_file_uploaded";
|
|
218
|
-
/**
|
|
219
|
-
* - 通知事件: 群聊消息表情动态回应
|
|
220
|
-
*/
|
|
221
|
-
CombinedEventType["NoticeGroupMessageReaction"] = "notice.group_message_reaction";
|
|
222
|
-
/**
|
|
223
|
-
* - 请求事件: 好友申请
|
|
224
|
-
*/
|
|
225
|
-
CombinedEventType["RequestPrivateApply"] = "request.private_apply";
|
|
226
|
-
/**
|
|
227
|
-
* - 请求事件: 群聊申请
|
|
228
|
-
*/
|
|
229
|
-
CombinedEventType["RequestGroupApply"] = "request.group_apply";
|
|
230
|
-
/**
|
|
231
|
-
* - 请求事件: 邀请入群
|
|
232
|
-
*/
|
|
233
|
-
CombinedEventType["RequestInvitedGroup"] = "request.invited_group";
|
|
234
|
-
})(CombinedEventType || (CombinedEventType = {}));
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { EventType, NoticeSubType } from './event.js';
|
|
2
1
|
/**
|
|
3
2
|
* - 创建一个通知事件
|
|
4
3
|
*/
|
|
@@ -32,7 +31,7 @@ export class KarinNotice {
|
|
|
32
31
|
this.user_id = user_id;
|
|
33
32
|
this.group_id = contact.scene === 'group' ? (contact.peer || group_id) : group_id;
|
|
34
33
|
this.time = time;
|
|
35
|
-
this.event = EventType.Notice
|
|
34
|
+
this.event = "notice" /* EventType.Notice */;
|
|
36
35
|
this.event_id = event_id;
|
|
37
36
|
this.contact = contact;
|
|
38
37
|
this.sender = sender;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { EventType, RequestSubType } from './event.js';
|
|
2
1
|
/**
|
|
3
2
|
* - 创建一个请求事件
|
|
4
3
|
*/
|
|
@@ -32,7 +31,7 @@ export class KarinRequest {
|
|
|
32
31
|
this.user_id = user_id;
|
|
33
32
|
this.group_id = contact.scene === 'group' ? (contact.peer || group_id) : group_id;
|
|
34
33
|
this.time = time;
|
|
35
|
-
this.event = EventType.Request
|
|
34
|
+
this.event = "request" /* EventType.Request */;
|
|
36
35
|
this.event_id = event_id;
|
|
37
36
|
this.contact = contact;
|
|
38
37
|
this.sender = sender;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* - 群身份枚举 值不存在时为unknown
|
|
3
3
|
*/
|
|
4
|
-
export declare enum Role {
|
|
4
|
+
export declare const enum Role {
|
|
5
5
|
Owner = "owner",
|
|
6
6
|
Admin = "admin",
|
|
7
7
|
Member = "member",
|
|
@@ -10,7 +10,7 @@ export declare enum Role {
|
|
|
10
10
|
/**
|
|
11
11
|
* - 权限类型枚举
|
|
12
12
|
*/
|
|
13
|
-
export declare enum Permission {
|
|
13
|
+
export declare const enum Permission {
|
|
14
14
|
All = "all",
|
|
15
15
|
Master = "master",
|
|
16
16
|
Admin = "admin",
|
|
@@ -1,22 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* - 群身份枚举 值不存在时为unknown
|
|
4
|
-
*/
|
|
5
|
-
export var Role;
|
|
6
|
-
(function (Role) {
|
|
7
|
-
Role["Owner"] = "owner";
|
|
8
|
-
Role["Admin"] = "admin";
|
|
9
|
-
Role["Member"] = "member";
|
|
10
|
-
Role["Unknown"] = "unknown";
|
|
11
|
-
})(Role || (Role = {}));
|
|
12
|
-
/**
|
|
13
|
-
* - 权限类型枚举
|
|
14
|
-
*/
|
|
15
|
-
export var Permission;
|
|
16
|
-
(function (Permission) {
|
|
17
|
-
Permission["All"] = "all";
|
|
18
|
-
Permission["Master"] = "master";
|
|
19
|
-
Permission["Admin"] = "admin";
|
|
20
|
-
Permission["GroupOwner"] = "group.owner";
|
|
21
|
-
Permission["GroupAdmin"] = "group.admin";
|
|
22
|
-
})(Permission || (Permission = {}));
|
|
1
|
+
export {};
|
|
@@ -1,54 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* - OneBot11公开Api
|
|
3
|
-
*/
|
|
4
|
-
export var OB11Api;
|
|
5
|
-
(function (OB11Api) {
|
|
6
|
-
OB11Api["send_private_msg"] = "send_private_msg";
|
|
7
|
-
OB11Api["send_group_msg"] = "send_group_msg";
|
|
8
|
-
OB11Api["send_msg"] = "send_msg";
|
|
9
|
-
OB11Api["delete_msg"] = "delete_msg";
|
|
10
|
-
OB11Api["get_msg"] = "get_msg";
|
|
11
|
-
OB11Api["get_forward_msg"] = "get_forward_msg";
|
|
12
|
-
OB11Api["send_like"] = "send_like";
|
|
13
|
-
OB11Api["set_group_kick"] = "set_group_kick";
|
|
14
|
-
OB11Api["set_group_ban"] = "set_group_ban";
|
|
15
|
-
OB11Api["set_group_anonymous_ban"] = "set_group_anonymous_ban";
|
|
16
|
-
OB11Api["set_group_whole_ban"] = "set_group_whole_ban";
|
|
17
|
-
OB11Api["set_group_admin"] = "set_group_admin";
|
|
18
|
-
OB11Api["set_group_anonymous"] = "set_group_anonymous";
|
|
19
|
-
OB11Api["set_group_card"] = "set_group_card";
|
|
20
|
-
OB11Api["set_group_name"] = "set_group_name";
|
|
21
|
-
OB11Api["set_group_leave"] = "set_group_leave";
|
|
22
|
-
OB11Api["set_group_special_title"] = "set_group_special_title";
|
|
23
|
-
OB11Api["set_friend_add_request"] = "set_friend_add_request";
|
|
24
|
-
OB11Api["set_group_add_request"] = "set_group_add_request";
|
|
25
|
-
OB11Api["get_login_info"] = "get_login_info";
|
|
26
|
-
OB11Api["get_stranger_info"] = "get_stranger_info";
|
|
27
|
-
OB11Api["get_friend_list"] = "get_friend_list";
|
|
28
|
-
OB11Api["get_group_info"] = "get_group_info";
|
|
29
|
-
OB11Api["get_group_list"] = "get_group_list";
|
|
30
|
-
OB11Api["get_group_member_info"] = "get_group_member_info";
|
|
31
|
-
OB11Api["get_group_member_list"] = "get_group_member_list";
|
|
32
|
-
OB11Api["get_group_honor_info"] = "get_group_honor_info";
|
|
33
|
-
OB11Api["get_cookies"] = "get_cookies";
|
|
34
|
-
OB11Api["get_csrf_token"] = "get_csrf_token";
|
|
35
|
-
OB11Api["get_credentials"] = "get_credentials";
|
|
36
|
-
OB11Api["get_record"] = "get_record";
|
|
37
|
-
OB11Api["get_image"] = "get_image";
|
|
38
|
-
OB11Api["can_send_image"] = "can_send_image";
|
|
39
|
-
OB11Api["can_send_record"] = "can_send_record";
|
|
40
|
-
OB11Api["get_status"] = "get_status";
|
|
41
|
-
OB11Api["get_version_info"] = "get_version_info";
|
|
42
|
-
OB11Api["set_restart"] = "set_restart";
|
|
43
|
-
OB11Api["clean_cache"] = "clean_cache";
|
|
44
|
-
OB11Api["get_version"] = "get_version";
|
|
45
|
-
OB11Api["send_forward_msg"] = "send_forward_msg";
|
|
46
|
-
OB11Api["get_friend_msg_history"] = "get_friend_msg_history";
|
|
47
|
-
OB11Api["get_group_msg_history"] = "get_group_msg_history";
|
|
48
|
-
OB11Api["set_msg_emoji_like"] = "set_msg_emoji_like";
|
|
49
|
-
OB11Api["upload_group_file"] = "upload_group_file";
|
|
50
|
-
OB11Api["upload_private_file"] = "upload_private_file";
|
|
51
|
-
OB11Api["get_essence_msg_list"] = "get_essence_msg_list";
|
|
52
|
-
OB11Api["set_essence_msg"] = "set_essence_msg";
|
|
53
|
-
OB11Api["delete_essence_msg"] = "delete_essence_msg";
|
|
54
|
-
})(OB11Api || (OB11Api = {}));
|
|
1
|
+
export {};
|
|
@@ -3,7 +3,7 @@ import { GroupSender, PrivateSender, ob11Sender } from './sender.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* OneBot11消息类型枚举
|
|
5
5
|
*/
|
|
6
|
-
export declare enum OB11PostType {
|
|
6
|
+
export declare const enum OB11PostType {
|
|
7
7
|
Message = "message",
|
|
8
8
|
Notice = "notice",
|
|
9
9
|
Request = "request",
|
|
@@ -13,14 +13,14 @@ export declare enum OB11PostType {
|
|
|
13
13
|
/**
|
|
14
14
|
* 消息事件类型
|
|
15
15
|
*/
|
|
16
|
-
export declare enum OB11MessageType {
|
|
16
|
+
export declare const enum OB11MessageType {
|
|
17
17
|
Private = "private",
|
|
18
18
|
Group = "group"
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* 消息子类型
|
|
22
22
|
*/
|
|
23
|
-
export declare enum OB11MessageSubType {
|
|
23
|
+
export declare const enum OB11MessageSubType {
|
|
24
24
|
Friend = "friend",
|
|
25
25
|
Group = "group",
|
|
26
26
|
Other = "other",
|
|
@@ -152,7 +152,7 @@ export interface OB11GroupMessage extends OB11Message {
|
|
|
152
152
|
/**
|
|
153
153
|
* 通知事件类型
|
|
154
154
|
*/
|
|
155
|
-
export declare enum OB11NoticeType {
|
|
155
|
+
export declare const enum OB11NoticeType {
|
|
156
156
|
GroupUpload = "group_upload",
|
|
157
157
|
GroupAdmin = "group_admin",
|
|
158
158
|
GroupDecrease = "group_decrease",
|
|
@@ -479,7 +479,7 @@ export interface OneBot11GroupMessageReaction extends OneBot11Notice {
|
|
|
479
479
|
/**
|
|
480
480
|
* 请求事件类型
|
|
481
481
|
*/
|
|
482
|
-
export declare enum OB11RequestType {
|
|
482
|
+
export declare const enum OB11RequestType {
|
|
483
483
|
Friend = "friend",
|
|
484
484
|
Group = "group"
|
|
485
485
|
}
|
|
@@ -1,56 +1,2 @@
|
|
|
1
1
|
/* eslint-disable no-unused-vars */
|
|
2
|
-
|
|
3
|
-
* OneBot11消息类型枚举
|
|
4
|
-
*/
|
|
5
|
-
export var OB11PostType;
|
|
6
|
-
(function (OB11PostType) {
|
|
7
|
-
OB11PostType["Message"] = "message";
|
|
8
|
-
OB11PostType["Notice"] = "notice";
|
|
9
|
-
OB11PostType["Request"] = "request";
|
|
10
|
-
OB11PostType["MetaEvent"] = "meta_event";
|
|
11
|
-
OB11PostType["MessageSent"] = "message_sent";
|
|
12
|
-
})(OB11PostType || (OB11PostType = {}));
|
|
13
|
-
/**
|
|
14
|
-
* 消息事件类型
|
|
15
|
-
*/
|
|
16
|
-
export var OB11MessageType;
|
|
17
|
-
(function (OB11MessageType) {
|
|
18
|
-
OB11MessageType["Private"] = "private";
|
|
19
|
-
OB11MessageType["Group"] = "group";
|
|
20
|
-
})(OB11MessageType || (OB11MessageType = {}));
|
|
21
|
-
/**
|
|
22
|
-
* 消息子类型
|
|
23
|
-
*/
|
|
24
|
-
export var OB11MessageSubType;
|
|
25
|
-
(function (OB11MessageSubType) {
|
|
26
|
-
OB11MessageSubType["Friend"] = "friend";
|
|
27
|
-
OB11MessageSubType["Group"] = "group";
|
|
28
|
-
OB11MessageSubType["Other"] = "other";
|
|
29
|
-
OB11MessageSubType["Normal"] = "normal";
|
|
30
|
-
OB11MessageSubType["Anonymous"] = "anonymous";
|
|
31
|
-
OB11MessageSubType["Notice"] = "notice";
|
|
32
|
-
})(OB11MessageSubType || (OB11MessageSubType = {}));
|
|
33
|
-
/**
|
|
34
|
-
* 通知事件类型
|
|
35
|
-
*/
|
|
36
|
-
export var OB11NoticeType;
|
|
37
|
-
(function (OB11NoticeType) {
|
|
38
|
-
OB11NoticeType["GroupUpload"] = "group_upload";
|
|
39
|
-
OB11NoticeType["GroupAdmin"] = "group_admin";
|
|
40
|
-
OB11NoticeType["GroupDecrease"] = "group_decrease";
|
|
41
|
-
OB11NoticeType["GroupIncrease"] = "group_increase";
|
|
42
|
-
OB11NoticeType["GroupBan"] = "group_ban";
|
|
43
|
-
OB11NoticeType["FriendAdd"] = "friend_add";
|
|
44
|
-
OB11NoticeType["GroupRecall"] = "group_recall";
|
|
45
|
-
OB11NoticeType["FriendRecall"] = "friend_recall";
|
|
46
|
-
OB11NoticeType["Notify"] = "notify";
|
|
47
|
-
OB11NoticeType["GroupMsgEmojiLike"] = "group_msg_emoji_like";
|
|
48
|
-
})(OB11NoticeType || (OB11NoticeType = {}));
|
|
49
|
-
/**
|
|
50
|
-
* 请求事件类型
|
|
51
|
-
*/
|
|
52
|
-
export var OB11RequestType;
|
|
53
|
-
(function (OB11RequestType) {
|
|
54
|
-
OB11RequestType["Friend"] = "friend";
|
|
55
|
-
OB11RequestType["Group"] = "group";
|
|
56
|
-
})(OB11RequestType || (OB11RequestType = {}));
|
|
2
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
|
@@ -1,30 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* - OneBot11消息类型枚举
|
|
4
|
-
*/
|
|
5
|
-
export var OB11SegmentType;
|
|
6
|
-
(function (OB11SegmentType) {
|
|
7
|
-
OB11SegmentType["Text"] = "text";
|
|
8
|
-
OB11SegmentType["Face"] = "face";
|
|
9
|
-
OB11SegmentType["Image"] = "image";
|
|
10
|
-
OB11SegmentType["Record"] = "record";
|
|
11
|
-
OB11SegmentType["Video"] = "video";
|
|
12
|
-
OB11SegmentType["At"] = "at";
|
|
13
|
-
OB11SegmentType["Rps"] = "rps";
|
|
14
|
-
OB11SegmentType["Dice"] = "dice";
|
|
15
|
-
OB11SegmentType["Shake"] = "shake";
|
|
16
|
-
OB11SegmentType["Poke"] = "poke";
|
|
17
|
-
OB11SegmentType["Anonymous"] = "anonymous";
|
|
18
|
-
OB11SegmentType["Share"] = "share";
|
|
19
|
-
OB11SegmentType["Contact"] = "contact";
|
|
20
|
-
OB11SegmentType["Location"] = "location";
|
|
21
|
-
OB11SegmentType["Music"] = "music";
|
|
22
|
-
OB11SegmentType["MusicCustom"] = "music_custom";
|
|
23
|
-
OB11SegmentType["Reply"] = "reply";
|
|
24
|
-
OB11SegmentType["Forward"] = "forward";
|
|
25
|
-
OB11SegmentType["Node"] = "node";
|
|
26
|
-
OB11SegmentType["NodeCustom"] = "node_custom";
|
|
27
|
-
OB11SegmentType["Xml"] = "xml";
|
|
28
|
-
OB11SegmentType["Json"] = "json";
|
|
29
|
-
OB11SegmentType["File"] = "file";
|
|
30
|
-
})(OB11SegmentType || (OB11SegmentType = {}));
|
|
1
|
+
export {};
|
package/lib/utils/common.d.ts
CHANGED
|
@@ -137,10 +137,9 @@ export declare const common: {
|
|
|
137
137
|
makeForward(elements: KarinElement | KarinElement[], fakeUin: string, fakeNick: string): Array<NodeElement>;
|
|
138
138
|
/**
|
|
139
139
|
* 获取所有插件列表
|
|
140
|
-
* @param
|
|
141
|
-
* @param isPack - 屏蔽不带packageon的插件
|
|
140
|
+
* @param isPack - 是否屏蔽不带package.json的插件,默认为false
|
|
142
141
|
*/
|
|
143
|
-
getPlugins(
|
|
142
|
+
getPlugins(isPack?: boolean): Array<dirName>;
|
|
144
143
|
/**
|
|
145
144
|
* 获取运行时间
|
|
146
145
|
*/
|
package/lib/utils/common.js
CHANGED
|
@@ -229,6 +229,7 @@ export const common = new (class Common {
|
|
|
229
229
|
*/
|
|
230
230
|
splitPath (_path) {
|
|
231
231
|
const list = _path.replace(/\\/g, '/').split('/')
|
|
232
|
+
if (list[0] === '.') { list.shift() }
|
|
232
233
|
const pop = list.pop() || ''
|
|
233
234
|
const dir = path.join(...list)
|
|
234
235
|
return { dir, pop }
|
|
@@ -364,15 +365,14 @@ export const common = new (class Common {
|
|
|
364
365
|
|
|
365
366
|
/**
|
|
366
367
|
* 获取所有插件列表
|
|
367
|
-
* @param
|
|
368
|
-
* @param isPack - 屏蔽不带packageon的插件
|
|
368
|
+
* @param isPack - 是否屏蔽不带package.json的插件,默认为false
|
|
369
369
|
*/
|
|
370
|
-
getPlugins (
|
|
371
|
-
const dir = this.absPath('./plugins',
|
|
370
|
+
getPlugins (isPack = false) {
|
|
371
|
+
const dir = this.absPath('./plugins', false)
|
|
372
372
|
let list = fs.readdirSync(dir, { withFileTypes: true })
|
|
373
|
-
|
|
373
|
+
/** 忽略非文件夹、非 karin-plugin-开头的文件夹 */
|
|
374
374
|
list = list.filter(v => v.isDirectory() && v.name.startsWith('karin-plugin-'))
|
|
375
|
-
if (isPack) { list = list.filter(v => fs.existsSync(`${dir}/${v.name}/
|
|
375
|
+
if (isPack) { list = list.filter(v => fs.existsSync(`${dir}/${v.name}/package.json`)) }
|
|
376
376
|
const arr = []
|
|
377
377
|
list.map(v => arr.push(v.name))
|
|
378
378
|
return arr
|