UNPKG

koishi-plugin-adapter-iirose

Version:
35 lines (34 loc) 956 B
import { Session } from 'koishi'; /** * Session 缓存 */ export declare class SessionCache { private sessions; private maxSize; constructor(maxSize?: number); /** * 向缓存中添加一个新的 Session * @param session 要添加的 Session */ add(session: Session): void; /** * 根据引用信息查找匹配的 Session * @param quoteInfo 包含作者名和消息内容的对象 * @returns 匹配的 Session,如果找不到则返回 undefined */ findQuote(quoteInfo: { username: string; content: string; }): Session | undefined; /** * 根据消息 ID 查找 Session * @param messageId 消息 ID * @returns 匹配的 Session,如果找不到则返回 undefined */ findById(messageId: string): Session | undefined; /** * 获取所有缓存的 messageId * @returns messageId 数组 */ getAllMessageIds(): string[]; }