onebots 0.0.14 → 0.0.15

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 (46) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +63 -63
  3. package/lib/bin.d.ts +2 -2
  4. package/lib/bin.js +5 -5
  5. package/lib/db.d.ts +19 -19
  6. package/lib/db.js +91 -91
  7. package/lib/index.d.ts +5 -5
  8. package/lib/index.js +21 -21
  9. package/lib/onebot.d.ts +44 -44
  10. package/lib/onebot.js +86 -86
  11. package/lib/server/app.d.ts +52 -52
  12. package/lib/server/app.js +232 -232
  13. package/lib/server/router.d.ts +9 -9
  14. package/lib/server/router.js +32 -32
  15. package/lib/service/V11/action/common.d.ts +65 -65
  16. package/lib/service/V11/action/common.js +142 -142
  17. package/lib/service/V11/action/friend.d.ts +38 -38
  18. package/lib/service/V11/action/friend.js +44 -44
  19. package/lib/service/V11/action/group.d.ts +104 -104
  20. package/lib/service/V11/action/group.js +138 -138
  21. package/lib/service/V11/action/index.d.ts +9 -9
  22. package/lib/service/V11/action/index.js +10 -10
  23. package/lib/service/V11/config.d.ts +10 -10
  24. package/lib/service/V11/config.js +2 -2
  25. package/lib/service/V11/index.d.ts +95 -95
  26. package/lib/service/V11/index.js +499 -499
  27. package/lib/service/V12/action/common.d.ts +33 -33
  28. package/lib/service/V12/action/common.js +108 -108
  29. package/lib/service/V12/action/friend.d.ts +13 -13
  30. package/lib/service/V12/action/friend.js +15 -15
  31. package/lib/service/V12/action/group.d.ts +104 -104
  32. package/lib/service/V12/action/group.js +138 -138
  33. package/lib/service/V12/action/guild.d.ts +2 -2
  34. package/lib/service/V12/action/guild.js +6 -6
  35. package/lib/service/V12/action/index.d.ts +10 -10
  36. package/lib/service/V12/action/index.js +11 -11
  37. package/lib/service/V12/config.d.ts +17 -17
  38. package/lib/service/V12/config.js +2 -2
  39. package/lib/service/V12/index.d.ts +102 -102
  40. package/lib/service/V12/index.js +538 -537
  41. package/lib/types.d.ts +3 -3
  42. package/lib/types.js +2 -2
  43. package/lib/utils.d.ts +14 -14
  44. package/lib/utils.js +150 -150
  45. package/package.json +58 -58
  46. package/lib/config.sample.yaml +0 -31
