koishi-plugin-onebot-verifier 0.0.1 → 1.0.1
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 +661 -0
- package/lib/index.d.ts +13 -12
- package/lib/index.js +193 -229
- package/package.json +1 -1
- package/readme.md +63 -1
- package/lib/request.d.ts +0 -84
package/lib/request.d.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { Context, Logger, Session } from 'koishi';
|
|
2
|
-
import { Config } from './index';
|
|
3
|
-
/**
|
|
4
|
-
* 请求类型
|
|
5
|
-
* - friend: 好友请求
|
|
6
|
-
* - guild: 群组请求
|
|
7
|
-
* - member: 群成员请求
|
|
8
|
-
*/
|
|
9
|
-
export type RequestType = 'friend' | 'guild' | 'member';
|
|
10
|
-
/**
|
|
11
|
-
* OneBot 用户信息接口
|
|
12
|
-
*/
|
|
13
|
-
export interface OneBotUserInfo {
|
|
14
|
-
/** 用户 ID */
|
|
15
|
-
user_id: number;
|
|
16
|
-
/** QQ等级 */
|
|
17
|
-
qqLevel?: number;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* OneBot 群组信息接口
|
|
21
|
-
*/
|
|
22
|
-
export interface OneBotGroupInfo {
|
|
23
|
-
/** 群组 ID */
|
|
24
|
-
group_id: number;
|
|
25
|
-
/** 群组名称 */
|
|
26
|
-
group_name: string;
|
|
27
|
-
/** 成员数量 */
|
|
28
|
-
member_count: number;
|
|
29
|
-
/** 群组最大成员数 */
|
|
30
|
-
max_member_count: number;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* OneBot 请求处理类
|
|
34
|
-
* 处理好友请求、群组请求和群成员请求
|
|
35
|
-
*/
|
|
36
|
-
export declare class OnebotRequest {
|
|
37
|
-
private ctx;
|
|
38
|
-
private logger;
|
|
39
|
-
private config;
|
|
40
|
-
private requestNumberMap;
|
|
41
|
-
private nextRequestNumber;
|
|
42
|
-
private activeRequests;
|
|
43
|
-
private processedFlags;
|
|
44
|
-
/**
|
|
45
|
-
* 创建 OneBot 请求处理实例
|
|
46
|
-
* @param ctx - Koishi 上下文
|
|
47
|
-
* @param logger - 日志记录器
|
|
48
|
-
* @param config - 配置项
|
|
49
|
-
*/
|
|
50
|
-
constructor(ctx: Context, logger: Logger, config?: Config);
|
|
51
|
-
/**
|
|
52
|
-
* 清理并取消一个活动中的请求
|
|
53
|
-
*/
|
|
54
|
-
private cleanupActiveRequest;
|
|
55
|
-
/**
|
|
56
|
-
* 从验证消息中提取用户的回答
|
|
57
|
-
* 如果消息包含 "回答:" 格式,则只返回回答部分
|
|
58
|
-
*/
|
|
59
|
-
private extractAnswers;
|
|
60
|
-
/**
|
|
61
|
-
* 发送请求通知
|
|
62
|
-
*/
|
|
63
|
-
private sendRequestNotification;
|
|
64
|
-
/**
|
|
65
|
-
* 处理收到的请求
|
|
66
|
-
*/
|
|
67
|
-
processRequest(session: Session, type: RequestType): Promise<void>;
|
|
68
|
-
/**
|
|
69
|
-
* 判断是否应自动接受请求
|
|
70
|
-
*/
|
|
71
|
-
private shouldAutoAccept;
|
|
72
|
-
/**
|
|
73
|
-
* 处理请求操作(接受或拒绝)
|
|
74
|
-
*/
|
|
75
|
-
private processRequestAction;
|
|
76
|
-
/**
|
|
77
|
-
* 设置手动处理流程:通知、响应监听和超时回退
|
|
78
|
-
*/
|
|
79
|
-
private setupManualHandling;
|
|
80
|
-
/**
|
|
81
|
-
* 注册请求类事件监听器
|
|
82
|
-
*/
|
|
83
|
-
registerEventListeners(): void;
|
|
84
|
-
}
|