/** * 微信表情包 TypeScript 模块 * 提供类型安全的表情访问和图片路径获取功能 */ /** * 表情类别枚举 */ export declare enum EmojiCategory { /** 人脸表情 */ FACE = "face", /** 手势表情 */ GESTURE = "gesture", /** 动物表情 */ ANIMAL = "animal", /** 祝福表情 */ BLESSING = "blessing", /** 其他表情 */ OTHER = "other" } /** * 表情信息接口 */ export interface EmojiInfo { /** 表情名称 */ name: string; /** 表情类别 */ category: EmojiCategory; /** 图片文件路径 */ path: string; /** 英文名称(可选) */ englishName?: string; } /** * 表情名称类型 */ export type EmojiName = '微笑' | '撇嘴' | '色' | '发呆' | '得意' | '流泪' | '害羞' | '闭嘴' | '睡' | '大哭' | '尴尬' | '发怒' | '调皮' | '呲牙' | '惊讶' | '难过' | '囧' | '抓狂' | '吐' | '偷笑' | '愉快' | '白眼' | '傲慢' | '困' | '惊恐' | '憨笑' | '悠闲' | '咒骂' | '疑问' | '嘘' | '晕' | '衰' | '骷髅' | '敲打' | '再见' | '擦汗' | '抠鼻' | '鼓掌' | '坏笑' | '右哼哼' | '鄙视' | '委屈' | '快哭了' | '阴险' | '亲亲' | '可怜' | '笑脸' | '生病' | '脸红' | '破涕为笑' | '恐惧' | '失望' | '无语' | '嘿哈' | '捂脸' | '机智' | '皱眉' | '耶' | '吃瓜' | '加油' | '汗' | '天啊' | 'Emm' | '社会社会' | '旺柴' | '好的' | '打脸' | '哇' | '翻白眼' | '666' | '让我看看' | '叹气' | '苦涩' | '裂开' | '奸笑' | '握手' | '胜利' | '抱拳' | '勾引' | '拳头' | 'OK' | '合十' | '强' | '拥抱' | '弱' | '猪头' | '跳跳' | '发抖' | '转圈' | '庆祝' | '礼物' | '红包' | '發' | '福' | '烟花' | '爆竹' | '嘴唇' | '爱心' | '心碎' | '啤酒' | '咖啡' | '蛋糕' | '凋谢' | '菜刀' | '炸弹' | '便便' | '太阳' | '月亮' | '玫瑰'; /** * 按类别分组的表情数据 * 每次读取返回新的数组(里面也是对象副本),修改它不会影响库的内部数据 */ export declare const EMOJI_CATEGORIES: Record; /** * 获取表情图片路径 * @param name 表情名称 * @returns 图片路径,如果表情不存在则返回 null * * @example * ```typescript * const path = getEmojiPath('微笑'); // 'assets/face/微笑.png' * const invalidPath = getEmojiPath('不存在'); // null * ``` */ export declare function getEmojiPath(name: EmojiName): string | null; /** * jsDelivr 上的表情图片根地址,跟随 2.x 的最新发布 */ export declare const EMOJI_CDN_BASE = "https://cdn.jsdelivr.net/npm/wechat-emojis@2"; /** * 获取表情图片的完整 URL,可以直接给 使用,无需复制任何文件 * @param name 表情名称 * @returns 图片的绝对 URL,如果表情不存在则返回 null * * @example * ```typescript * const url = getEmojiUrl('旺柴'); * // 'https://cdn.jsdelivr.net/npm/wechat-emojis@2/assets/face/%E6%97%BA%E6%9F%B4.png' * ``` */ export declare function getEmojiUrl(name: EmojiName): string | null; /** * 获取表情信息 * @param name 表情名称 * @returns 表情信息对象,如果表情不存在则返回 null * * @example * ```typescript * const emoji = getEmojiInfo('微笑'); * // { name: '微笑', category: EmojiCategory.FACE, path: 'assets/face/微笑.png' } * ``` */ export declare function getEmojiInfo(name: EmojiName): EmojiInfo | null; /** * 根据类别获取表情列表 * @param category 表情类别 * @returns 该类别下的所有表情信息 * * @example * ```typescript * const faceEmojis = getEmojisByCategory(EmojiCategory.FACE); * ``` */ export declare function getEmojisByCategory(category: EmojiCategory): EmojiInfo[]; /** * 获取所有表情信息 * @returns 所有表情的信息数组 * * @example * ```typescript * const allEmojis = getAllEmojis(); * console.log(`总共有 ${allEmojis.length} 个表情`); * ``` */ export declare function getAllEmojis(): EmojiInfo[]; /** * 搜索表情 * @param keyword 搜索关键词 * @returns 匹配的表情信息数组 * * @example * ```typescript * const results = searchEmojis('笑'); * // 返回包含 '微笑', '偷笑', '坏笑' 等的表情 * ``` */ export declare function searchEmojis(keyword: string): EmojiInfo[]; /** * 检查表情是否存在 * @param name 表情名称 * @returns 是否存在该表情 * * @example * ```typescript * const exists = hasEmoji('微笑'); // true * const notExists = hasEmoji('不存在的表情'); // false * ``` */ export declare function hasEmoji(name: EmojiName): boolean; /** * 获取表情名称列表 * @param category 可选的类别筛选 * @returns 表情名称数组 * * @example * ```typescript * const allNames = getEmojiNames(); * const faceNames = getEmojiNames(EmojiCategory.FACE); * ``` */ export declare function getEmojiNames(category?: EmojiCategory): string[]; /** * 随机获取表情 * @param category 可选的类别筛选 * @returns 随机表情信息 * * @example * ```typescript * const randomEmoji = getRandomEmoji(); * const randomFaceEmoji = getRandomEmoji(EmojiCategory.FACE); * ``` */ export declare function getRandomEmoji(category?: EmojiCategory): EmojiInfo; /** * 默认导出对象,包含所有主要功能 */ declare const WeChatEmojis: { readonly EmojiCategory: typeof EmojiCategory; readonly EMOJI_CATEGORIES: Record; readonly EMOJI_CDN_BASE: "https://cdn.jsdelivr.net/npm/wechat-emojis@2"; readonly getEmojiPath: typeof getEmojiPath; readonly getEmojiUrl: typeof getEmojiUrl; readonly getEmojiInfo: typeof getEmojiInfo; readonly getEmojisByCategory: typeof getEmojisByCategory; readonly getAllEmojis: typeof getAllEmojis; readonly searchEmojis: typeof searchEmojis; readonly hasEmoji: typeof hasEmoji; readonly getEmojiNames: typeof getEmojiNames; readonly getRandomEmoji: typeof getRandomEmoji; }; export default WeChatEmojis;