@@ -1,95 +1,95 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { Client } from "oicq";
4
- import { Config } from "./config";
5
- import { Action } from "./action";
6
- import { OneBot } from "../../onebot";
7
- import { Logger } from "log4js";
8
- import { WebSocket, WebSocketServer } from "ws";
9
- import { Dispose } from "../../types";
10
- import { EventEmitter } from "events";
11
- export declare class V11 extends EventEmitter implements OneBot.Base {
12
- oneBot: OneBot<'V11'>;
13
- client: Client;
14
- config: V11.Config;
15
- action: Action;
16
- version: string;
17
- protected timestamp: number;
18
- protected heartbeat?: NodeJS.Timeout;
19
- private path;
20
- disposes: Dispose[];
21
- protected _queue: Array<{
22
- method: keyof Action;
23
- args: any[];
24
- }>;
25
- protected queue_running: boolean;
26
- logger: Logger;
27
- wss?: WebSocketServer;
28
- wsr: Set<WebSocket>;
29
- constructor(oneBot: OneBot<'V11'>, client: Client, config: V11.Config);
30
- start(path?: string): void;
31
- private startHttp;
32
- private startHttpReverse;
33
- private startWs;
34
- private startWsReverse;
35
- stop(force?: boolean): Promise<void>;
36
- dispatch(data: any): void;
37
- private _httpRequestHandler;
38
- /**
39
- * 处理ws消息
40
- */
41
- protected _webSocketHandler(ws: WebSocket): void;
42
- /**
43
- * 创建反向ws
44
- */
45
- protected _createWsr(url: string): import("ws");
46
- /**
47
- * 快速操作
48
- */
49
- protected _quickOperate(event: any, res: any): void;
50
- /**
51
- * 调用api
52
- */
53
- apply(req: V11.Protocol): Promise<string>;
54
- /**
55
- * 限速队列调用
56
- */
57
- protected _runQueue(): Promise<void>;
58
- }
59
- export declare namespace V11 {
60
- interface Result<T extends any> {
61
- retcode: number;
62
- status: "ok" | 'async' | 'error';
63
- data: T;
64
- error: string;
65
- }
66
- function ok<T extends any>(data: T, retcode?: number, pending?: boolean): Result<T>;
67
- function error(error: string, retcode?: number): Result<any>;
68
- const defaultConfig: Config;
69
- function genMetaEvent(uin: number, type: string): {
70
- self_id: number;
71
- time: number;
72
- post_type: string;
73
- meta_event_type: string;
74
- sub_type: string;
75
- };
76
- interface Protocol {
77
- action: string;
78
- params: any;
79
- echo?: any;
80
- }
81
- interface Config {
82
- access_token?: string;
83
- post_timeout?: number;
84
- enable_cors?: boolean;
85
- rate_limit_interval?: number;
86
- post_message_format?: 'string' | 'array';
87
- heartbeat?: number;
88
- secret?: string;
89
- reconnect_interval?: number;
90
- use_http?: boolean;
91
- use_ws?: boolean;
92
- http_reverse?: (string | Config.HttpReverseConfig)[];
93
- ws_reverse?: string[];
94
- }
95
- }
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import { Client } from "oicq";
4
+ import { Config } from "./config";
5
+ import { Action } from "./action";
6
+ import { OneBot } from "../../onebot";
7
+ import { Logger } from "log4js";
8
+ import { WebSocket, WebSocketServer } from "ws";
9
+ import { Dispose } from "../../types";
10
+ import { EventEmitter } from "events";
11
+ export declare class V11 extends EventEmitter implements OneBot.Base {
12
+ oneBot: OneBot<'V11'>;
13
+ client: Client;
14
+ config: V11.Config;
15
+ action: Action;
16
+ version: string;
17
+ protected timestamp: number;
18
+ protected heartbeat?: NodeJS.Timeout;
19
+ private path;
20
+ disposes: Dispose[];
21
+ protected _queue: Array<{
22
+ method: keyof Action;
23
+ args: any[];
24
+ }>;
25
+ protected queue_running: boolean;
26
+ logger: Logger;
27
+ wss?: WebSocketServer;
28
+ wsr: Set<WebSocket>;
29
+ constructor(oneBot: OneBot<'V11'>, client: Client, config: V11.Config);
30
+ start(path?: string): void;
31
+ private startHttp;
32
+ private startHttpReverse;
33
+ private startWs;
34
+ private startWsReverse;
35
+ stop(force?: boolean): Promise<void>;
36
+ dispatch(data: any): void;
37
+ private _httpRequestHandler;
38
+ /**
39
+ * 处理ws消息
40
+ */
41
+ protected _webSocketHandler(ws: WebSocket): void;
42
+ /**
43
+ * 创建反向ws
44
+ */
45
+ protected _createWsr(url: string): import("ws");
46
+ /**
47
+ * 快速操作
48
+ */
49
+ protected _quickOperate(event: any, res: any): void;
50
+ /**
51
+ * 调用api
52
+ */
53
+ apply(req: V11.Protocol): Promise<string>;
54
+ /**
55
+ * 限速队列调用
56
+ */
57
+ protected _runQueue(): Promise<void>;
58
+ }
59
+ export declare namespace V11 {
60
+ interface Result<T extends any> {
61
+ retcode: number;
62
+ status: "ok" | 'async' | 'error';
63
+ data: T;
64
+ error: string;
65
+ }
66
+ function ok<T extends any>(data: T, retcode?: number, pending?: boolean): Result<T>;
67
+ function error(error: string, retcode?: number): Result<any>;
68
+ const defaultConfig: Config;
69
+ function genMetaEvent(uin: number, type: string): {
70
+ self_id: number;
71
+ time: number;
72
+ post_type: string;
73
+ meta_event_type: string;
74
+ sub_type: string;
75
+ };
76
+ interface Protocol {
77
+ action: string;
78
+ params: any;
79
+ echo?: any;
80
+ }
81
+ interface Config {
82
+ access_token?: string;
83
+ post_timeout?: number;
84
+ enable_cors?: boolean;
85
+ rate_limit_interval?: number;
86
+ post_message_format?: 'string' | 'array';
87
+ heartbeat?: number;
88
+ secret?: string;
89
+ reconnect_interval?: number;
90
+ use_http?: boolean;
91
+ use_ws?: boolean;
92
+ http_reverse?: (string | Config.HttpReverseConfig)[];
93
+ ws_reverse?: string[];
94
+ }
95
+ }