UNPKG

koishi-plugin-memes

Version:

生成 Meme 表情包,支持 MemeGenerator API (v1)、内置模板和自定义 API 接口

52 lines (51 loc) 1.63 kB
import { Context, Command } from 'koishi'; /** * 表情生成器类 - 处理各种图片生成功能 * @class MemeMaker */ export declare class MemeMaker { private ctx; /** * 图片配置参数 * @private * @readonly * @property {Object} sizes - 不同尺寸配置 * @property {Object} styles - 不同样式配置 */ private readonly IMAGE_CONFIG; /** * 创建表情生成器实例 * @constructor * @param {Context} ctx - Koishi 上下文实例 */ constructor(ctx: Context); /** * 将HTML内容渲染为图片 * @async * @param {string} html - 要渲染的HTML内容 * @param {Object} options - 渲染选项 * @param {number} [options.width] - 图片宽度 * @param {number} [options.height] - 图片高度 * @returns {Promise<Buffer>} 生成的图片Buffer * @throws {Error} 渲染过程中的错误 */ htmlToImage(html: string, { width, height }?: { width?: number; height?: number; }): Promise<Buffer>; /** * 生成头像效果合成图 * @async * @param {string} avatarUrl - 头像URL或本地文件路径 * @param {string} style - 使用的样式名称 * @returns {Promise<Buffer>} 生成的图片Buffer * @throws {Error} 生成过程中的错误 */ generateAvatarEffect(avatarUrl: string, style: string): Promise<Buffer>; /** * 注册表情生成相关命令 * @param {Command} parentCommand - 父命令实例 * @returns {Command} 创建的子命令 */ registerCommands(parentCommand: Command): Command; }