koishi-plugin-best-cave
Version:
回声洞,可自由添加内容,可配置 MD5/pHash 查重,支持查阅投稿列表(可用但等待重构)
87 lines (86 loc) • 3.81 kB
TypeScript
import { Context, Schema } from 'koishi';
export declare const name = "best-cave";
export declare const inject: string[];
export declare const usage = "\n<div style=\"border-radius: 10px; border: 1px solid #ddd; padding: 16px; margin-bottom: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.1);\">\n <h2 style=\"margin-top: 0; color: #4a6ee0;\">\uD83D\uDCCC \u63D2\u4EF6\u8BF4\u660E</h2>\n <p>\uD83D\uDCD6 <strong>\u4F7F\u7528\u6587\u6863</strong>\uFF1A\u8BF7\u70B9\u51FB\u5DE6\u4E0A\u89D2\u7684 <strong>\u63D2\u4EF6\u4E3B\u9875</strong> \u67E5\u770B\u63D2\u4EF6\u4F7F\u7528\u6587\u6863</p>\n <p>\uD83D\uDD0D <strong>\u66F4\u591A\u63D2\u4EF6</strong>\uFF1A\u53EF\u8BBF\u95EE <a href=\"https://github.com/YisRime\" style=\"color:#4a6ee0;text-decoration:none;\">\u82E1\u6DDE\u7684 GitHub</a> \u67E5\u770B\u672C\u4EBA\u7684\u6240\u6709\u63D2\u4EF6</p>\n</div>\n\n<div style=\"border-radius: 10px; border: 1px solid #ddd; padding: 16px; margin-bottom: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.1);\">\n <h2 style=\"margin-top: 0; color: #e0574a;\">\u2764\uFE0F \u652F\u6301\u4E0E\u53CD\u9988</h2>\n <p>\uD83C\uDF1F \u559C\u6B22\u8FD9\u4E2A\u63D2\u4EF6\uFF1F\u8BF7\u5728 <a href=\"https://github.com/YisRime\" style=\"color:#e0574a;text-decoration:none;\">GitHub</a> \u4E0A\u7ED9\u6211\u4E00\u4E2A Star\uFF01</p>\n <p>\uD83D\uDC1B \u9047\u5230\u95EE\u9898\uFF1F\u8BF7\u901A\u8FC7 <strong>Issues</strong> \u63D0\u4EA4\u53CD\u9988\uFF0C\u6216\u52A0\u5165 QQ \u7FA4 <a href=\"https://qm.qq.com/q/PdLMx9Jowq\" style=\"color:#e0574a;text-decoration:none;\"><strong>855571375</strong></a> \u8FDB\u884C\u4EA4\u6D41</p>\n</div>\n";
/**
* 基础元素类型
* @interface BaseElement
* @property {('text'|'img'|'video')} type - 元素类型
* @property {number} index - 排序索引
*/
export interface BaseElement {
type: 'text' | 'img' | 'video';
index: number;
}
/**
* 文本元素类型
* @interface TextElement
* @extends {BaseElement}
* @property {'text'} type - 文本类型
* @property {string} content - 文本内容
*/
export interface TextElement extends BaseElement {
type: 'text';
content: string;
}
/**
* 媒体元素类型
* @interface MediaElement
* @extends {BaseElement}
* @property {('img'|'video')} type - 媒体类型
* @property {string} [file] - 文件名
* @property {string} [fileName] - 原始文件名
* @property {string} [fileSize] - 文件大小
* @property {string} [filePath] - 文件路径
*/
export interface MediaElement extends BaseElement {
type: 'img' | 'video';
file?: string;
fileName?: string;
fileSize?: string;
filePath?: string;
}
export type Element = TextElement | MediaElement;
/**
* 回声洞对象
* @interface CaveObject
* @property {number} cave_id - 回声洞ID
* @property {Element[]} elements - 元素列表
* @property {string} contributor_number - 投稿者ID
* @property {string} contributor_name - 投稿者名称
*/
export interface CaveObject {
cave_id: number;
elements: Element[];
contributor_number: string;
contributor_name: string;
}
export interface PendingCave extends CaveObject {
}
export interface Config {
manager: string[];
number: number;
enableAudit: boolean;
allowVideo: boolean;
videoMaxSize: number;
imageMaxSize: number;
blacklist: string[];
whitelist: string[];
enablePagination: boolean;
itemsPerPage: number;
enableImageDuplicate: boolean;
imageDuplicateThreshold: number;
textDuplicateThreshold: number;
enableTextDuplicate: boolean;
}
/**
* 插件配置项
* @type {Schema}
*/
export declare const Config: Schema<Config>;
/**
* 插件主入口
* @param {Context} ctx - Koishi上下文
* @param {Config} config - 插件配置
*/
export declare function apply(ctx: Context, config: Config): Promise<void>;