openclaw-plugin-yuanbao 2.9.0 → 2.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -23,14 +23,16 @@ export const customHandler = {
|
|
|
23
23
|
resData.isAtBot = isAtBotSelf;
|
|
24
24
|
}
|
|
25
25
|
createLog('custom').info('@消息', { text: customContent?.text, userId: customContent?.user_id, isAtBot: resData.isAtBot });
|
|
26
|
-
if (
|
|
26
|
+
if (customContent?.user_id) {
|
|
27
27
|
resData.mentions.push({
|
|
28
28
|
userId: customContent.user_id,
|
|
29
29
|
text: customContent.text || '',
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
if (isAtBotSelf && customContent.text) {
|
|
33
|
+
resData.botUsername = customContent.text.replace(/^@/, '');
|
|
34
|
+
}
|
|
35
|
+
return customContent.text || undefined;
|
|
34
36
|
}
|
|
35
37
|
catch { }
|
|
36
38
|
}
|
|
@@ -343,7 +343,7 @@ async function handleGroupMessage(params) {
|
|
|
343
343
|
glog.info('跳过机器人自身消息', { groupCode, fromAccount });
|
|
344
344
|
return;
|
|
345
345
|
}
|
|
346
|
-
const { rawBody, isAtBot, medias, mentions } = extractTextFromMsgBody(ctx, msg.msg_body);
|
|
346
|
+
const { rawBody, isAtBot, medias, mentions, botUsername } = extractTextFromMsgBody(ctx, msg.msg_body);
|
|
347
347
|
glog.info(`收到群消息 <- group:${groupCode}, from: ${fromAccount}${senderNickname ? `(${senderNickname})` : ''}, msgSeq: ${msg.msg_seq}, isAtBot: ${isAtBot}`);
|
|
348
348
|
const quoteInfo = parseQuoteFromCloudCustomData(msg.cloud_custom_data);
|
|
349
349
|
if (quoteInfo) {
|
|
@@ -448,12 +448,10 @@ async function handleGroupMessage(params) {
|
|
|
448
448
|
const rewrittenBody = rewriteSlashCommand(rawBody, (orig, rewritten) => {
|
|
449
449
|
glog.info(`群命令改写: "${orig}" -> "${rewritten}"`);
|
|
450
450
|
});
|
|
451
|
-
const mentionsContext = mentions && mentions.length > 0
|
|
452
|
-
? `\n[消息中@了以下用户: ${mentions.map(m => `${m.text}(userId: ${m.userId})`).join(', ')}]`
|
|
453
|
-
: '';
|
|
451
|
+
const mentionsContext = mentions && mentions.length > 0 ? `消息中@了以下用户: ${mentions.map(m => `${m.text}(userId: ${m.userId})`).join(', ')}` : null;
|
|
454
452
|
const bodyWithQuote = quoteInfo
|
|
455
|
-
? `${formatQuoteContext(quoteInfo)}\n${rewrittenBody}
|
|
456
|
-
: `${rewrittenBody}
|
|
453
|
+
? `${formatQuoteContext(quoteInfo)}\n${rewrittenBody}`
|
|
454
|
+
: `${rewrittenBody}`;
|
|
457
455
|
glog.debug(`开始处理群消息, 账号: ${account.accountId}, group: ${groupCode}`);
|
|
458
456
|
const historyMedias = getHistoryMedias(groupCode, fromAccount, quoteInfo);
|
|
459
457
|
if (medias.length > 0) {
|
|
@@ -525,6 +523,12 @@ async function handleGroupMessage(params) {
|
|
|
525
523
|
OriginatingChannel: 'yuanbao',
|
|
526
524
|
OriginatingTo: `yuanbao:group:${groupCode}`,
|
|
527
525
|
CommandAuthorized: commandAuthorized,
|
|
526
|
+
WasMentioned: isAtBot,
|
|
527
|
+
BotUsername: botUsername,
|
|
528
|
+
UntrustedContext: [
|
|
529
|
+
botUsername && `BotUsername(self): ${botUsername}`,
|
|
530
|
+
mentionsContext,
|
|
531
|
+
].filter(Boolean),
|
|
528
532
|
...(account.markdownHintEnabled && { GroupSystemPrompt: YUANBAO_MARKDOWN_HINT }),
|
|
529
533
|
...(mediaPaths.length > 0 && { MediaPaths: mediaPaths, MediaPath: mediaPaths[0] }),
|
|
530
534
|
...(mediaTypes.length > 0 && { MediaTypes: mediaTypes, MediaType: mediaTypes[0] }),
|
package/openclaw.plugin.json
CHANGED