@alemonjs/kook 0.2.9 → 2.1.0-alpha.0
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/config.js +20 -0
- package/lib/hook.d.ts +38 -0
- package/lib/hook.js +24 -0
- package/lib/index.d.ts +5 -6
- package/lib/index.js +209 -196
- package/lib/sdk/{platform/kook/sdk/api.d.ts → api.d.ts} +1 -2
- package/lib/sdk/{platform/kook/sdk/api.js → api.js} +25 -26
- package/lib/sdk/{platform/kook/sdk/config.js → config.js} +1 -1
- package/lib/sdk/{platform/kook/sdk/message.js → message.js} +1 -4
- package/lib/sdk/typings.d.ts +109 -0
- package/package.json +2 -2
- package/dist/assets/index.css +0 -1
- package/dist/assets/index.js +0 -29
- package/dist/index.html +0 -15
- package/lib/sdk/core/utils/from.js +0 -42
- package/lib/sdk/platform/kook/sdk/message/INTERACTION.d.ts +0 -8
- package/lib/sdk/platform/kook/sdk/message/MEMBER_ADD.d.ts +0 -10
- package/lib/sdk/platform/kook/sdk/message/MEMBER_REMOVE.d.ts +0 -10
- package/lib/sdk/platform/kook/sdk/message/MESSAGES_DIRECT.d.ts +0 -10
- package/lib/sdk/platform/kook/sdk/message/MESSAGES_PUBLIC.d.ts +0 -10
- package/lib/sdk/platform/kook/sdk/message/REACTIONS.d.ts +0 -10
- package/lib/sdk/platform/kook/sdk/message.d.ts +0 -18
- package/lib/sdk/platform/kook/sdk/typings.d.ts +0 -192
- package/lib/sdk/platform/kook/sdk/wss.d.ts +0 -26
- package/lib/sdk/platform/kook/sdk/wss.types.d.ts +0 -12
- /package/lib/{sdk/core → core}/config.js +0 -0
- /package/lib/sdk/{platform/kook/sdk/conversation.js → conversation.js} +0 -0
- /package/lib/sdk/{platform/kook/sdk/typings.js → typings.js} +0 -0
- /package/lib/sdk/{platform/kook/sdk/wss.js → wss.js} +0 -0
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { MEMBER_ADD_TYPE } from './message/MEMBER_ADD.js';
|
|
2
|
-
import { MEMBER_REMOVE_TYPE } from './message/MEMBER_REMOVE.js';
|
|
3
|
-
import { INTERACTION_TYPE } from './message/INTERACTION.js';
|
|
4
|
-
import { MESSAGES_DIRECT_TYPE } from './message/MESSAGES_DIRECT.js';
|
|
5
|
-
import { MESSAGES_PUBLIC_TYPE } from './message/MESSAGES_PUBLIC.js';
|
|
6
|
-
import { REACTIONS_TYPE } from './message/REACTIONS.js';
|
|
7
|
-
|
|
8
|
-
type KOOKEventMap = {
|
|
9
|
-
MEMBER_ADD: MEMBER_ADD_TYPE;
|
|
10
|
-
MEMBER_REMOVE: MEMBER_REMOVE_TYPE;
|
|
11
|
-
INTERACTION: INTERACTION_TYPE;
|
|
12
|
-
MESSAGES_DIRECT: MESSAGES_DIRECT_TYPE;
|
|
13
|
-
MESSAGES_PUBLIC: MESSAGES_PUBLIC_TYPE;
|
|
14
|
-
REACTIONS: REACTIONS_TYPE;
|
|
15
|
-
ERROR: any;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export type { KOOKEventMap };
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
type MessageType = 1 | 2 | 3 | 4 | 8 | 9 | 10 | 255;
|
|
2
|
-
/**
|
|
3
|
-
* 消息通道类型, GROUP 为组播消息, PERSON 为单播消息, BROADCAST 为广播消息
|
|
4
|
-
*/
|
|
5
|
-
type MessageChannelType = 'GROUP' | 'PERSON' | 'BROADCAST';
|
|
6
|
-
/**
|
|
7
|
-
* 会话数据
|
|
8
|
-
*/
|
|
9
|
-
interface EventData {
|
|
10
|
-
channel_type: MessageChannelType;
|
|
11
|
-
type: MessageType;
|
|
12
|
-
target_id: string;
|
|
13
|
-
author_id: string;
|
|
14
|
-
content: string;
|
|
15
|
-
extra: Extra;
|
|
16
|
-
msg_id: string;
|
|
17
|
-
msg_timestamp: number;
|
|
18
|
-
nonce: string;
|
|
19
|
-
from_type: number;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* 消息发送参数
|
|
23
|
-
*/
|
|
24
|
-
interface SendMessageParams {
|
|
25
|
-
/**
|
|
26
|
-
* 消息类型
|
|
27
|
-
*/
|
|
28
|
-
type?: number;
|
|
29
|
-
/**
|
|
30
|
-
* 频道编号
|
|
31
|
-
*/
|
|
32
|
-
target_id: string;
|
|
33
|
-
/**
|
|
34
|
-
* 消息内容
|
|
35
|
-
*/
|
|
36
|
-
content: string;
|
|
37
|
-
/**
|
|
38
|
-
* 引用--消息id
|
|
39
|
-
*/
|
|
40
|
-
quote?: string;
|
|
41
|
-
nonce?: string;
|
|
42
|
-
temp_target_id?: string;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* 作者信息
|
|
46
|
-
*/
|
|
47
|
-
interface Author {
|
|
48
|
-
id: string;
|
|
49
|
-
username: string;
|
|
50
|
-
identify_num: string;
|
|
51
|
-
online: boolean;
|
|
52
|
-
os: string;
|
|
53
|
-
status: number;
|
|
54
|
-
avatar: string;
|
|
55
|
-
vip_avatar: string;
|
|
56
|
-
banner: string;
|
|
57
|
-
nickname: string;
|
|
58
|
-
roles: string[];
|
|
59
|
-
is_vip: boolean;
|
|
60
|
-
vip_amp: boolean;
|
|
61
|
-
is_ai_reduce_noise: boolean;
|
|
62
|
-
is_personal_card_bg: boolean;
|
|
63
|
-
bot: boolean;
|
|
64
|
-
decorations_id_map: null | unknown;
|
|
65
|
-
is_sys: boolean;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* mk接口
|
|
69
|
-
*/
|
|
70
|
-
interface KMarkdown {
|
|
71
|
-
raw_content: string;
|
|
72
|
-
mention_part: any[];
|
|
73
|
-
mention_role_part: any[];
|
|
74
|
-
channel_part: any[];
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* 数据包
|
|
78
|
-
*/
|
|
79
|
-
interface Extra {
|
|
80
|
-
type: number;
|
|
81
|
-
code: string;
|
|
82
|
-
guild_id: string;
|
|
83
|
-
guild_type: number;
|
|
84
|
-
channel_name: string;
|
|
85
|
-
author: Author;
|
|
86
|
-
visible_only: null;
|
|
87
|
-
mention: any[];
|
|
88
|
-
mention_all: boolean;
|
|
89
|
-
mention_roles: any[];
|
|
90
|
-
mention_here: boolean;
|
|
91
|
-
nav_channels: any[];
|
|
92
|
-
kmarkdown: KMarkdown;
|
|
93
|
-
emoji: any[];
|
|
94
|
-
last_msg_content: string;
|
|
95
|
-
send_msg_device: number;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* 私聊消息
|
|
99
|
-
*/
|
|
100
|
-
interface SendDirectMessageParams {
|
|
101
|
-
type?: MessageType;
|
|
102
|
-
target_id?: string;
|
|
103
|
-
chat_code?: string;
|
|
104
|
-
content: string;
|
|
105
|
-
quote?: string;
|
|
106
|
-
nonce?: string;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* 系统数据
|
|
110
|
-
*/
|
|
111
|
-
interface SystemData {
|
|
112
|
-
channel_type: MessageChannelType;
|
|
113
|
-
type: number;
|
|
114
|
-
target_id: string;
|
|
115
|
-
author_id: string;
|
|
116
|
-
content: string;
|
|
117
|
-
extra: {
|
|
118
|
-
type: (typeof SystemDataEnum)[number];
|
|
119
|
-
body: overheadData | memberData | ChannelData | StatementData | EditingData | OnLineData;
|
|
120
|
-
};
|
|
121
|
-
msg_id: string;
|
|
122
|
-
msg_timestamp: number;
|
|
123
|
-
nonce: string;
|
|
124
|
-
from_type: number;
|
|
125
|
-
}
|
|
126
|
-
interface OnLineData {
|
|
127
|
-
user_id: string;
|
|
128
|
-
event_time: number;
|
|
129
|
-
guilds: any[];
|
|
130
|
-
}
|
|
131
|
-
interface overheadData {
|
|
132
|
-
channel_id: string;
|
|
133
|
-
operator_id: string;
|
|
134
|
-
msg_id: string;
|
|
135
|
-
}
|
|
136
|
-
interface memberData {
|
|
137
|
-
user_id: string;
|
|
138
|
-
exited_at: number;
|
|
139
|
-
}
|
|
140
|
-
interface ChannelData {
|
|
141
|
-
id: string;
|
|
142
|
-
name: string;
|
|
143
|
-
user_id: string;
|
|
144
|
-
guild_id: string;
|
|
145
|
-
guild_type: number;
|
|
146
|
-
limit_amount: number;
|
|
147
|
-
is_category: number;
|
|
148
|
-
parent_id: string;
|
|
149
|
-
level: number;
|
|
150
|
-
slow_mode: number;
|
|
151
|
-
topic: string;
|
|
152
|
-
type: number;
|
|
153
|
-
permission_overwrites: any[];
|
|
154
|
-
permission_users: any[];
|
|
155
|
-
permission_sync: number;
|
|
156
|
-
mode: number;
|
|
157
|
-
has_password: boolean;
|
|
158
|
-
last_msg_content: string;
|
|
159
|
-
last_msg_id: string;
|
|
160
|
-
sync_guild_region: number;
|
|
161
|
-
region: string;
|
|
162
|
-
joined_at: number;
|
|
163
|
-
}
|
|
164
|
-
interface StatementData {
|
|
165
|
-
channel_id: string;
|
|
166
|
-
emoji: {
|
|
167
|
-
[key: string]: any;
|
|
168
|
-
};
|
|
169
|
-
user_id: string;
|
|
170
|
-
msg_id: string;
|
|
171
|
-
}
|
|
172
|
-
interface EditingData {
|
|
173
|
-
version_id: string;
|
|
174
|
-
channel_id: string;
|
|
175
|
-
target_id: string;
|
|
176
|
-
content: string;
|
|
177
|
-
mention: string[];
|
|
178
|
-
mention_all: boolean;
|
|
179
|
-
mention_here: boolean;
|
|
180
|
-
mention_roles: string[];
|
|
181
|
-
updated_at: number;
|
|
182
|
-
kmarkdown: any;
|
|
183
|
-
last_msg_content: string;
|
|
184
|
-
embeds: any[];
|
|
185
|
-
msg_id: string;
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* 系统数据可枚举
|
|
189
|
-
*/
|
|
190
|
-
declare const SystemDataEnum: readonly ["exited_guild", "joined_guild", "joined_channel", "exited_channel", "updated_channel", "pinned_message", "guild_member_online", "added_reaction", "deleted_reaction", "updated_message", "message_btn_click"];
|
|
191
|
-
|
|
192
|
-
export { type Author, type ChannelData, type EditingData, type EventData, type Extra, type KMarkdown, type MessageChannelType, type MessageType, type OnLineData, type SendDirectMessageParams, type SendMessageParams, type StatementData, type SystemData, SystemDataEnum, type memberData, type overheadData };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { KOOKOptions } from './wss.types.js';
|
|
2
|
-
import { KOOKAPI } from './api.js';
|
|
3
|
-
import { KOOKEventMap } from './message.js';
|
|
4
|
-
|
|
5
|
-
declare class KOOKClient extends KOOKAPI {
|
|
6
|
-
#private;
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
* @param opstion
|
|
10
|
-
*/
|
|
11
|
-
constructor(opstion: KOOKOptions);
|
|
12
|
-
/**
|
|
13
|
-
* 注册事件处理程序
|
|
14
|
-
* @param key 事件名称
|
|
15
|
-
* @param val 事件处理函数
|
|
16
|
-
*/
|
|
17
|
-
on<T extends keyof KOOKEventMap>(key: T, val: (event: KOOKEventMap[T]) => any): this;
|
|
18
|
-
/**
|
|
19
|
-
* 使用获取到的网关连接地址建立 WebSocket 连接
|
|
20
|
-
* @param token
|
|
21
|
-
* @param conversation
|
|
22
|
-
*/
|
|
23
|
-
connect(): Promise<void>;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { KOOKClient };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|