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.
@@ -2,7 +2,7 @@
2
2
  "id": "openclaw-plugin-yuanbao",
3
3
  "name": "元宝 Bot",
4
4
  "description": "Tencent YuanBao intelligent bot channel plugin",
5
- "version": "2.9.0",
5
+ "version": "2.9.1",
6
6
  "channels": [
7
7
  "yuanbao"
8
8
  ],
@@ -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 (!isAtBotSelf && customContent?.user_id) {
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
- const result = !isAtBotSelf && customContent.text ? customContent.text : undefined;
33
- return result;
32
+ if (isAtBotSelf && customContent.text) {
33
+ resData.botUsername = customContent.text.replace(/^@/, '');
34
+ }
35
+ return customContent.text || undefined;
34
36
  }
35
37
  catch { }
36
38
  }
@@ -37,6 +37,7 @@ export type ExtractTextFromMsgBodyResult = {
37
37
  isAtBot: boolean;
38
38
  medias: MediaItem[];
39
39
  mentions: MentionItem[];
40
+ botUsername?: string;
40
41
  };
41
42
  export type OutboundContentItem = {
42
43
  type: 'text';
@@ -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}${mentionsContext}`
456
- : `${rewrittenBody}${mentionsContext}`;
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] }),
@@ -2,7 +2,7 @@
2
2
  "id": "openclaw-plugin-yuanbao",
3
3
  "name": "元宝 Bot",
4
4
  "description": "Tencent YuanBao intelligent bot channel plugin",
5
- "version": "2.9.0",
5
+ "version": "2.9.1",
6
6
  "channels": [
7
7
  "yuanbao"
8
8
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-plugin-yuanbao",
3
- "version": "2.9.0",
3
+ "version": "2.9.1",
4
4
  "type": "module",
5
5
  "description": "Tencent YuanBao intelligent bot channel plugin",
6
6
  "license": "MIT",