koishi-plugin-best-cave 1.7.3 → 2.0.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/LICENSE +70 -83
- package/lib/index.js +647 -1664
- package/package.json +4 -4
- package/readme.md +55 -78
- package/lib/index.d.ts +0 -86
- package/lib/utils/AuditHandler.d.ts +0 -89
- package/lib/utils/ContentHasher.d.ts +0 -80
- package/lib/utils/FileHandler.d.ts +0 -63
- package/lib/utils/HashManager.d.ts +0 -108
- package/lib/utils/IdManager.d.ts +0 -69
- package/lib/utils/MediaHandler.d.ts +0 -72
- package/lib/utils/ProcessHandle.d.ts +0 -45
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { Context } from 'koishi';
|
|
2
|
-
import { Element, CaveObject } from '..';
|
|
3
|
-
/**
|
|
4
|
-
* 构建并返回洞窟消息内容
|
|
5
|
-
* @param cave - 洞窟对象
|
|
6
|
-
* @param resourceDir - 资源目录路径
|
|
7
|
-
* @param session - 会话对象
|
|
8
|
-
* @returns 格式化后的消息字符串
|
|
9
|
-
*/
|
|
10
|
-
export declare function buildMessage(cave: CaveObject, resourceDir: string, session?: any): Promise<string>;
|
|
11
|
-
/**
|
|
12
|
-
* 发送临时或永久消息
|
|
13
|
-
* @param session - 会话对象
|
|
14
|
-
* @param key - 消息key
|
|
15
|
-
* @param params - 消息参数数组
|
|
16
|
-
* @param isTemp - 是否为临时消息
|
|
17
|
-
* @param timeout - 临时消息超时时间(ms)
|
|
18
|
-
* @returns 空字符串
|
|
19
|
-
*/
|
|
20
|
-
export declare function sendMessage(session: any, key: string, params?: any[], isTemp?: boolean, timeout?: number): Promise<string>;
|
|
21
|
-
/**
|
|
22
|
-
* 处理媒体文件,返回文件路径或base64编码
|
|
23
|
-
* @param filePath - 文件路径
|
|
24
|
-
* @param type - 媒体类型('image' | 'video')
|
|
25
|
-
* @returns 图片路径或视频base64编码
|
|
26
|
-
*/
|
|
27
|
-
export declare function processMediaFile(filePath: string, type: 'image' | 'video'): Promise<string | null>;
|
|
28
|
-
/**
|
|
29
|
-
* 从内容中提取媒体元素
|
|
30
|
-
* @param originalContent - 原始内容字符串
|
|
31
|
-
* @param config - 配置对象,包含图片和视频大小限制
|
|
32
|
-
* @param session - 会话对象
|
|
33
|
-
* @returns 包含图片、视频URL和元素的对象
|
|
34
|
-
*/
|
|
35
|
-
export declare function extractMediaContent(originalContent: string, config: {
|
|
36
|
-
imageMaxSize: number;
|
|
37
|
-
videoMaxSize: number;
|
|
38
|
-
}, session: any): Promise<{
|
|
39
|
-
imageUrls: string[];
|
|
40
|
-
imageElements: Array<{
|
|
41
|
-
type: 'img';
|
|
42
|
-
index: number;
|
|
43
|
-
fileName?: string;
|
|
44
|
-
fileSize?: string;
|
|
45
|
-
}>;
|
|
46
|
-
videoUrls: string[];
|
|
47
|
-
videoElements: Array<{
|
|
48
|
-
type: 'video';
|
|
49
|
-
index: number;
|
|
50
|
-
fileName?: string;
|
|
51
|
-
fileSize?: string;
|
|
52
|
-
}>;
|
|
53
|
-
textParts: Element[];
|
|
54
|
-
}>;
|
|
55
|
-
/**
|
|
56
|
-
* 保存媒体文件
|
|
57
|
-
* @param urls - 媒体URL数组
|
|
58
|
-
* @param fileNames - 文件名数组
|
|
59
|
-
* @param resourceDir - 资源目录路径
|
|
60
|
-
* @param caveId - 洞窟ID
|
|
61
|
-
* @param mediaType - 媒体类型('img' | 'video')
|
|
62
|
-
* @param config - 配置对象,包含重复检查相关设置
|
|
63
|
-
* @param ctx - Koishi上下文
|
|
64
|
-
* @param session - 会话对象
|
|
65
|
-
* @param buffers - 可选的buffer数组,用于收集图片buffer
|
|
66
|
-
* @returns 保存后的文件名数组
|
|
67
|
-
*/
|
|
68
|
-
export declare function saveMedia(urls: string[], fileNames: (string | undefined)[], resourceDir: string, caveId: number, mediaType: 'img' | 'video', config: {
|
|
69
|
-
enableImageDuplicate: boolean;
|
|
70
|
-
imageDuplicateThreshold: number;
|
|
71
|
-
textDuplicateThreshold: number;
|
|
72
|
-
}, ctx: Context, session: any, buffers?: Buffer[]): Promise<string[]>;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Config } from '..';
|
|
2
|
-
import { IdManager } from './IdManager';
|
|
3
|
-
import { HashManager } from './HashManager';
|
|
4
|
-
/**
|
|
5
|
-
* 处理回声洞列表查询
|
|
6
|
-
* @param session - 会话对象
|
|
7
|
-
* @param config - 配置对象
|
|
8
|
-
* @param idManager - ID管理器实例
|
|
9
|
-
* @param userId - 可选的用户ID,用于筛选特定用户的回声洞
|
|
10
|
-
* @param pageNum - 页码,默认为1
|
|
11
|
-
* @returns 格式化后的回声洞列表字符串
|
|
12
|
-
*/
|
|
13
|
-
export declare function processList(session: any, config: Config, idManager: IdManager, userId?: string, pageNum?: number): Promise<string>;
|
|
14
|
-
/**
|
|
15
|
-
* 查看指定ID的回声洞内容
|
|
16
|
-
* @param caveFilePath - 回声洞数据文件路径
|
|
17
|
-
* @param resourceDir - 资源文件目录路径
|
|
18
|
-
* @param session - 会话对象
|
|
19
|
-
* @param options - 命令选项
|
|
20
|
-
* @param content - 命令内容数组
|
|
21
|
-
* @returns 回声洞内容的格式化字符串
|
|
22
|
-
*/
|
|
23
|
-
export declare function processView(caveFilePath: string, resourceDir: string, session: any, options: any, content: string[]): Promise<string>;
|
|
24
|
-
/**
|
|
25
|
-
* 随机获取一个回声洞
|
|
26
|
-
* @param caveFilePath - 回声洞数据文件路径
|
|
27
|
-
* @param resourceDir - 资源文件目录路径
|
|
28
|
-
* @param session - 会话对象
|
|
29
|
-
* @returns 随机回声洞的格式化字符串,如果没有可用的回声洞则返回错误消息
|
|
30
|
-
*/
|
|
31
|
-
export declare function processRandom(caveFilePath: string, resourceDir: string, session: any): Promise<string | void>;
|
|
32
|
-
/**
|
|
33
|
-
* 删除指定ID的回声洞
|
|
34
|
-
* @param caveFilePath - 回声洞数据文件路径
|
|
35
|
-
* @param resourceDir - 资源文件目录路径
|
|
36
|
-
* @param pendingFilePath - 待审核回声洞数据文件路径
|
|
37
|
-
* @param session - 会话对象
|
|
38
|
-
* @param config - 配置对象
|
|
39
|
-
* @param options - 命令选项
|
|
40
|
-
* @param content - 命令内容数组
|
|
41
|
-
* @param idManager - ID管理器实例
|
|
42
|
-
* @param HashManager - 哈希管理器实例
|
|
43
|
-
* @returns 删除操作的结果消息
|
|
44
|
-
*/
|
|
45
|
-
export declare function processDelete(caveFilePath: string, resourceDir: string, pendingFilePath: string, session: any, config: Config, options: any, content: string[], idManager: IdManager, HashManager: HashManager): Promise<string>;
|