onebots 0.0.15 → 0.0.17
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/LICENSE +21 -21
- package/README.md +84 -63
- package/lib/bin.d.ts +2 -2
- package/lib/bin.js +11 -5
- package/lib/config.sample.yaml +31 -0
- package/lib/db.d.ts +19 -19
- package/lib/db.js +91 -91
- package/lib/index.d.ts +5 -5
- package/lib/index.js +21 -21
- package/lib/onebot.d.ts +44 -44
- package/lib/onebot.js +133 -86
- package/lib/server/app.d.ts +52 -52
- package/lib/server/app.js +235 -232
- package/lib/server/router.d.ts +9 -9
- package/lib/server/router.js +32 -32
- package/lib/service/V11/action/common.d.ts +65 -65
- package/lib/service/V11/action/common.js +142 -142
- package/lib/service/V11/action/friend.d.ts +38 -38
- package/lib/service/V11/action/friend.js +44 -44
- package/lib/service/V11/action/group.d.ts +104 -104
- package/lib/service/V11/action/group.js +138 -138
- package/lib/service/V11/action/index.d.ts +9 -9
- package/lib/service/V11/action/index.js +10 -10
- package/lib/service/V11/config.d.ts +10 -10
- package/lib/service/V11/config.js +2 -2
- package/lib/service/V11/index.d.ts +95 -95
- package/lib/service/V11/index.js +499 -499
- package/lib/service/V12/action/common.d.ts +37 -33
- package/lib/service/V12/action/common.js +114 -108
- package/lib/service/V12/action/friend.d.ts +13 -13
- package/lib/service/V12/action/friend.js +15 -15
- package/lib/service/V12/action/group.d.ts +104 -104
- package/lib/service/V12/action/group.js +138 -138
- package/lib/service/V12/action/guild.d.ts +2 -2
- package/lib/service/V12/action/guild.js +6 -6
- package/lib/service/V12/action/index.d.ts +10 -10
- package/lib/service/V12/action/index.js +11 -11
- package/lib/service/V12/config.d.ts +17 -17
- package/lib/service/V12/config.js +2 -2
- package/lib/service/V12/index.d.ts +121 -102
- package/lib/service/V12/index.js +539 -538
- package/lib/types.d.ts +3 -3
- package/lib/types.js +2 -2
- package/lib/utils.d.ts +14 -14
- package/lib/utils.js +150 -150
- package/package.json +58 -58
|
@@ -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
|
+
}
|