Run any Skill in Manus
with one click
with one click
Run any Skill in Manus with one click
Get Started$pwd:
$ git log --oneline --stat
stars:52
forks:1
updated:March 1, 2026 at 09:15
SKILL.md
| name | history-message |
| description | 历史消息搜索功能。支持关键词搜索群聊和好友的历史消息记录。 |
提供类似于搜索引擎的历史消息搜索功能,可根据关键词查找包含该关键词的历史消息及发送者信息。
搜索群聊历史消息(推荐 AI 使用此方法)。
参数:
groupId: number - 群组 IDkeywords: string - 搜索关键词(支持多个,空格分隔)limit: number - 返回结果数量,默认 20返回: JSON 字符串,需 JSON.parse 解析
{ success: true, message: string, results: [{ sender, time, content }] }{ success: false, error: string }底层函数,搜索群聊历史消息。
参数:
context: LagrangeContext - 上下文对象options:
keywords: string - 搜索关键词groupId: number - 群组 IDmaxMessages: number - 最大搜索消息数,默认 500limit: number - 返回结果数量,默认 20caseSensitive: boolean - 是否区分大小写,默认 falsematchWholeWord: boolean - 是否匹配完整单词,默认 false返回: HistoryMessageResult[] 数组
底层函数,搜索好友历史消息。
参数:
context: LagrangeContext - 上下文对象options:
keywords: string - 搜索关键词userId: number - 好友 QQ 号maxMessages: number - 最大搜索消息数,默认 500limit: number - 返回结果数量,默认 20返回: HistoryMessageResult[] 数组
获取历史消息时,必须对 message 字段进行类型检查:
const res = await context.getGroupMsgHistory({ group_id: groupId, count: 20 });
const messages = res?.data?.messages ?? [];
// 正确解析消息段数组
for (const msg of messages) {
let content = '';
if (typeof msg.message === 'string') {
content = msg.message;
} else if (Array.isArray(msg.message)) {
content = msg.message
.filter(s => s.type === 'text')
.map(s => s.data?.text || '')
.join('');
}
}
// 搜索群聊中包含"放假"关键词的历史消息
const searchResult = await util.searchHistoryMessages(groupId, "放假", 10);
const result = JSON.parse(searchResult);
if (result.success && result.results.length > 0) {
// 格式化输出搜索结果
const summary = result.results
.slice(0, 5)
.map(r => `${r.sender} 在 ${r.time}: ${r.content}`)
.join('\n');
await context.sendGroupMsg(groupId, `找到 ${result.results.length} 条相关消息:\n${summary}`);
} else {
await context.sendGroupMsg(groupId, result.message || "未找到相关消息");
}
// 搜索同时包含"明天"和"会议"的消息(所有关键词必须同时匹配)
const result = await util.searchHistoryMessages(groupId, "明天 会议", 20);
import { searchGroupMsgHistory } from './util/message-search';
const results = await searchGroupMsgHistory(context, {
keywords: "活动",
groupId: groupId,
maxMessages: 300,
limit: 10,
caseSensitive: false,
});
// results 是 HistoryMessageResult[] 数组
// 每项包含:senderId, senderName, time, content, messageId
机器人唯一的动作出口。通过 TS/JS 代码调用 OneBot API。
基于向量的长期记忆系统。用于存储用户偏好、历史纠正。
QQ 机器人核心驱动索引。定义了白面鸮人格、SOP 流程及工具调用入口。
外部扩展能力,包括网络搜索、网页内容转换。