@zhin.js/adapter-onebot11 1.0.55 → 1.0.56

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/src/types.ts ADDED
@@ -0,0 +1,58 @@
1
+ /**
2
+ * OneBot11 适配器类型与配置
3
+ */
4
+
5
+
6
+ export interface OneBot11SenderInfo {
7
+ id: string;
8
+ name: string;
9
+ role?: 'owner' | 'admin' | 'member';
10
+ isOwner?: boolean;
11
+ isAdmin?: boolean;
12
+ card?: string;
13
+ title?: string;
14
+ }
15
+
16
+ /** 配置公共字段;单一适配器 context 均为 'onebot11',连接方式由 connection 区分 */
17
+ export interface OneBot11ConfigBase {
18
+ context: 'onebot11';
19
+ name: string;
20
+ access_token?: string;
21
+ }
22
+
23
+ /** 正向 WebSocket:应用连 OneBot 实现的 WS */
24
+ export interface OneBot11WsClientConfig extends OneBot11ConfigBase {
25
+ connection: 'ws';
26
+ url: string;
27
+ reconnect_interval?: number;
28
+ heartbeat_interval?: number;
29
+ }
30
+
31
+ /** 反向 WebSocket:应用开 WS 服务端,实现连上来 */
32
+ export interface OneBot11WsServerConfig extends OneBot11ConfigBase {
33
+ connection: 'wss';
34
+ path: string;
35
+ heartbeat_interval?: number;
36
+ }
37
+
38
+ export type OneBot11BotConfig = OneBot11WsClientConfig | OneBot11WsServerConfig;
39
+
40
+ export interface OneBot11Message {
41
+ post_type: string;
42
+ self_id: string;
43
+ message_type?: string;
44
+ sub_type?: string;
45
+ message_id: number;
46
+ user_id: number;
47
+ group_id?: number;
48
+ message: Array<{ type: string; data: Record<string, any> }>;
49
+ raw_message: string;
50
+ time: number;
51
+ }
52
+
53
+ export interface ApiResponse<T = any> {
54
+ status: string;
55
+ retcode: number;
56
+ data: T;
57
+ echo?: string;
58
+ }